diff --git a/src/entities/projectQfRound.ts b/src/entities/projectQfRound.ts index 55d2a4593..34ce97673 100644 --- a/src/entities/projectQfRound.ts +++ b/src/entities/projectQfRound.ts @@ -1,13 +1,13 @@ import { Field, ID, ObjectType, Float, Int } from 'type-graphql'; import { - PrimaryColumn, + PrimaryGeneratedColumn, Column, Entity, ManyToOne, BaseEntity, CreateDateColumn, UpdateDateColumn, - Index, + PrimaryColumn, } from 'typeorm'; import { Project } from './project'; import { QfRound } from './qfRound'; @@ -16,8 +16,7 @@ import { QfRound } from './qfRound'; @ObjectType() export class ProjectQfRound extends BaseEntity { @Field(_type => ID) - @Column({ generated: 'increment' }) - @Index() + @PrimaryGeneratedColumn() id: number; @Field(_type => ID) diff --git a/src/repositories/projectRepository.test.ts b/src/repositories/projectRepository.test.ts index aba5f10d7..c20670cb3 100644 --- a/src/repositories/projectRepository.test.ts +++ b/src/repositories/projectRepository.test.ts @@ -1169,21 +1169,25 @@ function findQfRoundProjectsTestCases() { await project2.save(); // Create ProjectQfRound entries with different donation amounts - const projectQfRound1 = ProjectQfRound.create({ - projectId: project1.id, - qfRoundId: qfRound.id, - sumDonationValueUsd: 100, - countUniqueDonors: 5, - }); - await projectQfRound1.save(); + await ProjectQfRound.upsert( + { + projectId: project1.id, + qfRoundId: qfRound.id, + sumDonationValueUsd: 100, + countUniqueDonors: 5, + }, + ['projectId', 'qfRoundId'], + ); - const projectQfRound2 = ProjectQfRound.create({ - projectId: project2.id, - qfRoundId: qfRound.id, - sumDonationValueUsd: 500, - countUniqueDonors: 10, - }); - await projectQfRound2.save(); + await ProjectQfRound.upsert( + { + projectId: project2.id, + qfRoundId: qfRound.id, + sumDonationValueUsd: 500, + countUniqueDonors: 10, + }, + ['projectId', 'qfRoundId'], + ); // Test sorting by ActiveQfRoundRaisedFunds const [sortedProjects] = await findQfRoundProjects(qfRound.id, {