type and controller

This commit is contained in:
Julian Krauser 2024-09-09 13:14:24 +02:00
parent 88212ff79b
commit d24785cd69
4 changed files with 7 additions and 5 deletions

View file

@ -53,9 +53,11 @@ export async function getQualificationAssignedMembers(req: Request, res: Respons
*/
export async function createQualification(req: Request, res: Response): Promise<any> {
const qualification = req.body.qualification;
const description = req.body.description;
let createQualification: CreateQualificationCommand = {
qualification: qualification,
description: description,
};
await QualificationCommandHandler.create(createQualification);
@ -71,10 +73,12 @@ export async function createQualification(req: Request, res: Response): Promise<
export async function updateQualification(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id);
const qualification = req.body.qualification;
const description = req.body.description;
let updateQualification: UpdateQualificationCommand = {
id: id,
qualification: qualification,
description: description,
};
await QualificationCommandHandler.update(updateQualification);

View file

@ -11,7 +11,7 @@ export default abstract class CommunicationTypeFactory {
return {
id: record.id,
type: record.type,
useColumns: record.useColumns,
fields: record.useColumns,
};
}

View file

@ -5,15 +5,13 @@ import CustomRequestException from "../exceptions/customRequestException";
export default function errorHandler(err: ExceptionBase | Error, req: Request, res: Response, next: Function) {
let status = 500;
let msg = "Internal Server Error";
let insideError = undefined;
if (err instanceof CustomRequestException) {
status = err.statusCode;
msg = err.message;
insideError = err.err;
}
console.log("Handler", err, insideError);
console.log("Handler", err);
res.status(status).send(msg);
}

View file

@ -1,5 +1,5 @@
export interface CommunicationTypeViewModel {
id: number;
type: string;
useColumns: Array<string>;
fields: Array<string>;
}