made accept host application and reject host application apis
This commit is contained in:
@@ -734,6 +734,39 @@ export class MinglarService {
|
||||
})
|
||||
}
|
||||
|
||||
async rejectHostApplication(host_xid: number, user_xid: number) {
|
||||
await this.prisma.$transaction(async (tx) => {
|
||||
const hostDetails = await tx.hostHeader.findFirst({
|
||||
where: { id: host_xid },
|
||||
select: { id: true, userXid: true }
|
||||
})
|
||||
if (!hostDetails) {
|
||||
throw new Error("Host not found");
|
||||
}
|
||||
await tx.hostHeader.update({
|
||||
where: {
|
||||
id: host_xid,
|
||||
hostStatusInternal: HOST_STATUS_INTERNAL.HOST_SUBMITTED,
|
||||
hostStatusDisplay: HOST_STATUS_DISPLAY.UNDER_REVIEW
|
||||
},
|
||||
data: {
|
||||
hostStatusInternal: HOST_STATUS_INTERNAL.REJECTED,
|
||||
hostStatusDisplay: HOST_STATUS_DISPLAY.REJECTED,
|
||||
adminStatusInternal: MINGLAR_STATUS_INTERNAL.ADMIN_REJECTED,
|
||||
adminStatusDisplay: MINGLAR_STATUS_DISPLAY.REJECTED,
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
await tx.user.update({
|
||||
where: { id: hostDetails.userXid },
|
||||
data: {
|
||||
userStatus: USER_STATUS.REJECTED
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user