From 03cc0f02b7c22f9ce7f49102721f7fe777bb2538 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Wed, 8 Jan 2025 18:09:22 +0100 Subject: [PATCH] fix: member sorting at active members --- src/service/club/member/memberService.ts | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/service/club/member/memberService.ts b/src/service/club/member/memberService.ts index 4ac3a6d..969cbb9 100644 --- a/src/service/club/member/memberService.ts +++ b/src/service/club/member/memberService.ts @@ -120,17 +120,20 @@ export default abstract class MemberService { */ static async getByRunningMembership(): Promise> { return await dataSource - .getRepository(member) - .createQueryBuilder("member") - .leftJoinAndSelect("member.memberships", "membership") - .where("membership.end IS NULL") - .getMany() - .then((res) => { - return res; - }) - .catch((err) => { - throw new InternalException("member not found by id", err); - }); + .getRepository(member) + .createQueryBuilder("member") + .leftJoinAndSelect("member.memberships", "membership") + .where("membership.end IS NULL") + .orderBy("member.lastname") + .addOrderBy("member.firstname") + .addOrderBy("member.nameaffix") + .getMany() + .then((res) => { + return res; + }) + .catch((err) => { + throw new InternalException("member not found by id", err); + }); } /**