mirror of
https://github.com/detleph/server.git
synced 2026-09-05 16:06:21 +02:00
added function to delete unverified teams
This commit is contained in:
@@ -150,6 +150,14 @@ export const deleteTeam = async (req: Request, res: Response) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const deleteUnverifiedTeams =async (req: Request, res: Response) => {
|
||||
const { pid } = req.params;
|
||||
|
||||
await _deleteUnverifiedTeams(pid);
|
||||
|
||||
res.status(204).end();
|
||||
}
|
||||
|
||||
export async function checkTeamExistence(teamPid: string) {
|
||||
const teamCount = await prisma.team.count({
|
||||
where: { pid: teamPid },
|
||||
@@ -173,3 +181,14 @@ export async function getGroupsByTeamPid(teamPid: string) {
|
||||
|
||||
return groups;
|
||||
};
|
||||
|
||||
export async function _deleteUnverifiedTeams(eventPid: string) {
|
||||
await prisma.team.deleteMany({
|
||||
where: {
|
||||
AND: [{discipline: {event: {pid: eventPid}}},
|
||||
{verified: {equals: false}}
|
||||
]
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user