Skip to content

Commit

Permalink
delete previous_round_rank when deleting a project (#1809)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Sep 11, 2024
1 parent 751308d commit bebce89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/repositories/projectRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }),
Expand Down
6 changes: 6 additions & 0 deletions src/repositories/projectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Project | null> => {
// return Project.findOne({ id: projectId });
Expand Down Expand Up @@ -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 })
Expand Down
2 changes: 2 additions & 0 deletions src/resolvers/projectResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bebce89

Please sign in to comment.