diff --git a/src/dataLoaders/sqlQueries/dripListsQueries.ts b/src/dataLoaders/sqlQueries/dripListsQueries.ts index 19018a9..7efcaa2 100644 --- a/src/dataLoaders/sqlQueries/dripListsQueries.ts +++ b/src/dataLoaders/sqlQueries/dripListsQueries.ts @@ -47,7 +47,7 @@ async function getDripListsByIds( dripListIds: DripListId[], ) { const baseSQL = (schema: DbSchema) => ` - SELECT "id", "isValid", "isVisible", "ownerAddress", "ownerAccountId", "name", "latestVotingRoundId", "description", "creator", "previousOwnerAddress", "createdAt", "updatedAt", '${schema}' AS chain + SELECT "id", "isValid", "isVisible", "ownerAddress", "ownerAccountId", "name", "latestVotingRoundId", "description", "creator", "previousOwnerAddress", "createdAt", "updatedAt", "lastProcessedIpfsHash", '${schema}' AS chain FROM "${schema}"."DripLists" `; diff --git a/src/dataLoaders/sqlQueries/projectsQueries.ts b/src/dataLoaders/sqlQueries/projectsQueries.ts index 801d52f..583a377 100644 --- a/src/dataLoaders/sqlQueries/projectsQueries.ts +++ b/src/dataLoaders/sqlQueries/projectsQueries.ts @@ -13,7 +13,7 @@ async function getProjectByUrl( url: string, ): Promise { const baseSQL = (schema: DbSchema) => ` - SELECT "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", '${schema}' AS chain + SELECT "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", "lastProcessedIpfsHash", '${schema}' AS chain FROM "${schema}"."GitProjects" `; @@ -43,7 +43,7 @@ async function getProjectsByFilter( ): Promise { const baseSQL = (schema: DbSchema) => `SELECT - "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", '${schema}' AS chain + "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", "lastProcessedIpfsHash", '${schema}' AS chain FROM "${schema}"."GitProjects" `; const conditions: string[] = ['"isValid" = true']; @@ -91,7 +91,7 @@ async function getProjectsByIds( projectIds: ProjectId[], ): Promise { const baseSQL = (schema: DbSchema) => ` - SELECT "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", '${schema}' AS chain + SELECT "id", "isValid", "isVisible", "name", "verificationStatus"::TEXT, "claimedAt", "forge"::TEXT, "ownerAddress", "ownerAccountId", "url", "emoji", "avatarCid", "color", "description", "createdAt", "updatedAt", "lastProcessedIpfsHash", '${schema}' AS chain FROM "${schema}"."GitProjects" `; diff --git a/src/drip-list/DripListModel.ts b/src/drip-list/DripListModel.ts index 57ee3a1..e2f3d00 100644 --- a/src/drip-list/DripListModel.ts +++ b/src/drip-list/DripListModel.ts @@ -24,6 +24,7 @@ export default class DripListModel extends Model< public declare previousOwnerAddress: AddressLike; public declare latestVotingRoundId: UUID | null; public declare isVisible: boolean; + public declare lastProcessedIpfsHash: string | null; public static initialize(sequelize: Sequelize): void { this.init( @@ -68,6 +69,10 @@ export default class DripListModel extends Model< type: DataTypes.BOOLEAN, allowNull: false, }, + lastProcessedIpfsHash: { + type: DataTypes.TEXT, + allowNull: true, + }, }, { sequelize, diff --git a/src/drip-list/dripListResolvers.ts b/src/drip-list/dripListResolvers.ts index aed2086..adcf522 100644 --- a/src/drip-list/dripListResolvers.ts +++ b/src/drip-list/dripListResolvers.ts @@ -297,6 +297,8 @@ const dripListResolvers = { parentDripListInfo: { dripListChain, dripListId }, }: ResolverDripListData) => getLatestMetadataHashOnChain(dripListId, dripListChain), + lastProcessedIpfsHash: (dripListData: ResolverDripListData) => + dripListData.lastProcessedIpfsHash, }, }; diff --git a/src/drip-list/dripListTypeDef.ts b/src/drip-list/dripListTypeDef.ts index 0bfb01c..0c5a671 100644 --- a/src/drip-list/dripListTypeDef.ts +++ b/src/drip-list/dripListTypeDef.ts @@ -15,6 +15,7 @@ const dripListTypeDef = gql` totalEarned: [Amount!]! latestMetadataIpfsHash: String isVisible: Boolean! + lastProcessedIpfsHash: String } input DripListWhereInput { diff --git a/src/project/ProjectModel.ts b/src/project/ProjectModel.ts index f4e7ced..870c562 100644 --- a/src/project/ProjectModel.ts +++ b/src/project/ProjectModel.ts @@ -42,6 +42,7 @@ export default class ProjectModel extends Model< public declare description: string | null; public declare verificationStatus: ProjectVerificationStatus; public declare isVisible: boolean; + public declare lastProcessedIpfsHash: string | null; public declare claimedAt: Date | null; @@ -104,6 +105,10 @@ export default class ProjectModel extends Model< type: DataTypes.BOOLEAN, allowNull: false, }, + lastProcessedIpfsHash: { + type: DataTypes.TEXT, + allowNull: true, + }, }, { sequelize, diff --git a/src/project/projectResolvers.ts b/src/project/projectResolvers.ts index 34c036a..ab41fa6 100644 --- a/src/project/projectResolvers.ts +++ b/src/project/projectResolvers.ts @@ -380,6 +380,8 @@ const projectResolvers = { parentProjectInfo: { projectId, projectChain }, }: ResolverUnClaimedProjectData) => getLatestMetadataHashOnChain(projectId, projectChain), + lastProcessedIpfsHash: (projectData: ResolverClaimedProjectData) => + projectData.lastProcessedIpfsHash, }, UnClaimedProjectData: { verificationStatus: (projectData: ResolverUnClaimedProjectData) => diff --git a/src/project/projectTypeDef.ts b/src/project/projectTypeDef.ts index 6ed674c..06446c9 100644 --- a/src/project/projectTypeDef.ts +++ b/src/project/projectTypeDef.ts @@ -48,6 +48,7 @@ const projectTypeDef = gql` totalEarned: [Amount!]! withdrawableBalances: [WithdrawableBalance!]! latestMetadataIpfsHash: String! + lastProcessedIpfsHash: String } type UnClaimedProjectData { diff --git a/src/project/projectUtils.ts b/src/project/projectUtils.ts index 2403759..72cd50e 100644 --- a/src/project/projectUtils.ts +++ b/src/project/projectUtils.ts @@ -176,6 +176,7 @@ function mapClaimedProjectChainData( totalEarned: [], // Will be populated by the resolver. withdrawableBalances: [], // Will be populated by the resolver. latestMetadataIpfsHash: '', // Will be populated by the resolver. + lastProcessedIpfsHash: project.lastProcessedIpfsHash, } as ResolverClaimedProjectData; }