diff --git a/migration/1734598837452-addProjectTributeModuleAddress.ts b/migration/1734598837452-addProjectTributeModuleAddress.ts new file mode 100644 index 000000000..119055f98 --- /dev/null +++ b/migration/1734598837452-addProjectTributeModuleAddress.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AddProjectTributeModuleAddress1734598837452 + implements MigrationInterface +{ + name = 'AddProjectTributeModuleAddress1734598837452'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "project" ADD "tributeClaimModuleAddress" character varying`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "project" DROP COLUMN "tributeClaimModuleAddress"`, + ); + } +} diff --git a/src/entities/project.ts b/src/entities/project.ts index eb685dc7b..6445f5732 100644 --- a/src/entities/project.ts +++ b/src/entities/project.ts @@ -259,6 +259,10 @@ export class Project extends BaseEntity { @Column('jsonb', { nullable: true }) abc: Abc; + @Field({ nullable: true }) + @Column({ nullable: true }) + tributeClaimModuleAddress: string; + @Index('trgm_idx_project_impact_location', { synchronize: false }) @Field({ nullable: true }) @Column({ nullable: true }) diff --git a/src/resolvers/projectResolver.test.ts b/src/resolvers/projectResolver.test.ts index 7654e8ffb..162408c1f 100644 --- a/src/resolvers/projectResolver.test.ts +++ b/src/resolvers/projectResolver.test.ts @@ -73,6 +73,13 @@ function createProjectTestCases() { accessToken = await generateTestAccessToken(user.id); }); + afterEach(async () => { + const project = await Project.findOneBy({ adminUserId: user.id }); + if (project) { + await deleteProjectDirectlyFromDb(project.id); + } + }); + it('should create project with team members successfully', async () => { assert.isOk(user); assert.isOk(accessToken); @@ -328,10 +335,10 @@ function createProjectTestCases() { SEED_DATA.FOOD_SUB_CATEGORIES[1], ], description: '
Sample Project Creation
', - adminUserId: SEED_DATA.FIRST_USER.id, + adminUserId: user.id, address: generateRandomEtheriumAddress(), }; - const accessToken = await generateTestAccessToken(SEED_DATA.FIRST_USER.id); + const accessToken = await generateTestAccessToken(user.id); const result = await axios.post( graphqlUrl, { @@ -357,10 +364,10 @@ function createProjectTestCases() { title: String(new Date().getTime()), categories: [SEED_DATA.FOOD_SUB_CATEGORIES[0]], description: 'description', - adminUserId: SEED_DATA.FIRST_USER.id, + adminUserId: user.id, address: generateRandomEtheriumAddress(), }; - const accessToken = await generateTestAccessToken(SEED_DATA.FIRST_USER.id); + const accessToken = await generateTestAccessToken(user.id); const addProjectResponse = await axios.post( graphqlUrl, { @@ -390,10 +397,10 @@ function createProjectTestCases() { description: 'a'.repeat(PROJECT_DESCRIPTION_MAX_LENGTH + 1), image: 'https://gateway.pinata.cloud/ipfs/QmauSzWacQJ9rPkPJgr3J3pdgfNRGAaDCr1yAToVWev2QS', - adminUserId: SEED_DATA.FIRST_USER.id, + adminUserId: user.id, address: generateRandomEtheriumAddress(), }; - const accessToken = await generateTestAccessToken(SEED_DATA.FIRST_USER.id); + const accessToken = await generateTestAccessToken(user.id); let result = await axios.post( graphqlUrl, { @@ -443,10 +450,10 @@ function createProjectTestCases() { description: 'description', image: 'https://gateway.pinata.cloud/ipfs/QmauSzWacQJ9rPkPJgr3J3pdgfNRGAaDCr1yAToVWev2QS', - adminUserId: SEED_DATA.FIRST_USER.id, + adminUserId: user.id, address: generateRandomEtheriumAddress(), }; - const accessToken = await generateTestAccessToken(SEED_DATA.FIRST_USER.id); + const accessToken = await generateTestAccessToken(user.id); const result = await axios.post( graphqlUrl, { @@ -476,10 +483,7 @@ function createProjectTestCases() { ReviewStatus.Listed, ); - assert.equal( - result.data.data.createProject.adminUser.id, - SEED_DATA.FIRST_USER.id, - ); + assert.equal(result.data.data.createProject.adminUser.id, user.id); assert.equal(result.data.data.createProject.verified, false); assert.equal( result.data.data.createProject.status.id, @@ -492,7 +496,7 @@ function createProjectTestCases() { assert.equal( result.data.data.createProject.adminUser.walletAddress, - SEED_DATA.FIRST_USER.walletAddress, + user.walletAddress, ); assert.equal(result.data.data.createProject.image, sampleProject.image); assert.equal( diff --git a/test/graphqlQueries.ts b/test/graphqlQueries.ts index 615de4b75..9efd5dec9 100644 --- a/test/graphqlQueries.ts +++ b/test/graphqlQueries.ts @@ -143,6 +143,7 @@ export const createProjectQuery = ` nftContractAddress chainId } + tributeClaimModuleAddress } } `; @@ -197,6 +198,7 @@ export const updateProjectQuery = ` orchestratorAddress projectAddress } + tributeClaimModuleAddress } } `; @@ -1001,6 +1003,19 @@ export const fetchProjectBySlugQuery = ` totalReactions totalDonations totalTraceDonations + abc { + tokenName + tokenTicker + issuanceTokenAddress + fundingManagerAddress + icon + orchestratorAddress + projectAddress + creatorAddress + nftContractAddress + chainId + } + tributeClaimModuleAddress } } `; @@ -1508,6 +1523,19 @@ export const projectByIdQuery = ` id walletAddress } + abc { + tokenName + tokenTicker + issuanceTokenAddress + fundingManagerAddress + icon + orchestratorAddress + projectAddress + creatorAddress + nftContractAddress + chainId + } + tributeClaimModuleAddress } } `;