patches v1.3.3 #78
42 changed files with 743 additions and 85 deletions
|
@ -2,5 +2,6 @@ export interface SynchronizeProtocolAgendaCommand {
|
||||||
id?: number;
|
id?: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
sort?: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
||||||
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
||||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
import ProtocolAgendaService from "../../../service/club/protocol/protocolAgendaService";
|
||||||
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolAgendaCommandHandler {
|
export default abstract class ProtocolAgendaCommandHandler {
|
||||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
* @returns {Promise<number>}
|
* @returns {Promise<number>}
|
||||||
*/
|
*/
|
||||||
static async create(protocolId: number): Promise<number> {
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
let count = await ProtocolAgendaService.getInstanceCount(protocolId);
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.insert()
|
.insert()
|
||||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
|
sort: count,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -40,7 +43,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolAgenda)
|
.into(protocolAgenda)
|
||||||
.values(syncProtocolAgenda)
|
.values(syncProtocolAgenda)
|
||||||
.orUpdate(["topic", "context"], ["id"])
|
.orUpdate(["topic", "context", "sort"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -2,5 +2,6 @@ export interface SynchronizeProtocolDecisionCommand {
|
||||||
id?: number;
|
id?: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
sort?: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
||||||
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
||||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
import ProtocolDecisionService from "../../../service/club/protocol/protocolDecisionService";
|
||||||
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolDecisionCommandHandler {
|
export default abstract class ProtocolDecisionCommandHandler {
|
||||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
* @returns {Promise<number>}
|
* @returns {Promise<number>}
|
||||||
*/
|
*/
|
||||||
static async create(protocolId: number): Promise<number> {
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
let count = await ProtocolDecisionService.getInstanceCount(protocolId);
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.insert()
|
.insert()
|
||||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
|
sort: count,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -39,7 +42,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolDecision)
|
.into(protocolDecision)
|
||||||
.values(syncProtocolDecisions)
|
.values(syncProtocolDecisions)
|
||||||
.orUpdate(["topic", "context"], ["id"])
|
.orUpdate(["topic", "context", "sort"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -5,5 +5,6 @@ export interface SynchronizeProtocolVotingCommand {
|
||||||
favour: number;
|
favour: number;
|
||||||
abstain: number;
|
abstain: number;
|
||||||
against: number;
|
against: number;
|
||||||
|
sort?: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
||||||
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
||||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
import ProtocolVotingService from "../../../service/club/protocol/protocolVotingService";
|
||||||
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolVotingCommandHandler {
|
export default abstract class ProtocolVotingCommandHandler {
|
||||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
* @returns {Promise<number>}
|
* @returns {Promise<number>}
|
||||||
*/
|
*/
|
||||||
static async create(protocolId: number): Promise<number> {
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
let count = await ProtocolVotingService.getInstanceCount(protocolId);
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.insert()
|
.insert()
|
||||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
|
sort: count,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -39,7 +42,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolVoting)
|
.into(protocolVoting)
|
||||||
.values(syncProtocolVotings)
|
.values(syncProtocolVotings)
|
||||||
.orUpdate(["topic", "context", "favour", "abstain", "against"], ["id"])
|
.orUpdate(["topic", "context", "favour", "abstain", "against", "sort"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
60
src/controller/admin/club/listprintController.ts
Normal file
60
src/controller/admin/club/listprintController.ts
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import { Request, Response } from "express";
|
||||||
|
import { PdfExport } from "../../../helpers/pdfExport";
|
||||||
|
import DynamicQueryBuilder from "../../../helpers/dynamicQueryBuilder";
|
||||||
|
import QueryStoreService from "../../../service/configuration/queryStoreService";
|
||||||
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description print list by query and template
|
||||||
|
* @param req {Request} Express req object
|
||||||
|
* @param res {Response} Express res object
|
||||||
|
* @returns {Promise<*>}
|
||||||
|
*/
|
||||||
|
export async function printListByQueryAndTemplate(req: Request, res: Response): Promise<any> {
|
||||||
|
const title = req.body.title;
|
||||||
|
const queryStore = req.body.queryStore;
|
||||||
|
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 query = queryStore;
|
||||||
|
if (queryStore != "member" && queryStore != "memberByRunningMembership") {
|
||||||
|
query = (await QueryStoreService.getById(queryStore)).query;
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = await DynamicQueryBuilder.executeQuery({
|
||||||
|
query: query.startsWith("{") ? JSON.parse(query) : query,
|
||||||
|
noLimit: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.stats == "error") {
|
||||||
|
throw new InternalException("Failed executing Query");
|
||||||
|
}
|
||||||
|
|
||||||
|
let pdf = await PdfExport.renderFile({
|
||||||
|
title: title,
|
||||||
|
template: "listprint",
|
||||||
|
saveToDisk: false,
|
||||||
|
data: {
|
||||||
|
today: new Date(),
|
||||||
|
list: data.rows,
|
||||||
|
},
|
||||||
|
customTemplate: {
|
||||||
|
headerId,
|
||||||
|
footerId,
|
||||||
|
bodyId,
|
||||||
|
headerHeight,
|
||||||
|
footerHeight,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
let pdfbuffer = Buffer.from(pdf);
|
||||||
|
|
||||||
|
res.setHeader("Content-Type", "application/pdf");
|
||||||
|
res.setHeader("Content-Length", pdfbuffer.byteLength);
|
||||||
|
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
|
||||||
|
|
||||||
|
res.send(pdfbuffer);
|
||||||
|
}
|
|
@ -118,6 +118,45 @@ export async function getMemberStatisticsById(req: Request, res: Response): Prom
|
||||||
res.json(MemberFactory.mapToMemberStatistic(member));
|
res.json(MemberFactory.mapToMemberStatistic(member));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get member printout by id
|
||||||
|
* @param req {Request} Express req object
|
||||||
|
* @param res {Response} Express res object
|
||||||
|
* @returns {Promise<*>}
|
||||||
|
*/
|
||||||
|
export async function getMemberPrintoutById(req: Request, res: Response): Promise<any> {
|
||||||
|
const memberId = req.params.id;
|
||||||
|
let member = await MemberService.getById(memberId);
|
||||||
|
let memberships = await MembershipService.getAll(memberId);
|
||||||
|
let awards = await MemberAwardService.getAll(memberId);
|
||||||
|
let qualifications = await MemberQualificationService.getAll(memberId);
|
||||||
|
let positions = await MemberExecutivePositionService.getAll(memberId);
|
||||||
|
let communications = await CommunicationService.getAll(memberId);
|
||||||
|
|
||||||
|
let pdf = await PdfExport.renderFile({
|
||||||
|
title: "Mitglieder-Ausdruck",
|
||||||
|
template: "member",
|
||||||
|
saveToDisk: false,
|
||||||
|
data: {
|
||||||
|
today: new Date(),
|
||||||
|
member,
|
||||||
|
memberships,
|
||||||
|
awards,
|
||||||
|
qualifications,
|
||||||
|
positions,
|
||||||
|
communications,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
let pdfbuffer = Buffer.from(pdf);
|
||||||
|
|
||||||
|
res.setHeader("Content-Type", "application/pdf");
|
||||||
|
res.setHeader("Content-Length", pdfbuffer.byteLength);
|
||||||
|
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
|
||||||
|
|
||||||
|
res.send(pdfbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description get memberships by member
|
* @description get memberships by member
|
||||||
* @param req {Request} Express req object
|
* @param req {Request} Express req object
|
||||||
|
@ -266,33 +305,6 @@ export async function getCommunicationByMemberAndRecord(req: Request, res: Respo
|
||||||
res.json(CommunicationFactory.mapToSingle(communication));
|
res.json(CommunicationFactory.mapToSingle(communication));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description create member printout list
|
|
||||||
* @param req {Request} Express req object
|
|
||||||
* @param res {Response} Express res object
|
|
||||||
* @returns {Promise<*>}
|
|
||||||
*/
|
|
||||||
export async function createMemberPrintoutList(req: Request, res: Response): Promise<any> {
|
|
||||||
let members = await MemberService.getByRunningMembership();
|
|
||||||
|
|
||||||
let pdf = await PdfExport.renderFile({
|
|
||||||
title: "Mitgliederliste",
|
|
||||||
template: "member.list",
|
|
||||||
saveToDisk: false,
|
|
||||||
data: {
|
|
||||||
member: members,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
let pdfbuffer = Buffer.from(pdf);
|
|
||||||
|
|
||||||
res.setHeader("Content-Type", "application/pdf");
|
|
||||||
res.setHeader("Content-Length", pdfbuffer.byteLength);
|
|
||||||
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
|
|
||||||
|
|
||||||
res.send(pdfbuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description create member
|
* @description create member
|
||||||
* @param req {Request} Express req object
|
* @param req {Request} Express req object
|
||||||
|
|
|
@ -257,13 +257,13 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
|
||||||
}),
|
}),
|
||||||
start: protocol.starttime,
|
start: protocol.starttime,
|
||||||
end: protocol.endtime,
|
end: protocol.endtime,
|
||||||
agenda,
|
agenda: agenda.sort((a, b) => a.sort - b.sort),
|
||||||
decisions,
|
decisions: decisions.sort((a, b) => a.sort - b.sort),
|
||||||
presence: presence.filter((p) => !p.absent).map((p) => p.member),
|
presence: presence.filter((p) => !p.absent).map((p) => p.member),
|
||||||
absent: presence.filter((p) => p.absent).map((p) => ({ ...p.member, excused: p.excused })),
|
absent: presence.filter((p) => p.absent).map((p) => ({ ...p.member, excused: p.excused })),
|
||||||
excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member),
|
excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member),
|
||||||
unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member),
|
unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member),
|
||||||
votings,
|
votings: votings.sort((a, b) => a.sort - b.sort),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -320,6 +320,7 @@ export async function synchronizeProtocolAgendaById(req: Request, res: Response)
|
||||||
id: a.id ?? null,
|
id: a.id ?? null,
|
||||||
topic: a.topic,
|
topic: a.topic,
|
||||||
context: a.context,
|
context: a.context,
|
||||||
|
sort: a.sort,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -343,6 +344,7 @@ export async function synchronizeProtocolDecisonsById(req: Request, res: Respons
|
||||||
id: d.id ?? null,
|
id: d.id ?? null,
|
||||||
topic: d.topic,
|
topic: d.topic,
|
||||||
context: d.context,
|
context: d.context,
|
||||||
|
sort: d.sort,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -362,13 +364,14 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
|
||||||
let votings = req.body.votings as Array<ProtocolVotingViewModel>;
|
let votings = req.body.votings as Array<ProtocolVotingViewModel>;
|
||||||
|
|
||||||
let syncVoting: Array<SynchronizeProtocolVotingCommand> = votings.map(
|
let syncVoting: Array<SynchronizeProtocolVotingCommand> = votings.map(
|
||||||
(d: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
|
(v: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
|
||||||
id: d.id ?? null,
|
id: v.id ?? null,
|
||||||
topic: d.topic,
|
topic: v.topic,
|
||||||
context: d.context,
|
context: v.context,
|
||||||
favour: d.favour,
|
favour: v.favour,
|
||||||
abstain: d.abstain,
|
abstain: v.abstain,
|
||||||
against: d.abstain,
|
against: v.abstain,
|
||||||
|
sort: v.sort,
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,6 +47,7 @@ import { salutation } from "./entity/configuration/salutation";
|
||||||
|
|
||||||
import { BackupAndResetDatabase1738166124200 } from "./migrations/1738166124200-BackupAndResetDatabase";
|
import { BackupAndResetDatabase1738166124200 } from "./migrations/1738166124200-BackupAndResetDatabase";
|
||||||
import { CreateSchema1738166167472 } from "./migrations/1738166167472-CreateSchema";
|
import { CreateSchema1738166167472 } from "./migrations/1738166167472-CreateSchema";
|
||||||
|
import { TemplatesAndProtocolSort1742549956787 } from "./migrations/1742549956787-templatesAndProtocolSort";
|
||||||
|
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: DB_TYPE as any,
|
type: DB_TYPE as any,
|
||||||
|
@ -100,7 +101,7 @@ const dataSource = new DataSource({
|
||||||
webapi,
|
webapi,
|
||||||
webapiPermission,
|
webapiPermission,
|
||||||
],
|
],
|
||||||
migrations: [BackupAndResetDatabase1738166124200, CreateSchema1738166167472],
|
migrations: [BackupAndResetDatabase1738166124200, CreateSchema1738166167472, TemplatesAndProtocolSort1742549956787],
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrationsTransactionMode: "each",
|
migrationsTransactionMode: "each",
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
|
|
138
src/demodata/member.data.ts
Normal file
138
src/demodata/member.data.ts
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
import { communication } from "../entity/club/member/communication";
|
||||||
|
import { member } from "../entity/club/member/member";
|
||||||
|
import { memberAwards } from "../entity/club/member/memberAwards";
|
||||||
|
import { memberExecutivePositions } from "../entity/club/member/memberExecutivePositions";
|
||||||
|
import { memberQualifications } from "../entity/club/member/memberQualifications";
|
||||||
|
import { membership } from "../entity/club/member/membership";
|
||||||
|
|
||||||
|
export const memberDemoData: {
|
||||||
|
member: Partial<member>;
|
||||||
|
today: string;
|
||||||
|
memberships: Array<Partial<membership>>;
|
||||||
|
awards: Array<Partial<memberAwards>>;
|
||||||
|
qualifications: Array<Partial<memberQualifications>>;
|
||||||
|
positions: Array<Partial<memberExecutivePositions>>;
|
||||||
|
communications: Array<Partial<communication>>;
|
||||||
|
} = {
|
||||||
|
today: "Montag, 17.03.2025",
|
||||||
|
member: {
|
||||||
|
id: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
firstname: "Julian",
|
||||||
|
lastname: "Krauser",
|
||||||
|
nameaffix: "",
|
||||||
|
//@ts-ignore
|
||||||
|
birthdate: "2003-09-20",
|
||||||
|
internalId: "1312",
|
||||||
|
salutationId: 47,
|
||||||
|
salutation: { id: 47, salutation: "Herr", members: [] },
|
||||||
|
firstMembershipEntry: {
|
||||||
|
id: 8681,
|
||||||
|
//@ts-ignore
|
||||||
|
start: "2017-11-13",
|
||||||
|
end: null,
|
||||||
|
terminationReason: null,
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
statusId: 34,
|
||||||
|
status: { id: 34, status: "aktiv", memberships: [] },
|
||||||
|
//@ts-ignore
|
||||||
|
member: {},
|
||||||
|
},
|
||||||
|
lastMembershipEntry: {
|
||||||
|
id: 8681,
|
||||||
|
//@ts-ignore
|
||||||
|
start: "2017-11-13",
|
||||||
|
end: null,
|
||||||
|
terminationReason: null,
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
statusId: 34,
|
||||||
|
status: { id: 34, status: "aktiv", memberships: [] },
|
||||||
|
//@ts-ignore
|
||||||
|
member: {},
|
||||||
|
},
|
||||||
|
preferredCommunication: [
|
||||||
|
{
|
||||||
|
id: 7031,
|
||||||
|
preferred: true,
|
||||||
|
isSMSAlarming: false,
|
||||||
|
isSendNewsletter: true,
|
||||||
|
mobile: "",
|
||||||
|
email: "julian.krauser@jk-effects.com",
|
||||||
|
postalCode: "",
|
||||||
|
city: "",
|
||||||
|
street: "",
|
||||||
|
streetNumber: 0,
|
||||||
|
streetNumberAddition: "",
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
typeId: 46,
|
||||||
|
type: { id: 46, type: "Email", useColumns: ["email"], communications: [] },
|
||||||
|
// @ts-ignore
|
||||||
|
member: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
smsAlarming: [],
|
||||||
|
sendNewsletter: {
|
||||||
|
id: 7031,
|
||||||
|
preferred: true,
|
||||||
|
isSMSAlarming: false,
|
||||||
|
isSendNewsletter: true,
|
||||||
|
mobile: "",
|
||||||
|
email: "julian.krauser@jk-effects.com ",
|
||||||
|
postalCode: "",
|
||||||
|
city: "",
|
||||||
|
street: "",
|
||||||
|
streetNumber: 0,
|
||||||
|
streetNumberAddition: "",
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
typeId: 46,
|
||||||
|
type: { id: 46, type: "Email", useColumns: ["email"], communications: [] },
|
||||||
|
// @ts-ignore
|
||||||
|
member: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
memberships: [
|
||||||
|
{
|
||||||
|
id: 8681,
|
||||||
|
//@ts-ignore
|
||||||
|
start: "2017-11-13",
|
||||||
|
end: null,
|
||||||
|
terminationReason: null,
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
statusId: 34,
|
||||||
|
status: { id: 34, status: "aktiv", memberships: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
awards: [],
|
||||||
|
qualifications: [],
|
||||||
|
positions: [
|
||||||
|
{
|
||||||
|
id: 696,
|
||||||
|
note: "",
|
||||||
|
//@ts-ignore
|
||||||
|
start: "2025-01-06",
|
||||||
|
end: null,
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
executivePositionId: 192,
|
||||||
|
executivePosition: { id: 192, position: "Schriftführer", members: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
communications: [
|
||||||
|
{
|
||||||
|
id: 7031,
|
||||||
|
preferred: true,
|
||||||
|
isSMSAlarming: false,
|
||||||
|
isSendNewsletter: true,
|
||||||
|
mobile: "",
|
||||||
|
email: "julian.krauser@jk-effects.com",
|
||||||
|
postalCode: "",
|
||||||
|
city: "",
|
||||||
|
street: "",
|
||||||
|
streetNumber: 0,
|
||||||
|
streetNumberAddition: "",
|
||||||
|
memberId: "2fe205f8-8ae8-4218-839f-af3456d3f39d",
|
||||||
|
typeId: 46,
|
||||||
|
//@ts-ignore
|
||||||
|
member: {},
|
||||||
|
type: { id: 46, type: "Email", useColumns: ["email"], communications: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -1,13 +0,0 @@
|
||||||
import { member } from "../entity/club/member/member";
|
|
||||||
import { protocolAgenda } from "../entity/club/protocol/protocolAgenda";
|
|
||||||
import { protocolDecision } from "../entity/club/protocol/protocolDecision";
|
|
||||||
import { protocolVoting } from "../entity/club/protocol/protocolVoting";
|
|
||||||
|
|
||||||
export const memberlistDemoData: { member: Array<Partial<member>> } = {
|
|
||||||
member: [
|
|
||||||
{
|
|
||||||
firstname: "Julian",
|
|
||||||
lastname: "Krauser",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -12,6 +12,9 @@ export class protocolAgenda {
|
||||||
@Column({ type: "text", default: "" })
|
@Column({ type: "text", default: "" })
|
||||||
context: string;
|
context: string;
|
||||||
|
|
||||||
|
@Column({ type: "int", default: 0 })
|
||||||
|
sort: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ export class protocolDecision {
|
||||||
@Column({ type: "text", default: "" })
|
@Column({ type: "text", default: "" })
|
||||||
context: string;
|
context: string;
|
||||||
|
|
||||||
|
@Column({ type: "int", default: 0 })
|
||||||
|
sort: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ export class protocolVoting {
|
||||||
@Column({ type: "int", default: 0 })
|
@Column({ type: "int", default: 0 })
|
||||||
against: number;
|
against: number;
|
||||||
|
|
||||||
|
@Column({ type: "int", default: 0 })
|
||||||
|
sort: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class ProtocolAgendaFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
topic: record.topic,
|
topic: record.topic,
|
||||||
context: record.context,
|
context: record.context,
|
||||||
|
sort: record.sort,
|
||||||
protocolId: record.protocolId,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class ProtocolDecisionFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
topic: record.topic,
|
topic: record.topic,
|
||||||
context: record.context,
|
context: record.context,
|
||||||
|
sort: record.sort,
|
||||||
protocolId: record.protocolId,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ export default abstract class ProtocolVotingFactory {
|
||||||
favour: record.favour,
|
favour: record.favour,
|
||||||
abstain: record.abstain,
|
abstain: record.abstain,
|
||||||
against: record.against,
|
against: record.against,
|
||||||
|
sort: record.sort,
|
||||||
protocolId: record.protocolId,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
32
src/handlebars.config.ts
Normal file
32
src/handlebars.config.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import Handlebars from "handlebars";
|
||||||
|
|
||||||
|
Handlebars.registerHelper("date", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "2-digit",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("longdate", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
weekday: "long",
|
||||||
|
day: "2-digit",
|
||||||
|
month: "2-digit",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("datetime", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "2-digit",
|
||||||
|
year: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("json", function (context) {
|
||||||
|
return JSON.stringify(context);
|
||||||
|
});
|
|
@ -300,8 +300,8 @@ export default abstract class BackupHelper {
|
||||||
.leftJoin("protocol.printouts", "printouts")
|
.leftJoin("protocol.printouts", "printouts")
|
||||||
.leftJoin("protocol.votings", "votings")
|
.leftJoin("protocol.votings", "votings")
|
||||||
.select(["protocol.title", "protocol.date", "protocol.starttime", "protocol.endtime", "protocol.summary"])
|
.select(["protocol.title", "protocol.date", "protocol.starttime", "protocol.endtime", "protocol.summary"])
|
||||||
.addSelect(["agendas.topic", "agendas.context"])
|
.addSelect(["agendas.topic", "agendas.context", "agendas.sort"])
|
||||||
.addSelect(["decisions.topic", "decisions.context"])
|
.addSelect(["decisions.topic", "decisions.context", "decisions.sort"])
|
||||||
.addSelect(["presences.absent", "presences.excused"])
|
.addSelect(["presences.absent", "presences.excused"])
|
||||||
.addSelect([
|
.addSelect([
|
||||||
...(collectIds ? ["member.id"] : []),
|
...(collectIds ? ["member.id"] : []),
|
||||||
|
@ -312,7 +312,14 @@ export default abstract class BackupHelper {
|
||||||
"member.internalId",
|
"member.internalId",
|
||||||
])
|
])
|
||||||
.addSelect(["printouts.title", "printouts.iteration", "printouts.filename", "printouts.createdAt"])
|
.addSelect(["printouts.title", "printouts.iteration", "printouts.filename", "printouts.createdAt"])
|
||||||
.addSelect(["votings.topic", "votings.context", "votings.favour", "votings.abstain", "votings.against"])
|
.addSelect([
|
||||||
|
"votings.topic",
|
||||||
|
"votings.context",
|
||||||
|
"votings.favour",
|
||||||
|
"votings.abstain",
|
||||||
|
"votings.against",
|
||||||
|
"votings.sort",
|
||||||
|
])
|
||||||
.getMany();
|
.getMany();
|
||||||
}
|
}
|
||||||
private static async getNewsletter(collectIds: boolean): Promise<Array<any>> {
|
private static async getNewsletter(collectIds: boolean): Promise<Array<any>> {
|
||||||
|
|
|
@ -50,7 +50,7 @@ export abstract class CalendarHelper {
|
||||||
alarms: [
|
alarms: [
|
||||||
{
|
{
|
||||||
action: "display",
|
action: "display",
|
||||||
description: "Erinnerung",
|
summary: "Erinnerung",
|
||||||
trigger: {
|
trigger: {
|
||||||
minutes: 30,
|
minutes: 30,
|
||||||
before: true,
|
before: true,
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { newsletterDemoData } from "../demodata/newsletter.data";
|
import { newsletterDemoData } from "../demodata/newsletter.data";
|
||||||
import { protocolDemoData } from "../demodata/protocol.data";
|
import { protocolDemoData } from "../demodata/protocol.data";
|
||||||
import { PermissionModule } from "../type/permissionTypes";
|
import { PermissionModule } from "../type/permissionTypes";
|
||||||
import {memberlistDemoData} from "../demodata/member.list.data";
|
import { memberDemoData } from "../demodata/member.data";
|
||||||
|
|
||||||
export abstract class DemoDataHelper {
|
export abstract class DemoDataHelper {
|
||||||
static getData(scope: `${PermissionModule}`|`${PermissionModule}.${string}`) {
|
static getData(scope: `${PermissionModule}` | `${PermissionModule}.${string}`) {
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case "protocol":
|
case "protocol":
|
||||||
return protocolDemoData;
|
return protocolDemoData;
|
||||||
case "newsletter":
|
case "newsletter":
|
||||||
return newsletterDemoData;
|
return newsletterDemoData;
|
||||||
case "member.list":
|
case "member":
|
||||||
return memberlistDemoData;
|
return memberDemoData;
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,6 +314,13 @@ export default abstract class DynamicQueryBuilder {
|
||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
> {
|
> {
|
||||||
|
if (query == "member") {
|
||||||
|
query = memberQuery;
|
||||||
|
}
|
||||||
|
if (query == "memberByRunningMembership") {
|
||||||
|
query = memberByRunningMembershipQuery;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof query == "string") {
|
if (typeof query == "string") {
|
||||||
const upperQuery = query.trim().toUpperCase();
|
const upperQuery = query.trim().toUpperCase();
|
||||||
if (!upperQuery.startsWith("SELECT") || /INSERT|UPDATE|DELETE|ALTER|DROP|CREATE|TRUNCATE/.test(upperQuery)) {
|
if (!upperQuery.startsWith("SELECT") || /INSERT|UPDATE|DELETE|ALTER|DROP|CREATE|TRUNCATE/.test(upperQuery)) {
|
||||||
|
@ -330,7 +337,7 @@ export default abstract class DynamicQueryBuilder {
|
||||||
|
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.transaction(async (manager) => {
|
.transaction(async (manager) => {
|
||||||
data = await manager.query(query);
|
data = await manager.query(query.toString());
|
||||||
|
|
||||||
throw new Error("AllwaysRollbackQuery");
|
throw new Error("AllwaysRollbackQuery");
|
||||||
})
|
})
|
||||||
|
@ -382,3 +389,29 @@ export default abstract class DynamicQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const memberQuery: DynamicQueryStructure = {
|
||||||
|
select: "*",
|
||||||
|
table: "member",
|
||||||
|
orderBy: [
|
||||||
|
{ column: "lastname", order: "ASC" },
|
||||||
|
{ column: "firstname", order: "ASC" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const memberByRunningMembershipQuery: DynamicQueryStructure = {
|
||||||
|
select: "*",
|
||||||
|
table: "member",
|
||||||
|
join: [
|
||||||
|
{
|
||||||
|
select: "*",
|
||||||
|
table: "membership",
|
||||||
|
where: [{ structureType: "condition", concat: "_", operation: "null", column: "end", value: "" }],
|
||||||
|
foreignColumn: "memberships",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
orderBy: [
|
||||||
|
{ column: "lastname", order: "ASC" },
|
||||||
|
{ column: "firstname", order: "ASC" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
|
@ -12,6 +12,7 @@ export abstract class PdfExport {
|
||||||
data = {},
|
data = {},
|
||||||
saveToDisk = true,
|
saveToDisk = true,
|
||||||
folder = "",
|
folder = "",
|
||||||
|
customTemplate = undefined,
|
||||||
}: {
|
}: {
|
||||||
template: `${PermissionModule}` | `${PermissionModule}.${string}`;
|
template: `${PermissionModule}` | `${PermissionModule}.${string}`;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
@ -19,16 +20,35 @@ export abstract class PdfExport {
|
||||||
data?: any;
|
data?: any;
|
||||||
saveToDisk?: boolean;
|
saveToDisk?: boolean;
|
||||||
folder?: string;
|
folder?: string;
|
||||||
|
customTemplate?: {
|
||||||
|
headerId?: number;
|
||||||
|
footerId?: number;
|
||||||
|
bodyId?: string | number;
|
||||||
|
headerHeight: number;
|
||||||
|
footerHeight: number;
|
||||||
|
};
|
||||||
}) {
|
}) {
|
||||||
if (folder != "") FileSystemHelper.createFolder(folder);
|
if (folder != "") FileSystemHelper.createFolder(folder);
|
||||||
|
|
||||||
const { header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForModule({
|
let header: string, footer: string, body: string, headerMargin: number, footerMargin: number;
|
||||||
|
if (!customTemplate) {
|
||||||
|
({ header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForModule({
|
||||||
module: template,
|
module: template,
|
||||||
headerData: data,
|
headerData: data,
|
||||||
bodyData: data,
|
bodyData: data,
|
||||||
footerData: data,
|
footerData: data,
|
||||||
title: title,
|
title: title,
|
||||||
});
|
}));
|
||||||
|
} else {
|
||||||
|
({ header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForCustom({
|
||||||
|
module: template,
|
||||||
|
customTemplate,
|
||||||
|
headerData: data,
|
||||||
|
bodyData: data,
|
||||||
|
footerData: data,
|
||||||
|
title: title,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
headless: true,
|
headless: true,
|
||||||
|
|
|
@ -6,7 +6,13 @@ import { FileSystemHelper } from "./fileSystemHelper";
|
||||||
|
|
||||||
export abstract class TemplateHelper {
|
export abstract class TemplateHelper {
|
||||||
static getTemplateFromFile(template: string) {
|
static getTemplateFromFile(template: string) {
|
||||||
return FileSystemHelper.readTemplateFile(`/src/templates/${template}.template.html`);
|
let tmpFile;
|
||||||
|
try {
|
||||||
|
tmpFile = FileSystemHelper.readTemplateFile(`/src/templates/${template}.template.html`);
|
||||||
|
} catch (err) {
|
||||||
|
tmpFile = FileSystemHelper.readTemplateFile(`/src/templates/${template.split(".")[1]}.template.html`);
|
||||||
|
}
|
||||||
|
return tmpFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getTemplateFromStore(templateId: number): Promise<string> {
|
static async getTemplateFromStore(templateId: number): Promise<string> {
|
||||||
|
@ -56,14 +62,14 @@ export abstract class TemplateHelper {
|
||||||
} else {
|
} else {
|
||||||
footer = this.getTemplateFromFile(module + ".footer");
|
footer = this.getTemplateFromFile(module + ".footer");
|
||||||
}
|
}
|
||||||
footer = this.applyDataToTemplate(footer, footerData);
|
footer = this.applyDataToTemplate(footer, { title, ...footerData });
|
||||||
|
|
||||||
if (moduleTemplate.bodyId) {
|
if (moduleTemplate.bodyId) {
|
||||||
body = await this.getTemplateFromStore(moduleTemplate.bodyId);
|
body = await this.getTemplateFromStore(moduleTemplate.bodyId);
|
||||||
} else {
|
} else {
|
||||||
body = this.getTemplateFromFile(module + ".body");
|
body = this.getTemplateFromFile(module + ".body");
|
||||||
}
|
}
|
||||||
body = this.applyDataToTemplate(body, bodyData);
|
body = this.applyDataToTemplate(body, { title, ...bodyData });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
header,
|
header,
|
||||||
|
@ -73,4 +79,57 @@ export abstract class TemplateHelper {
|
||||||
footerMargin: moduleTemplate.footerHeight,
|
footerMargin: moduleTemplate.footerHeight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async renderFileForCustom({
|
||||||
|
module,
|
||||||
|
title = "pdf-export FF Admin",
|
||||||
|
headerData = {},
|
||||||
|
bodyData = {},
|
||||||
|
footerData = {},
|
||||||
|
customTemplate,
|
||||||
|
}: {
|
||||||
|
module: `${PermissionModule}` | `${PermissionModule}.${string}`;
|
||||||
|
title?: string;
|
||||||
|
headerData?: any;
|
||||||
|
bodyData?: any;
|
||||||
|
footerData?: any;
|
||||||
|
customTemplate: {
|
||||||
|
headerId?: number;
|
||||||
|
footerId?: number;
|
||||||
|
bodyId?: string | number;
|
||||||
|
headerHeight: number;
|
||||||
|
footerHeight: number;
|
||||||
|
};
|
||||||
|
}): Promise<{ header: string; body: string; footer: string; headerMargin?: number; footerMargin?: number }> {
|
||||||
|
let header = `<h1 style="font-size:10px; text-align:center; width:100%;">${title}</h1>`;
|
||||||
|
let footer = "";
|
||||||
|
let body = "";
|
||||||
|
|
||||||
|
if (customTemplate.headerId) {
|
||||||
|
header = await this.getTemplateFromStore(customTemplate.headerId);
|
||||||
|
header = this.applyDataToTemplate(header, { title, ...headerData });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (customTemplate.footerId) {
|
||||||
|
footer = await this.getTemplateFromStore(customTemplate.footerId);
|
||||||
|
} else {
|
||||||
|
footer = this.getTemplateFromFile(module + ".footer");
|
||||||
|
}
|
||||||
|
footer = this.applyDataToTemplate(footer, { title, ...footerData });
|
||||||
|
|
||||||
|
if (customTemplate.bodyId && typeof customTemplate.bodyId == "number") {
|
||||||
|
body = await this.getTemplateFromStore(customTemplate.bodyId);
|
||||||
|
} else {
|
||||||
|
body = this.getTemplateFromFile((customTemplate.bodyId || module) + ".body");
|
||||||
|
}
|
||||||
|
body = this.applyDataToTemplate(body, { title, ...bodyData });
|
||||||
|
|
||||||
|
return {
|
||||||
|
header,
|
||||||
|
footer,
|
||||||
|
body,
|
||||||
|
headerMargin: customTemplate.headerHeight,
|
||||||
|
footerMargin: customTemplate.footerHeight,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import "dotenv/config";
|
import "dotenv/config";
|
||||||
|
import "./handlebars.config";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
import { BACKUP_AUTO_RESTORE, configCheck, SERVER_PORT } from "./env.defaults";
|
import { BACKUP_AUTO_RESTORE, configCheck, SERVER_PORT } from "./env.defaults";
|
||||||
|
|
55
src/migrations/1742549956787-templatesAndProtocolSort.ts
Normal file
55
src/migrations/1742549956787-templatesAndProtocolSort.ts
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||||
|
import { templateUsage } from "../entity/configuration/templateUsage";
|
||||||
|
import { getTypeByORM, getDefaultByORM } from "./ormHelper";
|
||||||
|
|
||||||
|
export class TemplatesAndProtocolSort1742549956787 implements MigrationInterface {
|
||||||
|
name = "TemplatesAndProtocolSort1742549956787";
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(templateUsage)
|
||||||
|
.values([{ scope: "member" }])
|
||||||
|
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.delete()
|
||||||
|
.from(templateUsage)
|
||||||
|
.where({ scope: "member.list" })
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_agenda",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_decision",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_voting",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.dropColumn("protocol_agenda", "sort");
|
||||||
|
await queryRunner.dropColumn("protocol_decision", "sort");
|
||||||
|
await queryRunner.dropColumn("protocol_voting", "sort");
|
||||||
|
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(templateUsage)
|
||||||
|
.values([{ scope: "member.list" }])
|
||||||
|
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.manager.createQueryBuilder().delete().from(templateUsage).where({ scope: "member" }).execute();
|
||||||
|
}
|
||||||
|
}
|
10
src/routes/admin/club/listprint.ts
Normal file
10
src/routes/admin/club/listprint.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import express, { Request, Response } from "express";
|
||||||
|
import { printListByQueryAndTemplate } from "../../../controller/admin/club/listprintController";
|
||||||
|
|
||||||
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
|
await printListByQueryAndTemplate(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
|
@ -6,7 +6,6 @@ import {
|
||||||
addMembershipToMember,
|
addMembershipToMember,
|
||||||
addQualificationToMember,
|
addQualificationToMember,
|
||||||
createMember,
|
createMember,
|
||||||
createMemberPrintoutList,
|
|
||||||
deleteAwardOfMember,
|
deleteAwardOfMember,
|
||||||
deleteCommunicationOfMember,
|
deleteCommunicationOfMember,
|
||||||
deleteExecutivePositionOfMember,
|
deleteExecutivePositionOfMember,
|
||||||
|
@ -21,6 +20,7 @@ import {
|
||||||
getExecutivePositionByMemberAndRecord,
|
getExecutivePositionByMemberAndRecord,
|
||||||
getExecutivePositionsByMember,
|
getExecutivePositionsByMember,
|
||||||
getMemberById,
|
getMemberById,
|
||||||
|
getMemberPrintoutById,
|
||||||
getMembersByIds,
|
getMembersByIds,
|
||||||
getMembershipByMemberAndRecord,
|
getMembershipByMemberAndRecord,
|
||||||
getMembershipsByMember,
|
getMembershipsByMember,
|
||||||
|
@ -55,8 +55,8 @@ router.get("/:id/statistics", async (req: Request, res: Response) => {
|
||||||
await getMemberStatisticsById(req, res);
|
await getMemberStatisticsById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/print/namelist", async (req: Request, res: Response) => {
|
router.get("/:id/print", async (req: Request, res: Response) => {
|
||||||
await createMemberPrintoutList(req, res);
|
await getMemberPrintoutById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/:memberId/memberships", async (req: Request, res: Response) => {
|
router.get("/:memberId/memberships", async (req: Request, res: Response) => {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import protocol from "./club/protocol";
|
||||||
import calendar from "./club/calendar";
|
import calendar from "./club/calendar";
|
||||||
import queryBuilder from "./club/queryBuilder";
|
import queryBuilder from "./club/queryBuilder";
|
||||||
import newsletter from "./club/newsletter";
|
import newsletter from "./club/newsletter";
|
||||||
|
import listprint from "./club/listprint";
|
||||||
|
|
||||||
import role from "./management/role";
|
import role from "./management/role";
|
||||||
import user from "./management/user";
|
import user from "./management/user";
|
||||||
|
@ -84,7 +85,14 @@ router.use(
|
||||||
]),
|
]),
|
||||||
calendarType
|
calendarType
|
||||||
);
|
);
|
||||||
router.use("/querystore", PermissionHelper.passCheckMiddleware("read", "configuration", "query_store"), queryStore);
|
router.use(
|
||||||
|
"/querystore",
|
||||||
|
PermissionHelper.passCheckSomeMiddleware([
|
||||||
|
{ requiredPermissions: "read", section: "configuration", module: "query_store" },
|
||||||
|
{ requiredPermissions: "read", section: "club", module: "listprint" },
|
||||||
|
]),
|
||||||
|
queryStore
|
||||||
|
);
|
||||||
router.use("/template", PermissionHelper.passCheckMiddleware("read", "configuration", "template"), template);
|
router.use("/template", PermissionHelper.passCheckMiddleware("read", "configuration", "template"), template);
|
||||||
router.use(
|
router.use(
|
||||||
"/templateusage",
|
"/templateusage",
|
||||||
|
@ -132,6 +140,7 @@ router.use(
|
||||||
]),
|
]),
|
||||||
newsletter
|
newsletter
|
||||||
);
|
);
|
||||||
|
router.use("/listprint", PermissionHelper.passCheckMiddleware("read", "club", "listprint"), listprint);
|
||||||
|
|
||||||
router.use("/role", PermissionHelper.passCheckMiddleware("read", "management", "role"), role);
|
router.use("/role", PermissionHelper.passCheckMiddleware("read", "management", "role"), role);
|
||||||
router.use(
|
router.use(
|
||||||
|
|
|
@ -39,4 +39,22 @@ export default abstract class ProtocolAgendaService {
|
||||||
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
|
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get count of exisiting protocolAgenda by protocolId
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async getInstanceCount(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.getRepository(protocolAgenda)
|
||||||
|
.createQueryBuilder("protocolAgenda")
|
||||||
|
.where({ protocolId })
|
||||||
|
.getCount()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("COUNT", "protocolAgenda", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,4 +39,22 @@ export default abstract class ProtocolDecisionService {
|
||||||
throw new DatabaseActionException("SELECT", "protocolDecision", err);
|
throw new DatabaseActionException("SELECT", "protocolDecision", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get count of exisiting protocolDecision by protocolId
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async getInstanceCount(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.getRepository(protocolDecision)
|
||||||
|
.createQueryBuilder("protocolDecisions")
|
||||||
|
.where({ protocolId })
|
||||||
|
.getCount()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("COUNT", "protocolDecision", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,4 +39,22 @@ export default abstract class ProtocolVotingService {
|
||||||
throw new DatabaseActionException("SELECT", "protocolVoting", err);
|
throw new DatabaseActionException("SELECT", "protocolVoting", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get count of exisiting protocolVoting by protocolId
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async getInstanceCount(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.getRepository(protocolVoting)
|
||||||
|
.createQueryBuilder("protocolVotings")
|
||||||
|
.where({ protocolId })
|
||||||
|
.getCount()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("COUNT", "protocolVoting", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
48
src/templates/listprint.body.template.html
Normal file
48
src/templates/listprint.body.template.html
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Listen-Druck</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
<p>Ausdruck Stand {{longdate today}}</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<table style="width: 100%">
|
||||||
|
{{#each list}}
|
||||||
|
<tr>
|
||||||
|
<td style="width: 100%; padding: 10px 5px">{{json this}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
<style>
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
p,
|
||||||
|
span,
|
||||||
|
ul,
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2 {
|
||||||
|
color: #990b00;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table,
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</html>
|
|
@ -6,15 +6,16 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Mitgliederliste</h1>
|
<h1>Mitgliederliste</h1>
|
||||||
|
<p>Ausdruck Stand {{longdate today}}</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table style="width: 100%">
|
<table style="width: 100%">
|
||||||
{{#each member}}
|
{{#each list}}
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 35%; padding: 10px 5px">
|
<td style="width: 35%; padding: 10px 5px">
|
||||||
{{this.lastname}} {{this.firstname}}{{#if this.nameaffix}} - {{this.nameaffix}}{{/if}}
|
{{this.lastname}} {{this.firstname}}{{#if this.nameaffix}} - {{this.nameaffix}}{{/if}}
|
||||||
</th>
|
</td>
|
||||||
<th style="width: 65%; padding: 10px 0"></th>
|
<td style="width: 65%; padding: 10px 0"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
102
src/templates/member.body.template.html
Normal file
102
src/templates/member.body.template.html
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Mitglied</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
{{member.salutation.salutation}} {{member.lastname}}, {{member.firstname}}{{#if member.nameaffix}} -
|
||||||
|
{{member.nameaffix}}{{/if}}
|
||||||
|
</h1>
|
||||||
|
<p>Mitglieds-Ausdruck Stand {{longdate today}}</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>geboren: {{date member.birthdate}}</p>
|
||||||
|
<p>eingetreten: {{date member.firstMembershipEntry.start}}</p>
|
||||||
|
{{#if member.lastMembershipEntry?.end}}
|
||||||
|
<p>ausgetreten: {{date member.lastMembershipEntry.end}}</p>
|
||||||
|
{{/if}} {{#if memberships.length}}
|
||||||
|
<br />
|
||||||
|
<h2>Mitgliedschaften</h2>
|
||||||
|
{{#each memberships}}
|
||||||
|
<div>
|
||||||
|
<h3>{{this.status.status}}: {{date this.start}} bis {{#if this.end}}{{date this.end}}{{else}}heute{{/if}}</h3>
|
||||||
|
{{#if this.terminationReason}}
|
||||||
|
<p>beendet, weil:{{this.terminationReason}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
{{/each}} {{/if}} {{#if positions.length}}
|
||||||
|
<br />
|
||||||
|
<h2>Vereinsämter</h2>
|
||||||
|
{{#each positions}}
|
||||||
|
<div>
|
||||||
|
<h3>
|
||||||
|
{{this.executivePosition.position}}: {{date this.start}} bis {{#if this.end}}{{date
|
||||||
|
this.end}}{{else}}heute{{/if}}
|
||||||
|
</h3>
|
||||||
|
{{#if this.note}}
|
||||||
|
<p>Notiz: {{this.note}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
{{/each}} {{/if}} {{#if awards.length}}
|
||||||
|
<br />
|
||||||
|
<h2>Auszeichnungen</h2>
|
||||||
|
{{#each awards}}
|
||||||
|
<div>
|
||||||
|
<h3>{{this.award.award}}: {{date this.date}}</h3>
|
||||||
|
{{#if this.given}}
|
||||||
|
<p>wurde vergeben</p>
|
||||||
|
{{else}}
|
||||||
|
<p>wurde verwehrt / zurückgewiesen</p>
|
||||||
|
{{/if}} {{#if this.note}}
|
||||||
|
<p>Notiz: {{this.note}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
{{/each}} {{/if}} {{#if qualifications.length}}
|
||||||
|
<br />
|
||||||
|
<h2>Qualifikationen</h2>
|
||||||
|
{{#each qualifications}}
|
||||||
|
<div>
|
||||||
|
<h3>{{this.qualification.qualification}}: {{date this.date}}</h3>
|
||||||
|
{{#if this.terminationReason}}
|
||||||
|
<p>beendet, weil:{{this.terminationReason}}</p>
|
||||||
|
{{/if}} {{#if this.note}}
|
||||||
|
<p>Notiz: {{this.note}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
{{/each}} {{/if}}
|
||||||
|
</body>
|
||||||
|
<style>
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
p,
|
||||||
|
span,
|
||||||
|
ul,
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2 {
|
||||||
|
color: #990b00;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table,
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</html>
|
|
@ -1,3 +0,0 @@
|
||||||
<div style="font-size: 10px; text-align: center; width: 100%; color: #888">
|
|
||||||
Seite <span class="pageNumber"></span> von <span class="totalPages"></span>
|
|
||||||
</div>
|
|
|
@ -6,6 +6,7 @@ export type PermissionModule =
|
||||||
| "newsletter"
|
| "newsletter"
|
||||||
| "newsletter_config"
|
| "newsletter_config"
|
||||||
| "protocol"
|
| "protocol"
|
||||||
|
| "listprint"
|
||||||
| "qualification"
|
| "qualification"
|
||||||
| "award"
|
| "award"
|
||||||
| "executive_position"
|
| "executive_position"
|
||||||
|
@ -50,6 +51,7 @@ export const permissionModules: Array<PermissionModule> = [
|
||||||
"newsletter",
|
"newsletter",
|
||||||
"newsletter_config",
|
"newsletter_config",
|
||||||
"protocol",
|
"protocol",
|
||||||
|
"listprint",
|
||||||
"qualification",
|
"qualification",
|
||||||
"award",
|
"award",
|
||||||
"executive_position",
|
"executive_position",
|
||||||
|
@ -68,7 +70,7 @@ export const permissionModules: Array<PermissionModule> = [
|
||||||
];
|
];
|
||||||
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
||||||
export const sectionsAndModules: SectionsAndModulesObject = {
|
export const sectionsAndModules: SectionsAndModulesObject = {
|
||||||
club: ["member", "calendar", "newsletter", "protocol", "query"],
|
club: ["member", "calendar", "newsletter", "protocol", "query", "listprint"],
|
||||||
configuration: [
|
configuration: [
|
||||||
"qualification",
|
"qualification",
|
||||||
"award",
|
"award",
|
||||||
|
|
|
@ -2,5 +2,6 @@ export interface ProtocolAgendaViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
sort: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,6 @@ export interface ProtocolDecisionViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
sort: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,6 @@ export interface ProtocolVotingViewModel {
|
||||||
favour: number;
|
favour: number;
|
||||||
abstain: number;
|
abstain: number;
|
||||||
against: number;
|
against: number;
|
||||||
|
sort: number;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue