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

Added tributeClaimModuleAddress column to the project #154

Merged
merged 1 commit into from
Dec 19, 2024
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
19 changes: 19 additions & 0 deletions migration/1734598837452-addProjectTributeModuleAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddProjectTributeModuleAddress1734598837452
implements MigrationInterface
{
name = 'AddProjectTributeModuleAddress1734598837452';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" ADD "tributeClaimModuleAddress" character varying`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" DROP COLUMN "tributeClaimModuleAddress"`,
);
}
}
4 changes: 4 additions & 0 deletions src/entities/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
30 changes: 17 additions & 13 deletions src/resolvers/projectResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -328,10 +335,10 @@ function createProjectTestCases() {
SEED_DATA.FOOD_SUB_CATEGORIES[1],
],
description: '<div>Sample Project Creation</div>',
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,
{
Expand All @@ -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,
{
Expand Down Expand Up @@ -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,
{
Expand Down Expand Up @@ -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,
{
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down
28 changes: 28 additions & 0 deletions test/graphqlQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export const createProjectQuery = `
nftContractAddress
chainId
}
tributeClaimModuleAddress
}
}
`;
Expand Down Expand Up @@ -197,6 +198,7 @@ export const updateProjectQuery = `
orchestratorAddress
projectAddress
}
tributeClaimModuleAddress
}
}
`;
Expand Down Expand Up @@ -1001,6 +1003,19 @@ export const fetchProjectBySlugQuery = `
totalReactions
totalDonations
totalTraceDonations
abc {
tokenName
tokenTicker
issuanceTokenAddress
fundingManagerAddress
icon
orchestratorAddress
projectAddress
creatorAddress
nftContractAddress
chainId
}
tributeClaimModuleAddress
}
}
`;
Expand Down Expand Up @@ -1508,6 +1523,19 @@ export const projectByIdQuery = `
id
walletAddress
}
abc {
tokenName
tokenTicker
issuanceTokenAddress
fundingManagerAddress
icon
orchestratorAddress
projectAddress
creatorAddress
nftContractAddress
chainId
}
tributeClaimModuleAddress
}
}
`;
Expand Down
Loading