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> { export async function createQualification(req: Request, res: Response): Promise<any> {
const qualification = req.body.qualification; const qualification = req.body.qualification;
const description = req.body.description;
let createQualification: CreateQualificationCommand = { let createQualification: CreateQualificationCommand = {
qualification: qualification, qualification: qualification,
description: description,
}; };
await QualificationCommandHandler.create(createQualification); 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> { export async function updateQualification(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = parseInt(req.params.id);
const qualification = req.body.qualification; const qualification = req.body.qualification;
const description = req.body.description;
let updateQualification: UpdateQualificationCommand = { let updateQualification: UpdateQualificationCommand = {
id: id, id: id,
qualification: qualification, qualification: qualification,
description: description,
}; };
await QualificationCommandHandler.update(updateQualification); await QualificationCommandHandler.update(updateQualification);

View file

@ -11,7 +11,7 @@ export default abstract class CommunicationTypeFactory {
return { return {
id: record.id, id: record.id,
type: record.type, 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) { export default function errorHandler(err: ExceptionBase | Error, req: Request, res: Response, next: Function) {
let status = 500; let status = 500;
let msg = "Internal Server Error"; let msg = "Internal Server Error";
let insideError = undefined;
if (err instanceof CustomRequestException) { if (err instanceof CustomRequestException) {
status = err.statusCode; status = err.statusCode;
msg = err.message; msg = err.message;
insideError = err.err;
} }
console.log("Handler", err, insideError); console.log("Handler", err);
res.status(status).send(msg); res.status(status).send(msg);
} }

View file

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