Compare commits
No commits in common. "d59f5b07675333406e50a62964bafa8c51547dba" and "0080728610ca9af4ee1e1d088b9379340ff998cd" have entirely different histories.
d59f5b0767
...
0080728610
42 changed files with 85 additions and 743 deletions
|
@ -2,6 +2,5 @@ export interface SynchronizeProtocolAgendaCommand {
|
||||||
id?: number;
|
id?: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
sort?: number;
|
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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 {
|
||||||
|
@ -12,7 +11,6 @@ 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()
|
||||||
|
@ -20,7 +18,6 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
sort: count,
|
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -43,7 +40,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolAgenda)
|
.into(protocolAgenda)
|
||||||
.values(syncProtocolAgenda)
|
.values(syncProtocolAgenda)
|
||||||
.orUpdate(["topic", "context", "sort"], ["id"])
|
.orUpdate(["topic", "context"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -2,6 +2,5 @@ export interface SynchronizeProtocolDecisionCommand {
|
||||||
id?: number;
|
id?: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
sort?: number;
|
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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 {
|
||||||
|
@ -12,7 +11,6 @@ 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()
|
||||||
|
@ -20,7 +18,6 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
sort: count,
|
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -42,7 +39,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolDecision)
|
.into(protocolDecision)
|
||||||
.values(syncProtocolDecisions)
|
.values(syncProtocolDecisions)
|
||||||
.orUpdate(["topic", "context", "sort"], ["id"])
|
.orUpdate(["topic", "context"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -5,6 +5,5 @@ export interface SynchronizeProtocolVotingCommand {
|
||||||
favour: number;
|
favour: number;
|
||||||
abstain: number;
|
abstain: number;
|
||||||
against: number;
|
against: number;
|
||||||
sort?: number;
|
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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 {
|
||||||
|
@ -12,7 +11,6 @@ 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()
|
||||||
|
@ -20,7 +18,6 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
topic: "",
|
topic: "",
|
||||||
context: "",
|
context: "",
|
||||||
sort: count,
|
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -42,7 +39,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
.insert()
|
.insert()
|
||||||
.into(protocolVoting)
|
.into(protocolVoting)
|
||||||
.values(syncProtocolVotings)
|
.values(syncProtocolVotings)
|
||||||
.orUpdate(["topic", "context", "favour", "abstain", "against", "sort"], ["id"])
|
.orUpdate(["topic", "context", "favour", "abstain", "against"], ["id"])
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
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,45 +118,6 @@ 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
|
||||||
|
@ -305,6 +266,33 @@ 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.sort((a, b) => a.sort - b.sort),
|
agenda,
|
||||||
decisions: decisions.sort((a, b) => a.sort - b.sort),
|
decisions,
|
||||||
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.sort((a, b) => a.sort - b.sort),
|
votings,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -320,7 +320,6 @@ 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,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -344,7 +343,6 @@ 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,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -364,14 +362,13 @@ 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(
|
||||||
(v: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
|
(d: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
|
||||||
id: v.id ?? null,
|
id: d.id ?? null,
|
||||||
topic: v.topic,
|
topic: d.topic,
|
||||||
context: v.context,
|
context: d.context,
|
||||||
favour: v.favour,
|
favour: d.favour,
|
||||||
abstain: v.abstain,
|
abstain: d.abstain,
|
||||||
against: v.abstain,
|
against: d.abstain,
|
||||||
sort: v.sort,
|
|
||||||
protocolId,
|
protocolId,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,7 +47,6 @@ 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,
|
||||||
|
@ -101,7 +100,7 @@ const dataSource = new DataSource({
|
||||||
webapi,
|
webapi,
|
||||||
webapiPermission,
|
webapiPermission,
|
||||||
],
|
],
|
||||||
migrations: [BackupAndResetDatabase1738166124200, CreateSchema1738166167472, TemplatesAndProtocolSort1742549956787],
|
migrations: [BackupAndResetDatabase1738166124200, CreateSchema1738166167472],
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrationsTransactionMode: "each",
|
migrationsTransactionMode: "each",
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
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: [] },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
13
src/demodata/member.list.data.ts
Normal file
13
src/demodata/member.list.data.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
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,9 +12,6 @@ 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,9 +12,6 @@ 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,9 +21,6 @@ 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,7 +12,6 @@ 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,7 +12,6 @@ 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,7 +15,6 @@ 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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
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", "agendas.sort"])
|
.addSelect(["agendas.topic", "agendas.context"])
|
||||||
.addSelect(["decisions.topic", "decisions.context", "decisions.sort"])
|
.addSelect(["decisions.topic", "decisions.context"])
|
||||||
.addSelect(["presences.absent", "presences.excused"])
|
.addSelect(["presences.absent", "presences.excused"])
|
||||||
.addSelect([
|
.addSelect([
|
||||||
...(collectIds ? ["member.id"] : []),
|
...(collectIds ? ["member.id"] : []),
|
||||||
|
@ -312,14 +312,7 @@ 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([
|
.addSelect(["votings.topic", "votings.context", "votings.favour", "votings.abstain", "votings.against"])
|
||||||
"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",
|
||||||
summary: "Erinnerung",
|
description: "Erinnerung",
|
||||||
trigger: {
|
trigger: {
|
||||||
minutes: 30,
|
minutes: 30,
|
||||||
before: true,
|
before: true,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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 { memberDemoData } from "../demodata/member.data";
|
import {memberlistDemoData} from "../demodata/member.list.data";
|
||||||
|
|
||||||
export abstract class DemoDataHelper {
|
export abstract class DemoDataHelper {
|
||||||
static getData(scope: `${PermissionModule}`|`${PermissionModule}.${string}`) {
|
static getData(scope: `${PermissionModule}`|`${PermissionModule}.${string}`) {
|
||||||
|
@ -10,8 +10,8 @@ export abstract class DemoDataHelper {
|
||||||
return protocolDemoData;
|
return protocolDemoData;
|
||||||
case "newsletter":
|
case "newsletter":
|
||||||
return newsletterDemoData;
|
return newsletterDemoData;
|
||||||
case "member":
|
case "member.list":
|
||||||
return memberDemoData;
|
return memberlistDemoData;
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,13 +314,6 @@ 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)) {
|
||||||
|
@ -337,7 +330,7 @@ export default abstract class DynamicQueryBuilder {
|
||||||
|
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.transaction(async (manager) => {
|
.transaction(async (manager) => {
|
||||||
data = await manager.query(query.toString());
|
data = await manager.query(query);
|
||||||
|
|
||||||
throw new Error("AllwaysRollbackQuery");
|
throw new Error("AllwaysRollbackQuery");
|
||||||
})
|
})
|
||||||
|
@ -389,29 +382,3 @@ 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,7 +12,6 @@ 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;
|
||||||
|
@ -20,35 +19,16 @@ 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);
|
||||||
|
|
||||||
let header: string, footer: string, body: string, headerMargin: number, footerMargin: number;
|
const { header, footer, body, headerMargin, footerMargin } = await TemplateHelper.renderFileForModule({
|
||||||
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,13 +6,7 @@ import { FileSystemHelper } from "./fileSystemHelper";
|
||||||
|
|
||||||
export abstract class TemplateHelper {
|
export abstract class TemplateHelper {
|
||||||
static getTemplateFromFile(template: string) {
|
static getTemplateFromFile(template: string) {
|
||||||
let tmpFile;
|
return FileSystemHelper.readTemplateFile(`/src/templates/${template}.template.html`);
|
||||||
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> {
|
||||||
|
@ -62,14 +56,14 @@ export abstract class TemplateHelper {
|
||||||
} else {
|
} else {
|
||||||
footer = this.getTemplateFromFile(module + ".footer");
|
footer = this.getTemplateFromFile(module + ".footer");
|
||||||
}
|
}
|
||||||
footer = this.applyDataToTemplate(footer, { title, ...footerData });
|
footer = this.applyDataToTemplate(footer, 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, { title, ...bodyData });
|
body = this.applyDataToTemplate(body, bodyData);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
header,
|
header,
|
||||||
|
@ -79,57 +73,4 @@ 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,5 +1,4 @@
|
||||||
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";
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
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,6 +6,7 @@ import {
|
||||||
addMembershipToMember,
|
addMembershipToMember,
|
||||||
addQualificationToMember,
|
addQualificationToMember,
|
||||||
createMember,
|
createMember,
|
||||||
|
createMemberPrintoutList,
|
||||||
deleteAwardOfMember,
|
deleteAwardOfMember,
|
||||||
deleteCommunicationOfMember,
|
deleteCommunicationOfMember,
|
||||||
deleteExecutivePositionOfMember,
|
deleteExecutivePositionOfMember,
|
||||||
|
@ -20,7 +21,6 @@ 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("/:id/print", async (req: Request, res: Response) => {
|
router.get("/print/namelist", async (req: Request, res: Response) => {
|
||||||
await getMemberPrintoutById(req, res);
|
await createMemberPrintoutList(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/:memberId/memberships", async (req: Request, res: Response) => {
|
router.get("/:memberId/memberships", async (req: Request, res: Response) => {
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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";
|
||||||
|
@ -85,14 +84,7 @@ router.use(
|
||||||
]),
|
]),
|
||||||
calendarType
|
calendarType
|
||||||
);
|
);
|
||||||
router.use(
|
router.use("/querystore", PermissionHelper.passCheckMiddleware("read", "configuration", "query_store"), queryStore);
|
||||||
"/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",
|
||||||
|
@ -140,7 +132,6 @@ 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,22 +39,4 @@ 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,22 +39,4 @@ 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,22 +39,4 @@ 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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
<!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>
|
|
|
@ -1,102 +0,0 @@
|
||||||
<!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>
|
|
|
@ -6,16 +6,15 @@
|
||||||
</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 list}}
|
{{#each member}}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 35%; padding: 10px 5px">
|
<th 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}}
|
||||||
</td>
|
</th>
|
||||||
<td style="width: 65%; padding: 10px 0"></td>
|
<th style="width: 65%; padding: 10px 0"></th>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
3
src/templates/protocol.footer.template.html
Normal file
3
src/templates/protocol.footer.template.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<div style="font-size: 10px; text-align: center; width: 100%; color: #888">
|
||||||
|
Seite <span class="pageNumber"></span> von <span class="totalPages"></span>
|
||||||
|
</div>
|
|
@ -6,7 +6,6 @@ export type PermissionModule =
|
||||||
| "newsletter"
|
| "newsletter"
|
||||||
| "newsletter_config"
|
| "newsletter_config"
|
||||||
| "protocol"
|
| "protocol"
|
||||||
| "listprint"
|
|
||||||
| "qualification"
|
| "qualification"
|
||||||
| "award"
|
| "award"
|
||||||
| "executive_position"
|
| "executive_position"
|
||||||
|
@ -51,7 +50,6 @@ export const permissionModules: Array<PermissionModule> = [
|
||||||
"newsletter",
|
"newsletter",
|
||||||
"newsletter_config",
|
"newsletter_config",
|
||||||
"protocol",
|
"protocol",
|
||||||
"listprint",
|
|
||||||
"qualification",
|
"qualification",
|
||||||
"award",
|
"award",
|
||||||
"executive_position",
|
"executive_position",
|
||||||
|
@ -70,7 +68,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", "listprint"],
|
club: ["member", "calendar", "newsletter", "protocol", "query"],
|
||||||
configuration: [
|
configuration: [
|
||||||
"qualification",
|
"qualification",
|
||||||
"award",
|
"award",
|
||||||
|
|
|
@ -2,6 +2,5 @@ export interface ProtocolAgendaViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
sort: number;
|
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,5 @@ export interface ProtocolDecisionViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
topic: string;
|
topic: string;
|
||||||
context: string;
|
context: string;
|
||||||
sort: number;
|
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,5 @@ 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