From cc763001a5863749911614752b5d32a39aa1453d Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Mon, 16 Sep 2024 19:03:41 +0200 Subject: [PATCH] member sort --- src/service/memberService.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/service/memberService.ts b/src/service/memberService.ts index 7d6d8e7..ea0b311 100644 --- a/src/service/memberService.ts +++ b/src/service/memberService.ts @@ -24,8 +24,13 @@ export default abstract class MemberService { "membership_last", "membership_last.memberId = member.id AND membership_last.start = (SELECT MAX(m.start) FROM membership m WHERE m.memberId = member.id)" ) + .leftJoinAndSelect("membership_first.status", "status_first") + .leftJoinAndSelect("membership_last.status", "status_last") .offset(offset) .limit(count) + .orderBy("member.lastname") + .addOrderBy("member.firstname") + .addOrderBy("member.nameaffix") .getManyAndCount() .then((res) => { return res; @@ -56,6 +61,8 @@ export default abstract class MemberService { "membership_last", "membership_last.memberId = member.id AND membership_last.start = (SELECT MAX(m.start) FROM membership m WHERE m.memberId = member.id)" ) + .leftJoinAndSelect("membership_first.status", "status_first") + .leftJoinAndSelect("membership_last.status", "status_last") .where("member.id = :id", { id: id }) .getOneOrFail() .then((res) => {