invite management

This commit is contained in:
Julian Krauser 2024-11-24 12:36:12 +01:00
parent d1cf9f4c66
commit c66c847ec1
6 changed files with 87 additions and 20 deletions

View file

@ -37,7 +37,7 @@ export default abstract class InviteCommandHandler {
/**
* @description delete invite by mail and token
* @param DeleteRefreshCommand
* @param DeleteInviteCommand
* @returns {Promise<any>}
*/
static async deleteByTokenAndMail(deleteInvite: DeleteInviteCommand): Promise<any> {
@ -53,4 +53,22 @@ export default abstract class InviteCommandHandler {
throw new InternalException("failed invite removal", err);
});
}
/**
* @description delete invite by mail
* @param DeleteByMailInviteCommand
* @returns {Promise<any>}
*/
static async deleteByMail(mail: string): Promise<any> {
return await dataSource
.createQueryBuilder()
.delete()
.from(invite)
.where("invite.mail = :mail", { mail })
.execute()
.then((res) => {})
.catch((err) => {
throw new InternalException("failed invite removal", err);
});
}
}