Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #9

Merged
merged 7 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Deploy to dokku
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: api.eip.fun
host: api-dev.eip.fun
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
/home/ubuntu/apps/api-dev.eips.fun.sh 653640199626.dkr.ecr.us-west-2.amazonaws.com/eipsfun:${{ github.sha }}
/root/apps/api-dev.eip.fun.sh 653640199626.dkr.ecr.us-west-2.amazonaws.com/eipsfun:${{ github.sha }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

Dev CICD test.

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
Expand Down
10 changes: 5 additions & 5 deletions src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class AppService {
});

const list = await this.connection.query(
`SELECT id, eip, title, author, status, type, category FROM "EIPs" ${condition} order by (substring("eip", '^[0-9]+'))::int LIMIT ${take} OFFSET ${skip}`,
`SELECT id, eip, title, author, status, type, category FROM "EIPs" ${condition} order by eip LIMIT ${take} OFFSET ${skip}`,
);

return {
Expand All @@ -92,7 +92,7 @@ export class AppService {
numbers.forEach((item) => {
if (Number(item) < 10000) {
// eip number don't overt 10000
eips.push(`eip LIKE '%${item}%'`);
eips.push(`eip::text LIKE '%${item}%'`);
}
});
if (eips.length === 1) {
Expand All @@ -113,7 +113,7 @@ export class AppService {
// title match
const conditions = eips.length ? `${eipCondition} AND` : ``;
const titleRecords = await this.connection.query(
`SELECT eip, type, category, ts_headline('english',title, q), rank FROM (SELECT eip, type, category, title, q, ts_rank_cd(title_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} title_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
`SELECT eip, type, category, ts_headline('english',title, q), rank FROM (SELECT eip, type, category, title, q, ts_rank_cd(to_tsvector(title_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} title_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
);

if (titleRecords && titleRecords.length > 0) {
Expand All @@ -122,7 +122,7 @@ export class AppService {

// author match
const authorRecords = await this.connection.query(
`SELECT eip, type, category, ts_headline('english', author, q), rank FROM (SELECT eip, type, category, author, q, ts_rank_cd(author_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} author_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
`SELECT eip, type, category, ts_headline('english', author, q), rank FROM (SELECT eip, type, category, author, q, ts_rank_cd(to_tsvector(author_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} author_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
);

if (authorRecords && authorRecords.length > 0) {
Expand All @@ -131,7 +131,7 @@ export class AppService {

// content match
const contentRecords = await this.connection.query(
`SELECT eip, type, category, title, ts_headline('english',content, q), rank FROM (SELECT eip, type, category, title, content, q, ts_rank_cd(content_ts, q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} content_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
`SELECT eip, type, category, title, ts_headline('english',content, q), rank FROM (SELECT eip, type, category, title, content, q, ts_rank_cd(to_tsvector(content_ts), q) AS rank FROM "EIPs", phraseto_tsquery('english','${txt}') q WHERE ${conditions} content_ts @@ q ORDER BY rank DESC LIMIT 20) AS foo;`,
);
if (contentRecords && contentRecords.length > 0) {
result['content_list'] = contentRecords;
Expand Down
Loading