Ag Grid anpassungen

This commit is contained in:
Bastian Wagner
2026-02-19 12:21:30 +01:00
parent d7cfc89ba5
commit ef45e91141
31 changed files with 469 additions and 75 deletions

View File

@@ -3,7 +3,7 @@ import { Injectable } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { EmailEvent, LogService, LogType } from "../log/log.service";
import { KeySystem } from "src/model/entitites/system.entity";
import { User } from "src/model/entitites";
import { Key, KeyHandout, User } from "src/model/entitites";
@Injectable()
export class MailService {
@@ -14,6 +14,46 @@ export class MailService {
) {
}
async sendKeyHandoutMail({to, key, handoutAction}: {to: User, key: Key, handoutAction: KeyHandout}) {
const keyAction = handoutAction.direction == 'out' ? 'wurde ausgegeben' : 'wurde zurückgegeben';
const keyExtendedAction = handoutAction.direction == 'return' ? `wurde von ${handoutAction.customer.name} zurückgegeben` : `wurde an ${handoutAction.customer.name} ausgegeben`;
const subject = handoutAction.direction == 'out' ? 'Schlüssel ausgegeben' : 'Schlüssel zurückgegeben';
const context = {
keyAction,
keyExtendedAction,
firstName: to.firstName,
keyNr: key.nr,
keyName: key.name,
url: 'https://keyvaultpro.de/keys?nr=' + key.nr
}
this.mailserService.sendMail({
template: './key-handout-changed',
to: to.username,
from: this.configService.get<string>('MAILER_FROM'),
subject: subject,
context
}).then(v => {
this.logService.log(LogType.Mail, {
to: to.username,
success: true,
message: v.response,
type: EmailEvent.KeyHandout,
system: key.cylinder[0].system,
context: JSON.stringify(handoutAction)
})
}).catch(e => {
this.logService.log(LogType.Mail, {
to,
success: false,
message: e.response,
type: EmailEvent.KeyHandout,
system: key.cylinder[0].system,
context: JSON.stringify(handoutAction)
})
})
}
async sendAccessGrantedMail({to, system}: {to: User, system: KeySystem}) {
this.mailserService.sendMail({
template: './access',