type and controller
This commit is contained in:
parent
88212ff79b
commit
d24785cd69
4 changed files with 7 additions and 5 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export interface CommunicationTypeViewModel {
|
export interface CommunicationTypeViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
type: string;
|
type: string;
|
||||||
useColumns: Array<string>;
|
fields: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue