self defined value tables - commands
This commit is contained in:
parent
b19cd97a01
commit
4048c21c1f
16 changed files with 526 additions and 2 deletions
12
src/command/awardCommand.ts
Normal file
12
src/command/awardCommand.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface CreateAwardCommand {
|
||||
award: string;
|
||||
}
|
||||
|
||||
export interface UpdateAwardCommand {
|
||||
id: number;
|
||||
award: string;
|
||||
}
|
||||
|
||||
export interface DeleteAwardCommand {
|
||||
id: number;
|
||||
}
|
66
src/command/awardCommandHandler.ts
Normal file
66
src/command/awardCommandHandler.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { award } from "../entity/award";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
|
||||
|
||||
export default abstract class AwardCommandHandler {
|
||||
/**
|
||||
* @description create award
|
||||
* @param CreateAwardCommand
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createAward: CreateAwardCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(award)
|
||||
.values({
|
||||
award: createAward.award,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating award");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update award
|
||||
* @param UpdateAwardCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateAward: UpdateAwardCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(award)
|
||||
.set({
|
||||
award: updateAward.award,
|
||||
})
|
||||
.where("id = :id", { id: updateAward.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating award");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete award
|
||||
* @param DeleteAwardCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deletAward: DeleteAwardCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(award)
|
||||
.where("id = :id", { id: deletAward.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting award");
|
||||
});
|
||||
}
|
||||
}
|
14
src/command/communicationTypeCommand.ts
Normal file
14
src/command/communicationTypeCommand.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
export interface CreateCommunicationTypeCommand {
|
||||
type: string;
|
||||
useColumns: Array<string>;
|
||||
}
|
||||
|
||||
export interface UpdateCommunicationTypeCommand {
|
||||
id: number;
|
||||
type: string;
|
||||
useColumns: Array<string>;
|
||||
}
|
||||
|
||||
export interface DeleteCommunicationTypeCommand {
|
||||
id: number;
|
||||
}
|
72
src/command/communicationTypeCommandHandler.ts
Normal file
72
src/command/communicationTypeCommandHandler.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { communicationType } from "../entity/communicationType";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import {
|
||||
CreateCommunicationTypeCommand,
|
||||
DeleteCommunicationTypeCommand,
|
||||
UpdateCommunicationTypeCommand,
|
||||
} from "./communicationTypeCommand";
|
||||
|
||||
export default abstract class CommunicationTypeCommandHandler {
|
||||
/**
|
||||
* @description create communicationType
|
||||
* @param CreateCommunicationTypeCommand
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createCommunicationType: CreateCommunicationTypeCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(communicationType)
|
||||
.values({
|
||||
type: createCommunicationType.type,
|
||||
useColumns: createCommunicationType.useColumns,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating communicationType");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update communicationType
|
||||
* @param UpdateCommunicationTypeCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateCommunicationType: UpdateCommunicationTypeCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(communicationType)
|
||||
.set({
|
||||
type: updateCommunicationType.type,
|
||||
useColumns: updateCommunicationType.useColumns,
|
||||
})
|
||||
.where("id = :id", { id: updateCommunicationType.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating communicationType");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete communicationType
|
||||
* @param DeleteCommunicationTypeCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deletCommunicationType: DeleteCommunicationTypeCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(communicationType)
|
||||
.where("id = :id", { id: deletCommunicationType.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting communicationType");
|
||||
});
|
||||
}
|
||||
}
|
12
src/command/executivePositionCommand.ts
Normal file
12
src/command/executivePositionCommand.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface CreateExecutivePositionCommand {
|
||||
position: string;
|
||||
}
|
||||
|
||||
export interface UpdateExecutivePositionCommand {
|
||||
id: number;
|
||||
position: string;
|
||||
}
|
||||
|
||||
export interface DeleteExecutivePositionCommand {
|
||||
id: number;
|
||||
}
|
70
src/command/executivePositionCommandHandler.ts
Normal file
70
src/command/executivePositionCommandHandler.ts
Normal file
|
@ -0,0 +1,70 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { executivePosition } from "../entity/executivePosition";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import {
|
||||
CreateExecutivePositionCommand,
|
||||
DeleteExecutivePositionCommand,
|
||||
UpdateExecutivePositionCommand,
|
||||
} from "./executivePositionCommand";
|
||||
|
||||
export default abstract class ExecutivePositionCommandHandler {
|
||||
/**
|
||||
* @description create executivePosition
|
||||
* @param CreateExecutivePositionCommand
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createExecutivePosition: CreateExecutivePositionCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(executivePosition)
|
||||
.values({
|
||||
position: createExecutivePosition.position,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating executivePosition");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update executivePosition
|
||||
* @param UpdateExecutivePositionCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateExecutivePosition: UpdateExecutivePositionCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(executivePosition)
|
||||
.set({
|
||||
positon: updateExecutivePosition.position,
|
||||
})
|
||||
.where("id = :id", { id: updateExecutivePosition.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating executivePosition");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete executivePosition
|
||||
* @param DeleteExecutivePositionCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deletExecutivePosition: DeleteExecutivePositionCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(executivePosition)
|
||||
.where("id = :id", { id: deletExecutivePosition.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting executivePosition");
|
||||
});
|
||||
}
|
||||
}
|
12
src/command/membershipStatusCommand.ts
Normal file
12
src/command/membershipStatusCommand.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface CreateMembershipStatusCommand {
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface UpdateMembershipStatusCommand {
|
||||
id: number;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface DeleteMembershipStatusCommand {
|
||||
id: number;
|
||||
}
|
70
src/command/membershipStatusCommandHandler.ts
Normal file
70
src/command/membershipStatusCommandHandler.ts
Normal file
|
@ -0,0 +1,70 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { membershipStatus } from "../entity/membershipStatus";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import {
|
||||
CreateMembershipStatusCommand,
|
||||
DeleteMembershipStatusCommand,
|
||||
UpdateMembershipStatusCommand,
|
||||
} from "./membershipStatusCommand";
|
||||
|
||||
export default abstract class MembershipStatusCommandHandler {
|
||||
/**
|
||||
* @description create membershipStatus
|
||||
* @param CreateMembershipStatusCommand
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createMembershipStatus: CreateMembershipStatusCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(membershipStatus)
|
||||
.values({
|
||||
status: createMembershipStatus.status,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating membershipStatus");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update membershipStatus
|
||||
* @param UpdateMembershipStatusCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateMembershipStatus: UpdateMembershipStatusCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(membershipStatus)
|
||||
.set({
|
||||
status: updateMembershipStatus.status,
|
||||
})
|
||||
.where("id = :id", { id: updateMembershipStatus.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating membershipStatus");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete membershipStatus
|
||||
* @param DeleteMembershipStatusCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deletMembershipStatus: DeleteMembershipStatusCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(membershipStatus)
|
||||
.where("id = :id", { id: deletMembershipStatus.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting membershipStatus");
|
||||
});
|
||||
}
|
||||
}
|
14
src/command/qualificationCommand.ts
Normal file
14
src/command/qualificationCommand.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
export interface CreateQualificationCommand {
|
||||
qualification: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface UpdateQualificationCommand {
|
||||
id: number;
|
||||
qualification: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface DeleteQualificationCommand {
|
||||
id: number;
|
||||
}
|
72
src/command/qualificationCommandHandler.ts
Normal file
72
src/command/qualificationCommandHandler.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { qualification } from "../entity/qualification";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import {
|
||||
CreateQualificationCommand,
|
||||
DeleteQualificationCommand,
|
||||
UpdateQualificationCommand,
|
||||
} from "./qualificationCommand";
|
||||
|
||||
export default abstract class QualificationCommandHandler {
|
||||
/**
|
||||
* @description create qualification
|
||||
* @param CreateQualificationCommand
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createQualification: CreateQualificationCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(qualification)
|
||||
.values({
|
||||
qualification: createQualification.qualification,
|
||||
description: createQualification.description,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating qualification");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update qualification
|
||||
* @param UpdateQualificationCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateQualification: UpdateQualificationCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(qualification)
|
||||
.set({
|
||||
qualification: updateQualification.qualification,
|
||||
description: updateQualification.description,
|
||||
})
|
||||
.where("id = :id", { id: updateQualification.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating qualification");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete qualification
|
||||
* @param DeleteQualificationCommand
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deletQualification: DeleteQualificationCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(qualification)
|
||||
.where("id = :id", { id: deletQualification.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting qualification");
|
||||
});
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ export default abstract class RoleCommandHandler {
|
|||
.set({
|
||||
role: updateRole.role,
|
||||
})
|
||||
.where("role.id = :id", { id: updateRole.id })
|
||||
.where("id = :id", { id: updateRole.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
|
@ -56,7 +56,7 @@ export default abstract class RoleCommandHandler {
|
|||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(role)
|
||||
.where("role.id = :id", { id: deleteRole.id })
|
||||
.where("id = :id", { id: deleteRole.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { Request, Response } from "express";
|
||||
import AwardService from "../../service/awardService";
|
||||
import AwardFactory from "../../factory/admin/award";
|
||||
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "../../command/awardCommand";
|
||||
import AwardCommandHandler from "../../command/awardCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all awards
|
||||
|
@ -48,6 +50,11 @@ export async function getAwardAssignedMembers(req: Request, res: Response): Prom
|
|||
export async function createAward(req: Request, res: Response): Promise<any> {
|
||||
const award = req.body.award;
|
||||
|
||||
let createAward: CreateAwardCommand = {
|
||||
award: award,
|
||||
};
|
||||
await AwardCommandHandler.create(createAward);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -61,6 +68,12 @@ export async function updateAward(req: Request, res: Response): Promise<any> {
|
|||
const id = parseInt(req.params.id);
|
||||
const award = req.body.award;
|
||||
|
||||
let updateAward: UpdateAwardCommand = {
|
||||
id: id,
|
||||
award: award,
|
||||
};
|
||||
await AwardCommandHandler.update(updateAward);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -73,5 +86,10 @@ export async function updateAward(req: Request, res: Response): Promise<any> {
|
|||
export async function deleteAward(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteAward: DeleteAwardCommand = {
|
||||
id: id,
|
||||
};
|
||||
await AwardCommandHandler.delete(deleteAward);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@ import { Request, Response } from "express";
|
|||
import CommunicationTypeService from "../../service/communicationTypeService";
|
||||
import CommunicationTypeFactory from "../../factory/admin/communicationType";
|
||||
import CommunicationService from "../../service/communicationService";
|
||||
import {
|
||||
CreateCommunicationTypeCommand,
|
||||
DeleteCommunicationTypeCommand,
|
||||
UpdateCommunicationTypeCommand,
|
||||
} from "../../command/communicationTypeCommand";
|
||||
import CommunicationTypeCommandHandler from "../../command/communicationTypeCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all communicationTypes
|
||||
|
@ -47,6 +53,13 @@ export async function getCommunicationTypeAvailableColumns(req: Request, res: Re
|
|||
*/
|
||||
export async function createCommunicationType(req: Request, res: Response): Promise<any> {
|
||||
const communicationType = req.body.communicationType;
|
||||
const useColumns = req.body.fields;
|
||||
|
||||
let createCommunicationType: CreateCommunicationTypeCommand = {
|
||||
type: communicationType,
|
||||
useColumns: useColumns,
|
||||
};
|
||||
await CommunicationTypeCommandHandler.create(createCommunicationType);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
@ -60,6 +73,14 @@ export async function createCommunicationType(req: Request, res: Response): Prom
|
|||
export async function updateCommunicationType(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const communicationType = req.body.communicationType;
|
||||
const useColumns = req.body.fields;
|
||||
|
||||
let updateCommunicationType: UpdateCommunicationTypeCommand = {
|
||||
id: id,
|
||||
type: communicationType,
|
||||
useColumns: useColumns,
|
||||
};
|
||||
await CommunicationTypeCommandHandler.update(updateCommunicationType);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
@ -73,5 +94,10 @@ export async function updateCommunicationType(req: Request, res: Response): Prom
|
|||
export async function deleteCommunicationType(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteCommunicationType: DeleteCommunicationTypeCommand = {
|
||||
id: id,
|
||||
};
|
||||
await CommunicationTypeCommandHandler.delete(deleteCommunicationType);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import ExecutivePositionService from "../../service/executivePositionService";
|
||||
import ExecutivePositionFactory from "../../factory/admin/executivePosition";
|
||||
import {
|
||||
CreateExecutivePositionCommand,
|
||||
DeleteExecutivePositionCommand,
|
||||
UpdateExecutivePositionCommand,
|
||||
} from "../../command/executivePositionCommand";
|
||||
import ExecutivePositionCommandHandler from "../../command/executivePositionCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all executivePositions
|
||||
|
@ -48,6 +54,11 @@ export async function getExecutivePositionAssignedMembers(req: Request, res: Res
|
|||
export async function createExecutivePosition(req: Request, res: Response): Promise<any> {
|
||||
const executivePosition = req.body.executivePosition;
|
||||
|
||||
let createExecutivePosition: CreateExecutivePositionCommand = {
|
||||
position: executivePosition,
|
||||
};
|
||||
await ExecutivePositionCommandHandler.create(createExecutivePosition);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -61,6 +72,12 @@ export async function updateExecutivePosition(req: Request, res: Response): Prom
|
|||
const id = parseInt(req.params.id);
|
||||
const executivePosition = req.body.executivePosition;
|
||||
|
||||
let updateExecutivePosition: UpdateExecutivePositionCommand = {
|
||||
id: id,
|
||||
position: executivePosition,
|
||||
};
|
||||
await ExecutivePositionCommandHandler.update(updateExecutivePosition);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -73,5 +90,10 @@ export async function updateExecutivePosition(req: Request, res: Response): Prom
|
|||
export async function deleteExecutivePosition(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteExecutivePosition: DeleteExecutivePositionCommand = {
|
||||
id: id,
|
||||
};
|
||||
await ExecutivePositionCommandHandler.delete(deleteExecutivePosition);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import MembershipStatusService from "../../service/membershipStatusService";
|
||||
import MembershipStatusFactory from "../../factory/admin/membershipStatus";
|
||||
import {
|
||||
CreateMembershipStatusCommand,
|
||||
DeleteMembershipStatusCommand,
|
||||
UpdateMembershipStatusCommand,
|
||||
} from "../../command/membershipStatusCommand";
|
||||
import MembershipStatusCommandHandler from "../../command/membershipStatusCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all membershipStatus
|
||||
|
@ -48,6 +54,11 @@ export async function getMembershipStatusAssignedMembers(req: Request, res: Resp
|
|||
export async function createMembershipStatus(req: Request, res: Response): Promise<any> {
|
||||
const membershipStatus = req.body.membershipStatus;
|
||||
|
||||
let createMembershipStatus: CreateMembershipStatusCommand = {
|
||||
status: membershipStatus,
|
||||
};
|
||||
await MembershipStatusCommandHandler.create(createMembershipStatus);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -61,6 +72,12 @@ export async function updateMembershipStatus(req: Request, res: Response): Promi
|
|||
const id = parseInt(req.params.id);
|
||||
const membershipStatus = req.body.membershipStatus;
|
||||
|
||||
let updateMembershipStatus: UpdateMembershipStatusCommand = {
|
||||
id: id,
|
||||
status: membershipStatus,
|
||||
};
|
||||
await MembershipStatusCommandHandler.update(updateMembershipStatus);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -73,5 +90,10 @@ export async function updateMembershipStatus(req: Request, res: Response): Promi
|
|||
export async function deleteMembershipStatus(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteMembershipStatus: DeleteMembershipStatusCommand = {
|
||||
id: id,
|
||||
};
|
||||
await MembershipStatusCommandHandler.delete(deleteMembershipStatus);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import QualificationService from "../../service/qualification";
|
||||
import QualificationFactory from "../../factory/admin/qualification";
|
||||
import {
|
||||
CreateQualificationCommand,
|
||||
DeleteQualificationCommand,
|
||||
UpdateQualificationCommand,
|
||||
} from "../../command/qualificationCommand";
|
||||
import QualificationCommandHandler from "../../command/qualificationCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all qualifications
|
||||
|
@ -48,6 +54,11 @@ export async function getQualificationAssignedMembers(req: Request, res: Respons
|
|||
export async function createQualification(req: Request, res: Response): Promise<any> {
|
||||
const qualification = req.body.qualification;
|
||||
|
||||
let createQualification: CreateQualificationCommand = {
|
||||
qualification: qualification,
|
||||
};
|
||||
await QualificationCommandHandler.create(createQualification);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -61,6 +72,12 @@ export async function updateQualification(req: Request, res: Response): Promise<
|
|||
const id = parseInt(req.params.id);
|
||||
const qualification = req.body.qualification;
|
||||
|
||||
let updateQualification: UpdateQualificationCommand = {
|
||||
id: id,
|
||||
qualification: qualification,
|
||||
};
|
||||
await QualificationCommandHandler.update(updateQualification);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -73,5 +90,10 @@ export async function updateQualification(req: Request, res: Response): Promise<
|
|||
export async function deleteQualification(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteQualification: DeleteQualificationCommand = {
|
||||
id: id,
|
||||
};
|
||||
await QualificationCommandHandler.delete(deleteQualification);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue