member controller read operations

This commit is contained in:
Julian Krauser 2024-09-16 16:00:05 +02:00
parent 7cd4e5505b
commit 5b678f6db6
2 changed files with 21 additions and 6 deletions

View file

@ -1,6 +1,16 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import MemberService from "../../service/memberService"; import MemberService from "../../service/memberService";
import MemberFactory from "../../factory/admin/member"; import MemberFactory from "../../factory/admin/member";
import MembershipService from "../../service/membershipService";
import MembershipFactory from "../../factory/admin/membership";
import MemberAwardService from "../../service/memberAwardService";
import MemberAwardFactory from "../../factory/admin/memberAward";
import MemberQualificationService from "../../service/memberQualificationService";
import MemberQualificationFactory from "../../factory/admin/memberQualification";
import MemberExecutivePositionService from "../../service/memberExecutivePositionService";
import MemberExecutivePositionFactory from "../../factory/admin/memberExecutivePosition";
import CommunicationService from "../../service/communicationService";
import CommunicationFactory from "../../factory/admin/communication";
/** /**
* @description get all members * @description get all members
@ -35,8 +45,9 @@ export async function getMemberById(req: Request, res: Response): Promise<any> {
*/ */
export async function getMembershipsByMember(req: Request, res: Response): Promise<any> { export async function getMembershipsByMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = parseInt(req.params.memberId);
let memberships = await MembershipService.getAll(memberId);
res.json([]); res.json(MembershipFactory.mapToBase(memberships));
} }
/** /**
@ -47,8 +58,9 @@ export async function getMembershipsByMember(req: Request, res: Response): Promi
*/ */
export async function getAwardsByMember(req: Request, res: Response): Promise<any> { export async function getAwardsByMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = parseInt(req.params.memberId);
let awards = await MemberAwardService.getAll(memberId);
res.json([]); res.json(MemberAwardFactory.mapToBase(awards));
} }
/** /**
@ -59,8 +71,9 @@ export async function getAwardsByMember(req: Request, res: Response): Promise<an
*/ */
export async function getQualificationsByMember(req: Request, res: Response): Promise<any> { export async function getQualificationsByMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = parseInt(req.params.memberId);
let qualifications = await MemberQualificationService.getAll(memberId);
res.json([]); res.json(MemberQualificationFactory.mapToBase(qualifications));
} }
/** /**
@ -71,8 +84,9 @@ export async function getQualificationsByMember(req: Request, res: Response): Pr
*/ */
export async function getExecutivePositionsByMember(req: Request, res: Response): Promise<any> { export async function getExecutivePositionsByMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = parseInt(req.params.memberId);
let positions = await MemberExecutivePositionService.getAll(memberId);
res.json([]); res.json(MemberExecutivePositionFactory.mapToBase(positions));
} }
/** /**
@ -83,8 +97,9 @@ export async function getExecutivePositionsByMember(req: Request, res: Response)
*/ */
export async function getCommunicationsByMember(req: Request, res: Response): Promise<any> { export async function getCommunicationsByMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = parseInt(req.params.memberId);
let communications = await CommunicationService.getAll(memberId);
res.json([]); res.json(CommunicationFactory.mapToBase(communications));
} }
/** /**

View file

@ -2,7 +2,7 @@ import { dataSource } from "../data-source";
import { membership } from "../entity/membership"; import { membership } from "../entity/membership";
import InternalException from "../exceptions/internalException"; import InternalException from "../exceptions/internalException";
export default abstract class Membershipervice { export default abstract class MembershipService {
/** /**
* @description get all by member id * @description get all by member id
* @param {number} memberId * @param {number} memberId