diff --git a/src/routes/fillfromold.ts b/src/routes/fillfromold.ts index 80ef6c2..598c508 100644 --- a/src/routes/fillfromold.ts +++ b/src/routes/fillfromold.ts @@ -241,11 +241,11 @@ router.get("/", async (req, res) => { nn = nn.substring(0, nn.length - 6); } - // before 1.7.2003: Altersobergrenze für Aktive: 60 - const limit60 = moment('2003-07-01'); - // 1.7.2003 bis 10.12.2011: 63 - const limit63 = moment('2011-12-10'); - // from 10.12.2011: 65 + // before 1.1.2009: Altersobergrenze für Aktive: 60 + const limit60 = moment('2009-01-01'); + // before 1.7.2017: 63 + const limit63 = moment('2017-07-01'); + // from 1.7.2017: 65 const alter60 = moment(queryResultElement.Geboren).add(60, 'years'); const alter63 = moment(queryResultElement.Geboren).add(63, 'years'); @@ -426,6 +426,25 @@ router.get("/", async (req, res) => { await MembershipCommandHandler.update(updateMembership); } + if (!queryResultElement.Ausgetreten && !queryResultElement.verstorben && queryResultElement.verzogen) { + let end = new Date('2024-12-31'); + if (queryResultElement.verzogenDatum) { + end = queryResultElement.verzogenDatum; + } else { + if (queryResultElement["Übergang Passiv"]) { + end = queryResultElement["Übergang Passiv"]; + } + } + let updateMembership: UpdateMembershipCommand = { + end: end, + id: ms1, + memberId: memberId, + start: start, + statusId: stateId, + terminationReason: "verzogen", + }; + await MembershipCommandHandler.update(updateMembership); + } // add member's awards for (const awardId in sAwardsById) {