member data service and factory

This commit is contained in:
Julian Krauser 2024-09-18 09:28:46 +02:00
parent e4e5f6dffb
commit f673dec5fa
2 changed files with 13 additions and 3 deletions

View file

@ -13,6 +13,7 @@ export default abstract class MemberQualificationFactory {
note: record.note, note: record.note,
start: record.start, start: record.start,
end: record.end, end: record.end,
terminationReason: record.terminationReason,
qualification: record.qualification.qualification, qualification: record.qualification.qualification,
}; };
} }

View file

@ -26,13 +26,13 @@ export default abstract class MemberService {
) )
.leftJoinAndSelect("membership_first.status", "status_first") .leftJoinAndSelect("membership_first.status", "status_first")
.leftJoinAndSelect("membership_last.status", "status_last") .leftJoinAndSelect("membership_last.status", "status_last")
.leftJoinAndSelect("member.sendNewsletter", "communication") .leftJoinAndSelect("member.sendNewsletter", "sendNewsletter")
.leftJoinAndSelect("communication.type", "communicationtype") .leftJoinAndSelect("sendNewsletter.type", "communicationtype")
.leftJoinAndMapMany( .leftJoinAndMapMany(
"member.preferredCommunication", "member.preferredCommunication",
"member.communications", "member.communications",
"preferredCommunication", "preferredCommunication",
"preferredCommunication.preferred = TRUE" "preferredCommunication.preferred = 1"
) )
.leftJoinAndSelect("preferredCommunication.type", "communicationtype_preferred") .leftJoinAndSelect("preferredCommunication.type", "communicationtype_preferred")
.offset(offset) .offset(offset)
@ -72,6 +72,15 @@ export default abstract class MemberService {
) )
.leftJoinAndSelect("membership_first.status", "status_first") .leftJoinAndSelect("membership_first.status", "status_first")
.leftJoinAndSelect("membership_last.status", "status_last") .leftJoinAndSelect("membership_last.status", "status_last")
.leftJoinAndSelect("member.sendNewsletter", "sendNewsletter")
.leftJoinAndSelect("sendNewsletter.type", "communicationtype")
.leftJoinAndMapMany(
"member.preferredCommunication",
"member.communications",
"preferredCommunication",
"preferredCommunication.preferred = 1"
)
.leftJoinAndSelect("preferredCommunication.type", "communicationtype_preferred")
.where("member.id = :id", { id: id }) .where("member.id = :id", { id: id })
.getOneOrFail() .getOneOrFail()
.then((res) => { .then((res) => {