From 7fb19c8f7fadba96138e9c736157af4fb7155d2c Mon Sep 17 00:00:00 2001 From: Bruce Xu <95468177+brucexu-eth@users.noreply.github.com> Date: Thu, 16 Jan 2025 22:55:36 +1300 Subject: [PATCH 1/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ba73b58..8e4e057 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ +Dev CICD test. + ## Description [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. From 93f28f7ecd4e5ee14c17d52d3ca4787136a4567a Mon Sep 17 00:00:00 2001 From: Bruce Xu <95468177+brucexu-eth@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:10:32 +1300 Subject: [PATCH 2/7] Update develop.yml --- .github/workflows/develop.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 221bb0b..f2808e4 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -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 }} From b4ccb509d58994aefb9345d3a17e354a39c747f1 Mon Sep 17 00:00:00 2001 From: Bruce Xu Date: Fri, 17 Jan 2025 16:39:57 +1300 Subject: [PATCH 3/7] Fix db issue --- src/app.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.service.ts b/src/app.service.ts index d7aeadb..f49dbd5 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -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 { From d6a43411c094598cef9b810e35a22b63edbb1e05 Mon Sep 17 00:00:00 2001 From: Bruce Xu Date: Fri, 17 Jan 2025 17:41:32 +1300 Subject: [PATCH 4/7] Fix db issue --- src/app.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.service.ts b/src/app.service.ts index f49dbd5..f3730ee 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -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) { From 8f4e52b4c6a29db17d13391e7c35be5e8e8cbbe4 Mon Sep 17 00:00:00 2001 From: Bruce Xu Date: Fri, 17 Jan 2025 17:48:42 +1300 Subject: [PATCH 5/7] Fix db issue --- src/app.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app.service.ts b/src/app.service.ts index f3730ee..ba10e2e 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -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(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) { @@ -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(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) { @@ -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(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; From c5591299c90432eb5d243863e6df542b0f2d1e0a Mon Sep 17 00:00:00 2001 From: Bruce Xu Date: Fri, 17 Jan 2025 17:58:27 +1300 Subject: [PATCH 6/7] Fix db issue --- src/app.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app.service.ts b/src/app.service.ts index ba10e2e..1cddce6 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -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(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) { @@ -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(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) { @@ -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(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; From 56759c52ef3296ace0aeda66007260c37dc8df7b Mon Sep 17 00:00:00 2001 From: Bruce Xu Date: Fri, 17 Jan 2025 19:29:50 +1300 Subject: [PATCH 7/7] Fix db error --- src/app.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.service.ts b/src/app.service.ts index 1cddce6..14aee8e 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -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(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;`, + `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;