From bebce89d7125eabbe0cdb11aafb00a4e477ce7b4 Mon Sep 17 00:00:00 2001 From: mohammadranjbarz Date: Wed, 11 Sep 2024 14:33:50 +0300 Subject: [PATCH] delete previous_round_rank when deleting a project (#1809) --- src/repositories/projectRepository.test.ts | 1 - src/repositories/projectRepository.ts | 6 ++++++ src/resolvers/projectResolver.ts | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/repositories/projectRepository.test.ts b/src/repositories/projectRepository.test.ts index 6af02d8ea..7ca545787 100644 --- a/src/repositories/projectRepository.test.ts +++ b/src/repositories/projectRepository.test.ts @@ -558,7 +558,6 @@ function removeProjectAndRelatedEntitiesTestCase() { FeaturedUpdate.create({ projectId: project.id }).save(), SocialProfile.create({ projectId: project.id }).save(), ]); - const relatedEntitiesBefore = await Promise.all([ Donation.findOne({ where: { projectId: project.id } }), Reaction.findOne({ where: { projectId: project.id } }), diff --git a/src/repositories/projectRepository.ts b/src/repositories/projectRepository.ts index b314051ef..013d3d0e9 100644 --- a/src/repositories/projectRepository.ts +++ b/src/repositories/projectRepository.ts @@ -22,6 +22,7 @@ import { ProjectSocialMedia } from '../entities/projectSocialMedia'; import { ProjectStatusHistory } from '../entities/projectStatusHistory'; import { Reaction } from '../entities/reaction'; import { SocialProfile } from '../entities/socialProfile'; +import { PreviousRoundRank } from '../entities/previousRoundRank'; export const findProjectById = (projectId: number): Promise => { // return Project.findOne({ id: projectId }); @@ -600,6 +601,11 @@ export const removeProjectAndRelatedEntities = async ( .where('projectId = :projectId', { projectId }) .execute(); + await PreviousRoundRank.createQueryBuilder() + .delete() + .where('projectId = :projectId', { projectId }) + .execute(); + await Project.createQueryBuilder() .delete() .where('id = :id', { id: projectId }) diff --git a/src/resolvers/projectResolver.ts b/src/resolvers/projectResolver.ts index 482220e0d..86bfdcb6d 100644 --- a/src/resolvers/projectResolver.ts +++ b/src/resolvers/projectResolver.ts @@ -1788,6 +1788,8 @@ export class ProjectResolver { /** * Can a project use this wallet? * @param address wallet address + * @param chainType chain ChainType + * @param memo wallet address * @returns */ @Query(_returns => Boolean)