Skip to content

Commit

Permalink
Merge pull request #78 from Giveth/develop
Browse files Browse the repository at this point in the history
Add description summary support
  • Loading branch information
aminlatifi authored Jun 10, 2024
2 parents 763879e + cd614ec commit 60ed547
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 50 deletions.
11 changes: 11 additions & 0 deletions db/migrations/1718005314786-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1718005314786 {
name = 'Data1718005314786'

async up(db) {
await db.query(`ALTER TABLE "project" ADD "description_summary" text`)
}

async down(db) {
await db.query(`ALTER TABLE "project" DROP COLUMN "description_summary"`)
}
}
208 changes: 162 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@subsquid/typeorm-store": "^1.4.0",
"dotenv": "^16.4.4",
"ethers": "^6.12.1",
"html-to-text": "^9.0.5",
"node-cron": "^3.0.3",
"pg": "^8.11.5",
"showdown": "^2.1.0",
Expand All @@ -31,6 +32,7 @@
"@dotenvx/dotenvx": "^0.35.1",
"@subsquid/evm-typegen": "^3.3.0",
"@subsquid/typeorm-codegen": "^1.3.3",
"@types/html-to-text": "^9.0.4",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
"@types/node-cron": "^3.0.11",
Expand Down
2 changes: 2 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ type Project @entity {
description: String
"Html format of description"
descriptionHtml: String
"Description summary in text"
descriptionSummary: String
"Total attests with value True"
totalVouches: Int!
"Total attests with value False"
Expand Down
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ export const START_BLOCK = Number.parseInt(

export const IMPORT_PROJECT_CRON_SCHEDULE =
process.env.IMPORT_PROJECT_CRON_SCHEDULE || "0 0 * * *"; // UTC

export const DESCRIPTION_SUMMARY_LENGTH = Number(
process.env.DESCRIPTION_SUMMARY_LENGTH || 300
);
2 changes: 1 addition & 1 deletion src/features/import-projects/giveth/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const givethSourceConfig: SourceConfig = {
source: "giveth",
idField: "id",
titleField: "title",
descriptionField: "descriptionSummary",
descriptionField: "description",
urlField: "url",
imageField: "image",
};
2 changes: 1 addition & 1 deletion src/features/import-projects/giveth/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const fetchGivethProjectsBatch = async (limit: number, skip: number) => {
title
image
slug
descriptionSummary
description
}
}
}`,
Expand Down
2 changes: 1 addition & 1 deletion src/features/import-projects/giveth/type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type GivethProjectInfo = {
id: string;
title: string;
descriptionSummary: string;
description: string;
slug: string;
image: string;
};
Loading

0 comments on commit 60ed547

Please sign in to comment.