Merge branch 'milestone/ff-admin-unit' into unit/#102-base-management
# Conflicts: # src/data-source.ts
This commit is contained in:
commit
e056db053b
68 changed files with 1807 additions and 1521 deletions
|
@ -49,6 +49,14 @@ import {
|
|||
import CommunicationCommandHandler from "../../../command/club/member/communicationCommandHandler";
|
||||
import { PdfExport } from "../../../helpers/pdfExport";
|
||||
import { PermissionModule } from "../../../type/permissionTypes";
|
||||
import MemberEducationFactory from "../../../factory/admin/club/member/memberEducation";
|
||||
import MemberEducationService from "../../../service/club/member/memberEducationService";
|
||||
import {
|
||||
CreateMemberEducationCommand,
|
||||
DeleteMemberEducationCommand,
|
||||
UpdateMemberEducationCommand,
|
||||
} from "../../../command/club/member/memberEducationCommand";
|
||||
import MemberEducationCommandHandler from "../../../command/club/member/memberEducationCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all members
|
||||
|
@ -144,6 +152,7 @@ export async function getMemberPrintoutById(req: Request, res: Response): Promis
|
|||
let qualifications = await MemberQualificationService.getAll(memberId);
|
||||
let positions = await MemberExecutivePositionService.getAll(memberId);
|
||||
let communications = await CommunicationService.getAll(memberId);
|
||||
let educations = await MemberEducationService.getAll(memberId);
|
||||
|
||||
let pdf = await PdfExport.renderFile({
|
||||
title: "Mitglieder-Ausdruck",
|
||||
|
@ -157,6 +166,7 @@ export async function getMemberPrintoutById(req: Request, res: Response): Promis
|
|||
qualifications,
|
||||
positions,
|
||||
communications,
|
||||
educations,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -195,6 +205,19 @@ export async function getMembershipStatisticsById(req: Request, res: Response):
|
|||
res.json(MembershipFactory.mapToBaseStatistics(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get member total statistics by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMembershipTotalStatisticsById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
let member = await MembershipService.getTotalStatisticsById(memberId);
|
||||
|
||||
res.json(MembershipFactory.mapToSingleTotalStatistic(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get membership by member and record
|
||||
* @param req {Request} Express req object
|
||||
|
@ -263,6 +286,33 @@ export async function getQualificationByMemberAndRecord(req: Request, res: Respo
|
|||
res.json(MemberQualificationFactory.mapToSingle(qualification));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get educations by member
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getEducationsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
let educations = await MemberEducationService.getAll(memberId);
|
||||
|
||||
res.json(MemberEducationFactory.mapToBase(educations));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get education by member and record
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getEducationByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let education = await MemberEducationService.getById(memberId, recordId);
|
||||
|
||||
res.json(MemberEducationFactory.mapToSingle(education));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get executive positions by member
|
||||
* @param req {Request} Express req object
|
||||
|
@ -330,6 +380,7 @@ export async function createMember(req: Request, res: Response): Promise<any> {
|
|||
const nameaffix = req.body.nameaffix;
|
||||
const birthdate = req.body.birthdate;
|
||||
const internalId = req.body.internalId || null;
|
||||
const note = req.body.note || null;
|
||||
|
||||
let createMember: CreateMemberCommand = {
|
||||
salutationId,
|
||||
|
@ -338,6 +389,7 @@ export async function createMember(req: Request, res: Response): Promise<any> {
|
|||
nameaffix,
|
||||
birthdate,
|
||||
internalId,
|
||||
note,
|
||||
};
|
||||
let memberId = await MemberCommandHandler.create(createMember);
|
||||
|
||||
|
@ -413,6 +465,33 @@ export async function addQualificationToMember(req: Request, res: Response): Pro
|
|||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description add education to member
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addEducationToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
const note = req.body.note;
|
||||
const place = req.body.place;
|
||||
const start = req.body.start;
|
||||
const end = req.body.end || null;
|
||||
const educationId = req.body.educationId;
|
||||
|
||||
let createMemberEducation: CreateMemberEducationCommand = {
|
||||
note,
|
||||
start,
|
||||
end,
|
||||
place,
|
||||
memberId,
|
||||
educationId,
|
||||
};
|
||||
await MemberEducationCommandHandler.create(createMemberEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description add executive positions to member
|
||||
* @param req {Request} Express req object
|
||||
|
@ -491,6 +570,7 @@ export async function updateMemberById(req: Request, res: Response): Promise<any
|
|||
const nameaffix = req.body.nameaffix;
|
||||
const birthdate = req.body.birthdate;
|
||||
const internalId = req.body.internalId || null;
|
||||
const note = req.body.note || null;
|
||||
|
||||
let updateMember: UpdateMemberCommand = {
|
||||
id: memberId,
|
||||
|
@ -500,6 +580,7 @@ export async function updateMemberById(req: Request, res: Response): Promise<any
|
|||
nameaffix,
|
||||
birthdate,
|
||||
internalId,
|
||||
note,
|
||||
};
|
||||
await MemberCommandHandler.update(updateMember);
|
||||
|
||||
|
@ -589,6 +670,35 @@ export async function updateQualificationOfMember(req: Request, res: Response):
|
|||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update education of member
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateEducationOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const start = req.body.start;
|
||||
const end = req.body.end || null;
|
||||
const note = req.body.note;
|
||||
const place = req.body.place;
|
||||
const educationId = req.body.educationId;
|
||||
|
||||
let updateMemberEducation: UpdateMemberEducationCommand = {
|
||||
id: recordId,
|
||||
start,
|
||||
end,
|
||||
note,
|
||||
place,
|
||||
memberId,
|
||||
educationId,
|
||||
};
|
||||
await MemberEducationCommandHandler.update(updateMemberEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update executive position of member
|
||||
* @param req {Request} Express req object
|
||||
|
@ -729,6 +839,25 @@ export async function deleteQualificationOfMember(req: Request, res: Response):
|
|||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete education from member
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteEducationsOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteMemberEducation: DeleteMemberEducationCommand = {
|
||||
id: recordId,
|
||||
memberId,
|
||||
};
|
||||
await MemberEducationCommandHandler.delete(deleteMemberEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete executive position from member
|
||||
* @param req {Request} Express req object
|
||||
|
|
91
src/controller/admin/configuration/educationController.ts
Normal file
91
src/controller/admin/configuration/educationController.ts
Normal file
|
@ -0,0 +1,91 @@
|
|||
import { Request, Response } from "express";
|
||||
import EducationService from "../../../service/configuration/education";
|
||||
import EducationFactory from "../../../factory/admin/configuration/education";
|
||||
import {
|
||||
CreateEducationCommand,
|
||||
DeleteEducationCommand,
|
||||
UpdateEducationCommand,
|
||||
} from "../../../command/configuration/education/educationCommand";
|
||||
import EducationCommandHandler from "../../../command/configuration/education/educationCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all educations
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAllEducations(req: Request, res: Response): Promise<any> {
|
||||
let educations = await EducationService.getAll();
|
||||
|
||||
res.json(EducationFactory.mapToBase(educations));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get education by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getEducationById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let education = await EducationService.getById(id);
|
||||
|
||||
res.json(EducationFactory.mapToSingle(education));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create new education
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createEducation(req: Request, res: Response): Promise<any> {
|
||||
const education = req.body.education;
|
||||
const description = req.body.description;
|
||||
|
||||
let createEducation: CreateEducationCommand = {
|
||||
education: education,
|
||||
description: description,
|
||||
};
|
||||
await EducationCommandHandler.create(createEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update education
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateEducation(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const education = req.body.education;
|
||||
const description = req.body.description;
|
||||
|
||||
let updateEducation: UpdateEducationCommand = {
|
||||
id: id,
|
||||
education: education,
|
||||
description: description,
|
||||
};
|
||||
await EducationCommandHandler.update(updateEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete education
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteEducation(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteEducation: DeleteEducationCommand = {
|
||||
id: id,
|
||||
};
|
||||
await EducationCommandHandler.delete(deleteEducation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue