diff --git a/.env.example b/.env.example index 7070ead..30c166f 100644 --- a/.env.example +++ b/.env.example @@ -16,4 +16,5 @@ MAIL_HOST = mail_hoststring MAIL_PORT = mail_portnumber MAIL_SECURE (true|false) // true for port 465, fals for other ports -CLUB_NAME = clubname \ No newline at end of file +CLUB_NAME = clubname +CLUB_WEBSITE = https://my-club-website-url \ No newline at end of file diff --git a/README.md b/README.md index dc68a7b..670a481 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ services: - MAIL_PORT= - MAIL_SECURE= - CLUB_NAME= + - CLUB_WEBSITE= volumes: - :/app/export networks: diff --git a/src/command/memberAwardCommandHandler.ts b/src/command/memberAwardCommandHandler.ts index 05b2d0d..79aeae4 100644 --- a/src/command/memberAwardCommandHandler.ts +++ b/src/command/memberAwardCommandHandler.ts @@ -1,7 +1,7 @@ import { dataSource } from "../data-source"; import { award } from "../entity/award"; +import { member } from "../entity/member"; import { memberAwards } from "../entity/memberAwards"; -import { user } from "../entity/user"; import InternalException from "../exceptions/internalException"; import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand"; @@ -21,8 +21,8 @@ export default abstract class MemberAwardCommandHandler { note: createMemberAward.note, date: createMemberAward.date, member: await dataSource - .getRepository(user) - .createQueryBuilder("user") + .getRepository(member) + .createQueryBuilder("member") .where("id = :id", { id: createMemberAward.memberId }) .getOneOrFail(), award: await dataSource diff --git a/src/command/memberCommand.ts b/src/command/memberCommand.ts index 3dc61d3..a40de21 100644 --- a/src/command/memberCommand.ts +++ b/src/command/memberCommand.ts @@ -6,6 +6,7 @@ export interface CreateMemberCommand { lastname: string; nameaffix: string; birthdate: Date; + internalId?: string; } export interface UpdateMemberCommand { @@ -15,6 +16,7 @@ export interface UpdateMemberCommand { lastname: string; nameaffix: string; birthdate: Date; + internalId?: string; } export interface UpdateMemberNewsletterCommand { diff --git a/src/command/memberCommandHandler.ts b/src/command/memberCommandHandler.ts index 4c396cf..767a01f 100644 --- a/src/command/memberCommandHandler.ts +++ b/src/command/memberCommandHandler.ts @@ -27,6 +27,7 @@ export default abstract class MemberCommandHandler { lastname: createMember.lastname, nameaffix: createMember.nameaffix, birthdate: createMember.birthdate, + internalId: createMember.internalId, }) .execute() .then((result) => { @@ -53,6 +54,7 @@ export default abstract class MemberCommandHandler { lastname: updateMember.lastname, nameaffix: updateMember.nameaffix, birthdate: updateMember.birthdate, + internalId: updateMember.internalId, }) .where("id = :id", { id: updateMember.id }) .execute() diff --git a/src/command/memberExecutivePositionCommandHandler.ts b/src/command/memberExecutivePositionCommandHandler.ts index a9a1762..e6f88b9 100644 --- a/src/command/memberExecutivePositionCommandHandler.ts +++ b/src/command/memberExecutivePositionCommandHandler.ts @@ -1,7 +1,7 @@ import { dataSource } from "../data-source"; import { executivePosition } from "../entity/executivePosition"; +import { member } from "../entity/member"; import { memberExecutivePositions } from "../entity/memberExecutivePositions"; -import { user } from "../entity/user"; import InternalException from "../exceptions/internalException"; import { CreateMemberExecutivePositionCommand, @@ -25,8 +25,8 @@ export default abstract class MemberExecutivePositionCommandHandler { start: createMemberExecutivePosition.start, end: createMemberExecutivePosition.end, member: await dataSource - .getRepository(user) - .createQueryBuilder("user") + .getRepository(member) + .createQueryBuilder("member") .where("id = :id", { id: createMemberExecutivePosition.memberId }) .getOneOrFail(), executivePosition: await dataSource diff --git a/src/command/memberQualificationCommandHandler.ts b/src/command/memberQualificationCommandHandler.ts index 2963638..38f887d 100644 --- a/src/command/memberQualificationCommandHandler.ts +++ b/src/command/memberQualificationCommandHandler.ts @@ -1,13 +1,13 @@ import { dataSource } from "../data-source"; import { qualification } from "../entity/qualification"; import { memberQualifications } from "../entity/memberQualifications"; -import { user } from "../entity/user"; import InternalException from "../exceptions/internalException"; import { CreateMemberQualificationCommand, DeleteMemberQualificationCommand, UpdateMemberQualificationCommand, } from "./memberQualificationCommand"; +import { member } from "../entity/member"; export default abstract class MemberQualificationCommandHandler { /** @@ -24,8 +24,8 @@ export default abstract class MemberQualificationCommandHandler { note: createMemberQualification.note, start: createMemberQualification.start, member: await dataSource - .getRepository(user) - .createQueryBuilder("user") + .getRepository(member) + .createQueryBuilder("member") .where("id = :id", { id: createMemberQualification.memberId }) .getOneOrFail(), qualification: await dataSource diff --git a/src/command/membershipCommand.ts b/src/command/membershipCommand.ts index fcf429d..9e9ca25 100644 --- a/src/command/membershipCommand.ts +++ b/src/command/membershipCommand.ts @@ -1,5 +1,4 @@ export interface CreateMembershipCommand { - internalId?: string; start: Date; memberId: number; statusId: number; @@ -7,7 +6,6 @@ export interface CreateMembershipCommand { export interface UpdateMembershipCommand { id: number; - internalId?: string; start: Date; end?: Date; terminationReason?: string; diff --git a/src/command/membershipCommandHandler.ts b/src/command/membershipCommandHandler.ts index 204b0d8..35a5262 100644 --- a/src/command/membershipCommandHandler.ts +++ b/src/command/membershipCommandHandler.ts @@ -1,18 +1,18 @@ import { dataSource } from "../data-source"; +import { member } from "../entity/member"; import { membership } from "../entity/membership"; import { membershipStatus } from "../entity/membershipStatus"; -import { user } from "../entity/user"; import InternalException from "../exceptions/internalException"; import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand"; export default abstract class MembershipCommandHandler { /** * @description create membership - * @param CreateMembershipCommand + * @param {CreateMembershipCommand} createMembership * @returns {Promise} */ static async create(createMembership: CreateMembershipCommand): Promise { - let insertid = -1; + let insertId = -1; return await dataSource .transaction(async (manager) => { await manager @@ -20,11 +20,10 @@ export default abstract class MembershipCommandHandler { .insert() .into(membership) .values({ - internalId: createMembership.internalId, start: createMembership.start, member: await dataSource - .getRepository(user) - .createQueryBuilder("user") + .getRepository(member) + .createQueryBuilder("member") .where("id = :id", { id: createMembership.memberId }) .getOneOrFail(), status: await dataSource @@ -35,7 +34,7 @@ export default abstract class MembershipCommandHandler { }) .execute() .then((result) => { - insertid = result.identifiers[0].id; + insertId = result.identifiers[0].id; }); await manager @@ -43,14 +42,15 @@ export default abstract class MembershipCommandHandler { .update(membership) .set({ end: createMembership.start, + terminationReason: "beendet durch neuen Eintrag.", }) .where("end IS NULL") .andWhere("memberId = :memberId", { memberId: createMembership.memberId }) - .andWhere("id <> :id", { id: insertid }) + .andWhere("id <> :id", { id: insertId }) .execute(); }) .then(() => { - return insertid; + return insertId; }) .catch((err) => { throw new InternalException("Failed creating membership", err); @@ -59,7 +59,7 @@ export default abstract class MembershipCommandHandler { /** * @description update membership - * @param UpdateMembershipCommand + * @param {UpdateMembershipCommand} updateMembership * @returns {Promise} */ static async update(updateMembership: UpdateMembershipCommand): Promise { @@ -67,7 +67,6 @@ export default abstract class MembershipCommandHandler { .createQueryBuilder() .update(membership) .set({ - internalId: updateMembership.internalId, start: updateMembership.start, end: updateMembership.end, terminationReason: updateMembership.terminationReason, @@ -88,16 +87,16 @@ export default abstract class MembershipCommandHandler { /** * @description delete membership - * @param DeleteMembershipCommand + * @param {DeleteMembershipCommand} deleteMembership * @returns {Promise} */ - static async delete(deletMembership: DeleteMembershipCommand): Promise { + static async delete(deleteMembership: DeleteMembershipCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(membership) - .where("id = :id", { id: deletMembership.id }) - .andWhere("memberId = :memberId", { memberId: deletMembership.memberId }) + .where("id = :id", { id: deleteMembership.id }) + .andWhere("memberId = :memberId", { memberId: deleteMembership.memberId }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/templateUsageCommand.ts b/src/command/templateUsageCommand.ts index b9218a9..35a3311 100644 --- a/src/command/templateUsageCommand.ts +++ b/src/command/templateUsageCommand.ts @@ -3,4 +3,6 @@ export interface UpdateTemplateUsageCommand { headerId: number | null; bodyId: number | null; footerId: number | null; + headerHeight: number | null; + footerHeight: number | null; } diff --git a/src/command/templateUsageCommandHandler.ts b/src/command/templateUsageCommandHandler.ts index 54626ba..c9eecce 100644 --- a/src/command/templateUsageCommandHandler.ts +++ b/src/command/templateUsageCommandHandler.ts @@ -17,6 +17,8 @@ export default abstract class TemplateUsageCommandHandler { headerId: updateTemplateUsage.headerId, bodyId: updateTemplateUsage.bodyId, footerId: updateTemplateUsage.footerId, + headerHeight: updateTemplateUsage.headerHeight, + footerHeight: updateTemplateUsage.footerHeight, }) .where("scope = :scope", { scope: updateTemplateUsage.scope }) .execute() diff --git a/src/controller/admin/memberController.ts b/src/controller/admin/memberController.ts index 6644568..8728311 100644 --- a/src/controller/admin/memberController.ts +++ b/src/controller/admin/memberController.ts @@ -228,6 +228,7 @@ export async function createMember(req: Request, res: Response): Promise { const lastname = req.body.lastname; const nameaffix = req.body.nameaffix; const birthdate = req.body.birthdate; + const internalId = req.body.internalId; let createMember: CreateMemberCommand = { salutation, @@ -235,6 +236,7 @@ export async function createMember(req: Request, res: Response): Promise { lastname, nameaffix, birthdate, + internalId, }; let memberId = await MemberCommandHandler.create(createMember); @@ -249,12 +251,10 @@ export async function createMember(req: Request, res: Response): Promise { */ export async function addMembershipToMember(req: Request, res: Response): Promise { const memberId = parseInt(req.params.memberId); - const internalId = req.body.internalId; const start = req.body.start; const statusId = req.body.statusId; let createMembership: CreateMembershipCommand = { - internalId, start, memberId, statusId, @@ -394,6 +394,7 @@ export async function updateMemberById(req: Request, res: Response): Promise { const memberId = parseInt(req.params.memberId); const recordId = parseInt(req.params.recordId); - const internalId = req.body.internalId; const start = req.body.start; const end = req.body.end || null; const terminationReason = req.body.terminationReason; @@ -425,7 +426,6 @@ export async function updateMembershipOfMember(req: Request, res: Response): Pro let updateMembership: UpdateMembershipCommand = { id: recordId, - internalId, start, end, terminationReason, diff --git a/src/controller/admin/templateUsageController.ts b/src/controller/admin/templateUsageController.ts index ac1e74a..0a75af3 100644 --- a/src/controller/admin/templateUsageController.ts +++ b/src/controller/admin/templateUsageController.ts @@ -78,12 +78,16 @@ export async function updateTemplateUsage(req: Request, res: Response): Promise< const headerId = req.body.headerId ?? null; const bodyId = req.body.bodyId ?? null; const footerId = req.body.footerId ?? null; + const headerHeight = req.body.headerHeight ?? null; + const footerHeight = req.body.footerHeight ?? null; let updateTemplateUsage: UpdateTemplateUsageCommand = { scope: scope, headerId: headerId, bodyId: bodyId, footerId: footerId, + headerHeight: headerHeight, + footerHeight: footerHeight, }; await TemplateUsageCommandHandler.update(updateTemplateUsage); diff --git a/src/data-source.ts b/src/data-source.ts index 7e8321f..75f6f5b 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -61,6 +61,8 @@ import { newsletterRecipients } from "./entity/newsletterRecipients"; import { Newsletter1735118780511 } from "./migrations/1735118780511-newsletter"; import { newsletterConfig } from "./entity/newsletterConfig"; import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig"; +import { TemplateMargins1735733514043 } from "./migrations/1735733514043-templateMargins"; +import { InternalId1735822722235 } from "./migrations/1735822722235-internalId"; const dataSource = new DataSource({ type: DB_TYPE as any, @@ -132,6 +134,8 @@ const dataSource = new DataSource({ TemplateUsage1734949173739, Newsletter1735118780511, NewsletterConfig1735207446910, + TemplateMargins1735733514043, + InternalId1735822722235, ], migrationsRun: true, migrationsTransactionMode: "each", diff --git a/src/entity/member.ts b/src/entity/member.ts index de7f612..6fef6cf 100644 --- a/src/entity/member.ts +++ b/src/entity/member.ts @@ -39,6 +39,9 @@ export class member { @Column({ type: "date" }) birthdate: Date; + @Column({ type: "varchar", length: 255, unique: true, nullable: true }) + internalId?: string; + @OneToMany(() => communication, (communications) => communications.member) communications: communication[]; diff --git a/src/entity/memberAwards.ts b/src/entity/memberAwards.ts index 47ea86a..e25420e 100644 --- a/src/entity/memberAwards.ts +++ b/src/entity/memberAwards.ts @@ -16,6 +16,12 @@ export class memberAwards { @Column({ type: "date" }) date: Date; + @Column() + memberId: number; + + @Column() + awardId: number; + @ManyToOne(() => member, (member) => member.awards, { nullable: false, onDelete: "CASCADE", diff --git a/src/entity/memberExecutivePositions.ts b/src/entity/memberExecutivePositions.ts index 0f68729..fea07e9 100644 --- a/src/entity/memberExecutivePositions.ts +++ b/src/entity/memberExecutivePositions.ts @@ -16,6 +16,12 @@ export class memberExecutivePositions { @Column({ type: "date", nullable: true }) end?: Date; + @Column() + memberId: number; + + @Column() + executivePositionId: number; + @ManyToOne(() => member, (member) => member.awards, { nullable: false, onDelete: "CASCADE", diff --git a/src/entity/memberQualifications.ts b/src/entity/memberQualifications.ts index c2d4026..bbc67e9 100644 --- a/src/entity/memberQualifications.ts +++ b/src/entity/memberQualifications.ts @@ -19,6 +19,12 @@ export class memberQualifications { @Column({ type: "varchar", length: 255, nullable: true }) terminationReason?: string; + @Column() + memberId: number; + + @Column() + qualificationId: number; + @ManyToOne(() => member, (member) => member.awards, { nullable: false, onDelete: "CASCADE", diff --git a/src/entity/membership.ts b/src/entity/membership.ts index dd8d1ac..51801cb 100644 --- a/src/entity/membership.ts +++ b/src/entity/membership.ts @@ -7,6 +7,9 @@ export class membership { @PrimaryColumn({ generated: "increment", type: "int" }) id: number; + /** + * @deprecated + */ @Column({ type: "varchar", length: 255, unique: true, nullable: true }) internalId?: string; @@ -19,6 +22,12 @@ export class membership { @Column({ type: "varchar", length: 255, nullable: true }) terminationReason?: string; + @Column() + memberId: number; + + @Column() + statusId: number; + @ManyToOne(() => member, (member) => member.memberships, { nullable: false, onDelete: "CASCADE", diff --git a/src/entity/templateUsage.ts b/src/entity/templateUsage.ts index 8aefd11..00f41bf 100644 --- a/src/entity/templateUsage.ts +++ b/src/entity/templateUsage.ts @@ -7,15 +7,21 @@ export class templateUsage { @PrimaryColumn({ type: "varchar", length: 255 }) scope: PermissionModule; - @Column({ type: "number", nullable: true }) + @Column({ type: "int", nullable: true }) headerId: number | null; - @Column({ type: "number", nullable: true }) + @Column({ type: "int", nullable: true }) bodyId: number | null; - @Column({ type: "number", nullable: true }) + @Column({ type: "int", nullable: true }) footerId: number | null; + @Column({ type: "int", nullable: true }) + headerHeight: number | null; + + @Column({ type: "int", nullable: true }) + footerHeight: number | null; + @ManyToOne(() => template, { nullable: true, onDelete: "RESTRICT", diff --git a/src/factory/admin/member.ts b/src/factory/admin/member.ts index 44ddc70..01419e8 100644 --- a/src/factory/admin/member.ts +++ b/src/factory/admin/member.ts @@ -17,6 +17,7 @@ export default abstract class MemberFactory { lastname: record?.lastname, nameaffix: record?.nameaffix, birthdate: record?.birthdate, + internalId: record.internalId, firstMembershipEntry: record?.firstMembershipEntry ? MembershipFactory.mapToSingle(record.firstMembershipEntry) : null, diff --git a/src/factory/admin/membership.ts b/src/factory/admin/membership.ts index ba54a08..2a711c4 100644 --- a/src/factory/admin/membership.ts +++ b/src/factory/admin/membership.ts @@ -10,7 +10,6 @@ export default abstract class MembershipFactory { public static mapToSingle(record: membership): MembershipViewModel { return { id: record.id, - internalId: record.internalId, start: record.start, end: record.end, terminationReason: record.terminationReason, diff --git a/src/factory/admin/templateUsage.ts b/src/factory/admin/templateUsage.ts index e2a5acb..3472d52 100644 --- a/src/factory/admin/templateUsage.ts +++ b/src/factory/admin/templateUsage.ts @@ -13,6 +13,8 @@ export default abstract class TemplateUsageFactory { header: record.header ? { id: record.header.id, template: record.header.template } : null, body: record.body ? { id: record.body.id, template: record.body.template } : null, footer: record.footer ? { id: record.footer.id, template: record.footer.template } : null, + headerHeight: record.headerHeight, + footerHeight: record.footerHeight, }; } diff --git a/src/helpers/pdfExport.ts b/src/helpers/pdfExport.ts index 26a32c2..ee1af97 100644 --- a/src/helpers/pdfExport.ts +++ b/src/helpers/pdfExport.ts @@ -11,7 +11,6 @@ export abstract class PdfExport { filename = null, data = {}, saveToDisk = true, - margins = { top: "15mm", bottom: "15mm" }, folder = "", }: { template: PermissionModule; @@ -19,12 +18,11 @@ export abstract class PdfExport { filename?: string; data?: any; saveToDisk?: boolean; - margins?: { top: string; bottom: string }; folder?: string; }) { if (folder != "") FileSystemHelper.createFolder(folder); - const { header, footer, body } = await TemplateHelper.renderFileForModule({ + const { header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForModule({ module: template, headerData: data, bodyData: data, @@ -46,8 +44,8 @@ export abstract class PdfExport { format: "A4", printBackground: false, margin: { - top: margins.top, - bottom: margins.bottom, + top: (headerMargin ?? 15) + "mm", + bottom: (footerMargin ?? 15) + "mm", left: "10mm", right: "10mm", }, diff --git a/src/helpers/templateHelper.ts b/src/helpers/templateHelper.ts index cc1567b..eb681b6 100644 --- a/src/helpers/templateHelper.ts +++ b/src/helpers/templateHelper.ts @@ -1,7 +1,7 @@ import TemplateService from "../service/templateService"; import { PermissionModule } from "../type/permissionTypes"; import TemplateUsageService from "../service/templateUsageService"; -import Handlebars from "handlebars"; +import Handlebars, { template } from "handlebars"; import { FileSystemHelper } from "./fileSystemHelper"; export abstract class TemplateHelper { @@ -39,27 +39,27 @@ export abstract class TemplateHelper { headerData?: any; bodyData?: any; footerData?: any; - }): Promise<{ header: string; body: string; footer: string; margins?: { top: string; bottom: string } }> { - const moduleTemplates = await TemplateUsageService.getByScope(module); + }): Promise<{ header: string; body: string; footer: string; headerMargin?: number; footerMargin?: number }> { + const moduleTemplate = await TemplateUsageService.getByScope(module); let header = `

${title}

`; let footer = ""; let body = ""; - if (moduleTemplates.headerId) { - header = await this.getTemplateFromStore(moduleTemplates.headerId); + if (moduleTemplate.headerId) { + header = await this.getTemplateFromStore(moduleTemplate.headerId); header = this.applyDataToTemplate(header, { title, ...headerData }); } - if (moduleTemplates.footerId) { - footer = await this.getTemplateFromStore(moduleTemplates.footerId); + if (moduleTemplate.footerId) { + footer = await this.getTemplateFromStore(moduleTemplate.footerId); } else { footer = this.getTemplateFromFile(module + ".footer"); } footer = this.applyDataToTemplate(footer, footerData); - if (moduleTemplates.bodyId) { - body = await this.getTemplateFromStore(moduleTemplates.bodyId); + if (moduleTemplate.bodyId) { + body = await this.getTemplateFromStore(moduleTemplate.bodyId); } else { body = this.getTemplateFromFile(module + ".body"); } @@ -69,6 +69,8 @@ export abstract class TemplateHelper { header, footer, body, + headerMargin: moduleTemplate.headerHeight, + footerMargin: moduleTemplate.footerHeight, }; } } diff --git a/src/migrations/1735733514043-templateMargins.ts b/src/migrations/1735733514043-templateMargins.ts new file mode 100644 index 0000000..784d4fd --- /dev/null +++ b/src/migrations/1735733514043-templateMargins.ts @@ -0,0 +1,35 @@ +import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; +import { DB_TYPE } from "../env.defaults"; + +export class TemplateMargins1735733514043 implements MigrationInterface { + name = "TemplateMargins1735733514043"; + + public async up(queryRunner: QueryRunner): Promise { + const variableType_int = DB_TYPE == "mysql" ? "int" : "integer"; + + await queryRunner.addColumn( + "template_usage", + new TableColumn({ + name: "headerHeight", + type: variableType_int, + default: null, + isNullable: true, + }) + ); + + await queryRunner.addColumn( + "template_usage", + new TableColumn({ + name: "footerHeight", + type: variableType_int, + default: null, + isNullable: true, + }) + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn("template_usage", "footerHeight"); + await queryRunner.dropColumn("template_usage", "headerHeight"); + } +} diff --git a/src/migrations/1735822722235-internalId.ts b/src/migrations/1735822722235-internalId.ts new file mode 100644 index 0000000..9dccc0f --- /dev/null +++ b/src/migrations/1735822722235-internalId.ts @@ -0,0 +1,47 @@ +import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; +import { membership } from "../entity/membership"; +import { member } from "../entity/member"; + +export class InternalId1735822722235 implements MigrationInterface { + name = "InternalId1735822722235"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.addColumn( + "member", + new TableColumn({ + name: "internalId", + type: "varchar", + length: "255", + default: null, + isNullable: true, + isUnique: true, + }) + ); + + let memberships = await queryRunner.manager.getRepository(membership).find(); + console.log(memberships); + let internalIds = memberships.reduce<{ [key: number]: Array }>((acc, cur) => { + let memberId = cur.memberId; + let setIds = acc[memberId] ?? []; + if (cur?.internalId) { + setIds.push(cur.internalId); + } + acc[memberId] = setIds; + return acc; + }, {}); + + console.log(internalIds); + for (const [id, value] of Object.entries(internalIds)) { + const ids = value.filter((v) => v != null).join(", "); + if (ids) { + let m = await queryRunner.manager.getRepository(member).findOneByOrFail({ id: parseInt(id) }); + m.internalId = ids; + await queryRunner.manager.getRepository(member).save(m); + } + } + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn("member", "internalId"); + } +} diff --git a/src/service/membershipService.ts b/src/service/membershipService.ts index caa4273..96805cc 100644 --- a/src/service/membershipService.ts +++ b/src/service/membershipService.ts @@ -14,6 +14,7 @@ export default abstract class MembershipService { .createQueryBuilder("membership") .leftJoinAndSelect("membership.status", "membershipStatus") .where("membership.memberId = :memberId", { memberId: memberId }) + .orderBy("membership.start", "DESC") .getMany() .then((res) => { return res; diff --git a/src/viewmodel/admin/member.models.ts b/src/viewmodel/admin/member.models.ts index c005d9d..76f1a9a 100644 --- a/src/viewmodel/admin/member.models.ts +++ b/src/viewmodel/admin/member.models.ts @@ -9,6 +9,7 @@ export interface MemberViewModel { lastname: string; nameaffix: string; birthdate: Date; + internalId?: string; firstMembershipEntry?: MembershipViewModel; lastMembershipEntry?: MembershipViewModel; sendNewsletter?: CommunicationViewModel; diff --git a/src/viewmodel/admin/membership.models.ts b/src/viewmodel/admin/membership.models.ts index 396be33..59e2aba 100644 --- a/src/viewmodel/admin/membership.models.ts +++ b/src/viewmodel/admin/membership.models.ts @@ -1,6 +1,5 @@ export interface MembershipViewModel { id: number; - internalId?: string; start: Date; end?: Date; terminationReason?: string; diff --git a/src/viewmodel/admin/templateUsage.models.ts b/src/viewmodel/admin/templateUsage.models.ts index 3f9aa00..8783eac 100644 --- a/src/viewmodel/admin/templateUsage.models.ts +++ b/src/viewmodel/admin/templateUsage.models.ts @@ -5,4 +5,6 @@ export interface TemplateUsageViewModel { header: { id: number; template: string } | null; body: { id: number; template: string } | null; footer: { id: number; template: string } | null; + headerHeight: number | null; + footerHeight: number | null; }