patches v1.2.1 #54

Merged
jkeffects merged 7 commits from develop into main 2025-01-27 14:19:55 +00:00
Showing only changes of commit ff651b7d8f - Show all commits

View file

@ -10,6 +10,7 @@ import MailHelper from "../../../helpers/mailHelper";
import { CLUB_NAME } from "../../../env.defaults"; import { CLUB_NAME } from "../../../env.defaults";
import { UpdateUserPermissionsCommand } from "../../../command/user/user/userPermissionCommand"; import { UpdateUserPermissionsCommand } from "../../../command/user/user/userPermissionCommand";
import UserPermissionCommandHandler from "../../../command/user/user/userPermissionCommandHandler"; import UserPermissionCommandHandler from "../../../command/user/user/userPermissionCommandHandler";
import BadRequestException from "../../../exceptions/badRequestException";
/** /**
* @description get All users * @description get All users
@ -137,7 +138,11 @@ export async function updateUserRoles(req: Request, res: Response): Promise<any>
export async function deleteUser(req: Request, res: Response): Promise<any> { export async function deleteUser(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = parseInt(req.params.id);
let user = await UserService.getById(id); let { mail, isOwner } = await UserService.getById(id);
if (isOwner) {
throw new BadRequestException("Owner cannot be deleted");
}
let deleteUser: DeleteUserCommand = { let deleteUser: DeleteUserCommand = {
id: id, id: id,
@ -147,7 +152,7 @@ export async function deleteUser(req: Request, res: Response): Promise<any> {
try { try {
// sendmail // sendmail
await MailHelper.sendMail( await MailHelper.sendMail(
user.mail, mail,
`Email Bestätigung für Mitglieder Admin-Portal von ${CLUB_NAME}`, `Email Bestätigung für Mitglieder Admin-Portal von ${CLUB_NAME}`,
`Ihr Nutzerkonto des Adminportals wurde erfolgreich gelöscht.` `Ihr Nutzerkonto des Adminportals wurde erfolgreich gelöscht.`
); );