Skip to content

Commit

Permalink
Merge pull request #1920 from Giveth/fix/adminjs_deverification
Browse files Browse the repository at this point in the history
Fix/Vouche/DeVauche project(s)
  • Loading branch information
kkatusic authored Jan 29, 2025
2 parents ad5949d + df68d26 commit 5b19b8b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/server/adminJs/tabs/projectsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,20 @@ export const verifyProjects = async (

const updateParams = { verified: vouchedStatus };

const projects = await Project.createQueryBuilder('project')
// Perform the update
await Project.createQueryBuilder('project')
.update<Project>(Project, updateParams)
.where('project.id IN (:...ids)')
.setParameter('ids', projectIds)
.returning('*')
.updateEntity(true)
.execute();

for (const project of projects.raw) {
// Fetch the updated projects with adminUser included
const projects = await Project.createQueryBuilder('project')
.leftJoinAndSelect('project.adminUser', 'adminUser')
.where('project.id IN (:...ids)', { ids: projectIds })
.getMany();

for (const project of projects) {
if (
projectsBeforeUpdating.find(p => p.id === project.id)?.verified ===
vouchedStatus
Expand All @@ -284,6 +289,7 @@ export const verifyProjects = async (
// if project.verified have not changed, so we should not execute rest of the codes
continue;
}

await Project.addProjectStatusHistoryRecord({
project,
status: project.status,
Expand Down

0 comments on commit 5b19b8b

Please sign in to comment.