member sort

This commit is contained in:
Julian Krauser 2024-09-16 19:03:41 +02:00
parent 04bab0c97e
commit cc763001a5

View file

@ -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) => {