diff --git a/.dockerignore b/.dockerignore index 9ede668..4b56232 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,5 +2,5 @@ node_modules/ dist/ .git/ -files/ +export/ .env \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7efd6b5..89904f3 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,6 @@ dist .yarn/install-state.gz .pnp.* -files +export .idea \ No newline at end of file diff --git a/README.md b/README.md index e146e48..670a481 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ services: - CLUB_NAME= - CLUB_WEBSITE= volumes: - - :/app/files + - :/app/export networks: - ff_internal depends_on: diff --git a/src/command/settings/award/awardCommand.ts b/src/command/awardCommand.ts similarity index 100% rename from src/command/settings/award/awardCommand.ts rename to src/command/awardCommand.ts diff --git a/src/command/settings/award/awardCommandHandler.ts b/src/command/awardCommandHandler.ts similarity index 76% rename from src/command/settings/award/awardCommandHandler.ts rename to src/command/awardCommandHandler.ts index af0000f..b862e7b 100644 --- a/src/command/settings/award/awardCommandHandler.ts +++ b/src/command/awardCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { award } from "../../../entity/settings/award"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { award } from "../entity/award"; +import InternalException from "../exceptions/internalException"; import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand"; export default abstract class AwardCommandHandler { /** * @description create award - * @param {CreateAwardCommand} createAward + * @param CreateAwardCommand * @returns {Promise} */ static async create(createAward: CreateAwardCommand): Promise { @@ -28,7 +28,7 @@ export default abstract class AwardCommandHandler { /** * @description update award - * @param {UpdateAwardCommand} updateAward + * @param UpdateAwardCommand * @returns {Promise} */ static async update(updateAward: UpdateAwardCommand): Promise { @@ -48,15 +48,15 @@ export default abstract class AwardCommandHandler { /** * @description delete award - * @param {DeleteAwardCommand} deleteAward + * @param DeleteAwardCommand * @returns {Promise} */ - static async delete(deleteAward: DeleteAwardCommand): Promise { + static async delete(deletAward: DeleteAwardCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(award) - .where("id = :id", { id: deleteAward.id }) + .where("id = :id", { id: deletAward.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/club/calendar/calendarCommand.ts b/src/command/calendarCommand.ts similarity index 100% rename from src/command/club/calendar/calendarCommand.ts rename to src/command/calendarCommand.ts diff --git a/src/command/club/calendar/calendarCommandHandler.ts b/src/command/calendarCommandHandler.ts similarity index 87% rename from src/command/club/calendar/calendarCommandHandler.ts rename to src/command/calendarCommandHandler.ts index 5cd89b6..9592347 100644 --- a/src/command/club/calendar/calendarCommandHandler.ts +++ b/src/command/calendarCommandHandler.ts @@ -1,13 +1,13 @@ -import { dataSource } from "../../../data-source"; -import { calendar } from "../../../entity/club/calendar"; -import { calendarType } from "../../../entity/settings/calendarType"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { calendar } from "../entity/calendar"; +import { calendarType } from "../entity/calendarType"; +import InternalException from "../exceptions/internalException"; import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand"; export default abstract class CalendarCommandHandler { /** * @description create calendar - * @param {CreateCalendarCommand} createCalendar + * @param CreateCalendarCommand * @returns {Promise} */ static async create(createCalendar: CreateCalendarCommand): Promise { @@ -39,7 +39,7 @@ export default abstract class CalendarCommandHandler { /** * @description update calendar - * @param {UpdateCalendarCommand} updateCalendar + * @param UpdateCalendarCommand * @returns {Promise} */ static async update(updateCalendar: UpdateCalendarCommand): Promise { @@ -78,7 +78,7 @@ export default abstract class CalendarCommandHandler { /** * @description delete calendar - * @param {DeleteCalendarCommand} deleteCalendar + * @param DeleteCalendarCommand * @returns {Promise} */ static async delete(deleteCalendar: DeleteCalendarCommand): Promise { diff --git a/src/command/settings/calendarType/calendarTypeCommand.ts b/src/command/calendarTypeCommand.ts similarity index 100% rename from src/command/settings/calendarType/calendarTypeCommand.ts rename to src/command/calendarTypeCommand.ts diff --git a/src/command/settings/calendarType/calendarTypeCommandHandler.ts b/src/command/calendarTypeCommandHandler.ts similarity index 84% rename from src/command/settings/calendarType/calendarTypeCommandHandler.ts rename to src/command/calendarTypeCommandHandler.ts index bc20d6a..223288c 100644 --- a/src/command/settings/calendarType/calendarTypeCommandHandler.ts +++ b/src/command/calendarTypeCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { calendarType } from "../../../entity/settings/calendarType"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { calendarType } from "../entity/calendarType"; +import InternalException from "../exceptions/internalException"; import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand"; export default abstract class CalendarTypeCommandHandler { /** * @description create calendarType - * @param {CreateCalendarTypeCommand} createCalendarType + * @param CreateCalendarTypeCommand * @returns {Promise} */ static async create(createCalendarType: CreateCalendarTypeCommand): Promise { @@ -31,7 +31,7 @@ export default abstract class CalendarTypeCommandHandler { /** * @description update calendarType - * @param {UpdateCalendarTypeCommand} updateCalendarType + * @param UpdateCalendarTypeCommand * @returns {Promise} */ static async update(updateCalendarType: UpdateCalendarTypeCommand): Promise { @@ -54,7 +54,7 @@ export default abstract class CalendarTypeCommandHandler { /** * @description delete calendarType - * @param {DeleteCalendarTypeCommand} deleteCalendarType + * @param DeleteCalendarTypeCommand * @returns {Promise} */ static async delete(deleteCalendarType: DeleteCalendarTypeCommand): Promise { diff --git a/src/command/club/protocol/protocolPresenceCommand.ts b/src/command/club/protocol/protocolPresenceCommand.ts deleted file mode 100644 index 76c004a..0000000 --- a/src/command/club/protocol/protocolPresenceCommand.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface SynchronizeProtocolPresenceCommand { - members: Array; - protocolId: number; -} - -export interface ProtocolPresenceCommand { - memberId: number; - absent: boolean; -} diff --git a/src/command/club/protocol/protocolPresenceCommandHandler.ts b/src/command/club/protocol/protocolPresenceCommandHandler.ts deleted file mode 100644 index abdb82b..0000000 --- a/src/command/club/protocol/protocolPresenceCommandHandler.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { DeleteResult, EntityManager, InsertResult, UpdateResult } from "typeorm"; -import { dataSource } from "../../../data-source"; -import { protocolPresence } from "../../../entity/club/protocol/protocolPresence"; -import InternalException from "../../../exceptions/internalException"; -import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService"; -import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand"; - -export default abstract class ProtocolPresenceCommandHandler { - /** - * @description sync protocolPresence - * @param {SynchronizeProtocolPresenceCommand} syncProtocolPresences - * @returns {Promise} - */ - static async sync(syncProtocolPresences: SynchronizeProtocolPresenceCommand): Promise { - let currentPresence = await ProtocolPresenceService.getAll(syncProtocolPresences.protocolId); - - return await dataSource.manager - .transaction(async (manager) => { - let newMembers = syncProtocolPresences.members.filter( - (r) => !currentPresence.some((cp) => cp.memberId == r.memberId) - ); - let removeMembers = currentPresence.filter( - (r) => !syncProtocolPresences.members.some((cp) => cp.memberId == r.memberId) - ); - let keptMembers = syncProtocolPresences.members.filter( - (m) => - currentPresence.some((cd) => cd.memberId == m.memberId) && - !removeMembers.some((cd) => cd.memberId == m.memberId) - ); - - if (newMembers.length != 0) { - await this.syncPresenceAdd(manager, syncProtocolPresences.protocolId, newMembers); - } - - if (removeMembers.length != 0) { - await this.syncPresenceRemove(manager, syncProtocolPresences.protocolId, removeMembers); - } - - for (const member of keptMembers) { - await this.syncPresenceUpdate(manager, syncProtocolPresences.protocolId, member); - } - }) - .then(() => {}) - .catch((err) => { - throw new InternalException("Failed saving protocol presence", err); - }); - } - - private static async syncPresenceAdd( - manager: EntityManager, - protocolId: number, - memberIds: Array - ): Promise { - return await manager - .createQueryBuilder() - .insert() - .into(protocolPresence) - .values( - memberIds.map((m) => ({ - ...m, - protocolId, - })) - ) - .execute(); - } - - private static async syncPresenceUpdate( - manager: EntityManager, - protocolId: number, - member: ProtocolPresenceCommand - ): Promise { - return await manager - .createQueryBuilder() - .update(protocolPresence) - .set({ - absent: member.absent, - }) - .where("memberId = :memberId", { memberId: member.memberId }) - .andWhere("protocolId = :protocolId", { protocolId }) - .execute(); - } - - private static async syncPresenceRemove( - manager: EntityManager, - protocolId: number, - members: Array - ): Promise { - return await manager - .createQueryBuilder() - .delete() - .from(protocolPresence) - .where("memberId IN (:...ids)", { ids: members.map((m) => m.memberId) }) - .andWhere("protocolId = :protocolId", { protocolId }) - .execute(); - } -} diff --git a/src/command/club/member/communicationCommand.ts b/src/command/communicationCommand.ts similarity index 100% rename from src/command/club/member/communicationCommand.ts rename to src/command/communicationCommand.ts diff --git a/src/command/club/member/communicationCommandHandler.ts b/src/command/communicationCommandHandler.ts similarity index 87% rename from src/command/club/member/communicationCommandHandler.ts rename to src/command/communicationCommandHandler.ts index ad6341c..9d18cc9 100644 --- a/src/command/club/member/communicationCommandHandler.ts +++ b/src/command/communicationCommandHandler.ts @@ -1,6 +1,8 @@ -import { dataSource } from "../../../data-source"; -import { communication } from "../../../entity/club/member/communication"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { communication } from "../entity/communication"; +import { communicationType } from "../entity/communicationType"; +import { user } from "../entity/user"; +import InternalException from "../exceptions/internalException"; import { CreateCommunicationCommand, DeleteCommunicationCommand, @@ -10,7 +12,7 @@ import { export default abstract class CommunicationCommandHandler { /** * @description create communication - * @param {CreateCommunicationCommand} createCommunication + * @param CreateCommunicationCommand * @returns {Promise} */ static async create(createCommunication: CreateCommunicationCommand): Promise { @@ -42,7 +44,7 @@ export default abstract class CommunicationCommandHandler { /** * @description update communication - * @param {UpdateCommunicationCommand} updateCommunication + * @param UpdateCommunicationCommand * @returns {Promise} */ static async update(updateCommunication: UpdateCommunicationCommand): Promise { @@ -71,7 +73,7 @@ export default abstract class CommunicationCommandHandler { /** * @description delete communication - * @param {DeleteCommunicationCommand} deleteCommunication + * @param DeleteCommunicationCommand * @returns {Promise} */ static async delete(deleteCommunication: DeleteCommunicationCommand): Promise { diff --git a/src/command/settings/communicationType/communicationTypeCommand.ts b/src/command/communicationTypeCommand.ts similarity index 82% rename from src/command/settings/communicationType/communicationTypeCommand.ts rename to src/command/communicationTypeCommand.ts index 8451cc9..fdc686e 100644 --- a/src/command/settings/communicationType/communicationTypeCommand.ts +++ b/src/command/communicationTypeCommand.ts @@ -1,4 +1,4 @@ -import { CommunicationFieldType } from "../../../type/fieldTypes"; +import { CommunicationFieldType } from "../type/fieldTypes"; export interface CreateCommunicationTypeCommand { type: string; diff --git a/src/command/settings/communicationType/communicationTypeCommandHandler.ts b/src/command/communicationTypeCommandHandler.ts similarity index 76% rename from src/command/settings/communicationType/communicationTypeCommandHandler.ts rename to src/command/communicationTypeCommandHandler.ts index 04c7f10..2b4a1be 100644 --- a/src/command/settings/communicationType/communicationTypeCommandHandler.ts +++ b/src/command/communicationTypeCommandHandler.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { communicationType } from "../../../entity/settings/communicationType"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { communicationType } from "../entity/communicationType"; +import InternalException from "../exceptions/internalException"; import { CreateCommunicationTypeCommand, DeleteCommunicationTypeCommand, @@ -10,7 +10,7 @@ import { export default abstract class CommunicationTypeCommandHandler { /** * @description create communicationType - * @param {CreateCommunicationTypeCommand} createCommunicationType + * @param CreateCommunicationTypeCommand * @returns {Promise} */ static async create(createCommunicationType: CreateCommunicationTypeCommand): Promise { @@ -33,7 +33,7 @@ export default abstract class CommunicationTypeCommandHandler { /** * @description update communicationType - * @param {UpdateCommunicationTypeCommand} updateCommunicationType + * @param UpdateCommunicationTypeCommand * @returns {Promise} */ static async update(updateCommunicationType: UpdateCommunicationTypeCommand): Promise { @@ -54,15 +54,15 @@ export default abstract class CommunicationTypeCommandHandler { /** * @description delete communicationType - * @param {DeleteCommunicationTypeCommand} deleteCommunicationType + * @param DeleteCommunicationTypeCommand * @returns {Promise} */ - static async delete(deleteCommunicationType: DeleteCommunicationTypeCommand): Promise { + static async delete(deletCommunicationType: DeleteCommunicationTypeCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(communicationType) - .where("id = :id", { id: deleteCommunicationType.id }) + .where("id = :id", { id: deletCommunicationType.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/settings/executivePosition/executivePositionCommand.ts b/src/command/executivePositionCommand.ts similarity index 100% rename from src/command/settings/executivePosition/executivePositionCommand.ts rename to src/command/executivePositionCommand.ts diff --git a/src/command/settings/executivePosition/executivePositionCommandHandler.ts b/src/command/executivePositionCommandHandler.ts similarity index 74% rename from src/command/settings/executivePosition/executivePositionCommandHandler.ts rename to src/command/executivePositionCommandHandler.ts index d1be38d..e607dd7 100644 --- a/src/command/settings/executivePosition/executivePositionCommandHandler.ts +++ b/src/command/executivePositionCommandHandler.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { executivePosition } from "../../../entity/settings/executivePosition"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { executivePosition } from "../entity/executivePosition"; +import InternalException from "../exceptions/internalException"; import { CreateExecutivePositionCommand, DeleteExecutivePositionCommand, @@ -10,7 +10,7 @@ import { export default abstract class ExecutivePositionCommandHandler { /** * @description create executivePosition - * @param {CreateExecutivePositionCommand} createExecutivePosition + * @param CreateExecutivePositionCommand * @returns {Promise} */ static async create(createExecutivePosition: CreateExecutivePositionCommand): Promise { @@ -32,7 +32,7 @@ export default abstract class ExecutivePositionCommandHandler { /** * @description update executivePosition - * @param {UpdateExecutivePositionCommand} updateExecutivePosition + * @param UpdateExecutivePositionCommand * @returns {Promise} */ static async update(updateExecutivePosition: UpdateExecutivePositionCommand): Promise { @@ -52,15 +52,15 @@ export default abstract class ExecutivePositionCommandHandler { /** * @description delete executivePosition - * @param {DeleteExecutivePositionCommand} deleteExecutivePosition + * @param DeleteExecutivePositionCommand * @returns {Promise} */ - static async delete(deleteExecutivePosition: DeleteExecutivePositionCommand): Promise { + static async delete(deletExecutivePosition: DeleteExecutivePositionCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(executivePosition) - .where("id = :id", { id: deleteExecutivePosition.id }) + .where("id = :id", { id: deletExecutivePosition.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/user/user/inviteCommand.ts b/src/command/inviteCommand.ts similarity index 100% rename from src/command/user/user/inviteCommand.ts rename to src/command/inviteCommand.ts diff --git a/src/command/user/user/inviteCommandHandler.ts b/src/command/inviteCommandHandler.ts similarity index 89% rename from src/command/user/user/inviteCommandHandler.ts rename to src/command/inviteCommandHandler.ts index 61c6149..468247b 100644 --- a/src/command/user/user/inviteCommandHandler.ts +++ b/src/command/inviteCommandHandler.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../../data-source"; -import { invite } from "../../../entity/user/invite"; -import InternalException from "../../../exceptions/internalException"; -import { StringHelper } from "../../../helpers/stringHelper"; +import { dataSource } from "../data-source"; +import { invite } from "../entity/invite"; +import InternalException from "../exceptions/internalException"; +import { StringHelper } from "../helpers/stringHelper"; import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand"; export default abstract class InviteCommandHandler { diff --git a/src/command/club/member/memberAwardCommand.ts b/src/command/memberAwardCommand.ts similarity index 100% rename from src/command/club/member/memberAwardCommand.ts rename to src/command/memberAwardCommand.ts diff --git a/src/command/club/member/memberAwardCommandHandler.ts b/src/command/memberAwardCommandHandler.ts similarity index 76% rename from src/command/club/member/memberAwardCommandHandler.ts rename to src/command/memberAwardCommandHandler.ts index 0a02e01..775f55d 100644 --- a/src/command/club/member/memberAwardCommandHandler.ts +++ b/src/command/memberAwardCommandHandler.ts @@ -1,12 +1,14 @@ -import { dataSource } from "../../../data-source"; -import { memberAwards } from "../../../entity/club/member/memberAwards"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { award } from "../entity/award"; +import { member } from "../entity/member"; +import { memberAwards } from "../entity/memberAwards"; +import InternalException from "../exceptions/internalException"; import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand"; export default abstract class MemberAwardCommandHandler { /** * @description create memberAward - * @param {CreateMemberAwardCommand} createMemberAward + * @param CreateMemberAwardCommand * @returns {Promise} */ static async create(createMemberAward: CreateMemberAwardCommand): Promise { @@ -32,7 +34,7 @@ export default abstract class MemberAwardCommandHandler { /** * @description update memberAward - * @param {UpdateMemberAwardCommand} updateMemberAward + * @param UpdateMemberAwardCommand * @returns {Promise} */ static async update(updateMemberAward: UpdateMemberAwardCommand): Promise { @@ -56,16 +58,16 @@ export default abstract class MemberAwardCommandHandler { /** * @description delete memberAward - * @param {DeleteMemberAwardCommand} deleteMemberAward + * @param DeleteMemberAwardCommand * @returns {Promise} */ - static async delete(deleteMemberAward: DeleteMemberAwardCommand): Promise { + static async delete(deletMemberAward: DeleteMemberAwardCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(memberAwards) - .where("id = :id", { id: deleteMemberAward.id }) - .andWhere("memberId = :memberId", { memberId: deleteMemberAward.memberId }) + .where("id = :id", { id: deletMemberAward.id }) + .andWhere("memberId = :memberId", { memberId: deletMemberAward.memberId }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/club/member/memberCommand.ts b/src/command/memberCommand.ts similarity index 90% rename from src/command/club/member/memberCommand.ts rename to src/command/memberCommand.ts index a05e284..a40de21 100644 --- a/src/command/club/member/memberCommand.ts +++ b/src/command/memberCommand.ts @@ -1,4 +1,4 @@ -import { Salutation } from "../../../enums/salutation"; +import { Salutation } from "../enums/salutation"; export interface CreateMemberCommand { salutation: Salutation; diff --git a/src/command/club/member/memberCommandHandler.ts b/src/command/memberCommandHandler.ts similarity index 87% rename from src/command/club/member/memberCommandHandler.ts rename to src/command/memberCommandHandler.ts index 8d8e65b..767a01f 100644 --- a/src/command/club/member/memberCommandHandler.ts +++ b/src/command/memberCommandHandler.ts @@ -1,7 +1,8 @@ -import { dataSource } from "../../../data-source"; -import { communication } from "../../../entity/club/member/communication"; -import { member } from "../../../entity/club/member/member"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { communication } from "../entity/communication"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; +import CommunicationService from "../service/communicationService"; import { CreateMemberCommand, DeleteMemberCommand, @@ -12,7 +13,7 @@ import { export default abstract class MemberCommandHandler { /** * @description create member - * @param {CreateMemberCommand} createMember + * @param CreateMemberCommand * @returns {Promise} */ static async create(createMember: CreateMemberCommand): Promise { @@ -39,7 +40,7 @@ export default abstract class MemberCommandHandler { /** * @description update member - * @param {UpdateMemberCommand} updateMember + * @param UpdateMemberCommand * @returns {Promise} */ static async update(updateMember: UpdateMemberCommand): Promise { @@ -65,7 +66,7 @@ export default abstract class MemberCommandHandler { /** * @description update member newsletter - * @param {UpdateMemberCommand} updateMember + * @param UpdateMemberCommand * @returns {Promise} */ static async updateNewsletter(updateMember: UpdateMemberNewsletterCommand): Promise { @@ -90,7 +91,7 @@ export default abstract class MemberCommandHandler { /** * @description update member newsletter to unset - * @param {number} memberId + * @param memberId string * @returns {Promise} */ static async unsetNewsletter(memberId: number): Promise { @@ -110,7 +111,7 @@ export default abstract class MemberCommandHandler { /** * @description delete member - * @param {DeleteMemberCommand} deleteMember + * @param DeleteMemberCommand * @returns {Promise} */ static async delete(deleteMember: DeleteMemberCommand): Promise { diff --git a/src/command/club/member/memberExecutivePositionCommand.ts b/src/command/memberExecutivePositionCommand.ts similarity index 100% rename from src/command/club/member/memberExecutivePositionCommand.ts rename to src/command/memberExecutivePositionCommand.ts diff --git a/src/command/club/member/memberExecutivePositionCommandHandler.ts b/src/command/memberExecutivePositionCommandHandler.ts similarity index 76% rename from src/command/club/member/memberExecutivePositionCommandHandler.ts rename to src/command/memberExecutivePositionCommandHandler.ts index f683541..3d36a14 100644 --- a/src/command/club/member/memberExecutivePositionCommandHandler.ts +++ b/src/command/memberExecutivePositionCommandHandler.ts @@ -1,6 +1,8 @@ -import { dataSource } from "../../../data-source"; -import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { executivePosition } from "../entity/executivePosition"; +import { member } from "../entity/member"; +import { memberExecutivePositions } from "../entity/memberExecutivePositions"; +import InternalException from "../exceptions/internalException"; import { CreateMemberExecutivePositionCommand, DeleteMemberExecutivePositionCommand, @@ -10,7 +12,7 @@ import { export default abstract class MemberExecutivePositionCommandHandler { /** * @description create memberExecutivePosition - * @param {CreateMemberExecutivePositionCommand} createMemberExecutivePosition + * @param CreateMemberExecutivePositionCommand * @returns {Promise} */ static async create(createMemberExecutivePosition: CreateMemberExecutivePositionCommand): Promise { @@ -36,7 +38,7 @@ export default abstract class MemberExecutivePositionCommandHandler { /** * @description update memberExecutivePosition - * @param {UpdateMemberExecutivePositionCommand} updateMemberExecutivePosition + * @param UpdateMemberExecutivePositionCommand * @returns {Promise} */ static async update(updateMemberExecutivePosition: UpdateMemberExecutivePositionCommand): Promise { @@ -60,16 +62,16 @@ export default abstract class MemberExecutivePositionCommandHandler { /** * @description delete memberExecutivePosition - * @param {DeleteMemberExecutivePositionCommand} deleteMemberExecutivePosition + * @param DeleteMemberExecutivePositionCommand * @returns {Promise} */ - static async delete(deleteMemberExecutivePosition: DeleteMemberExecutivePositionCommand): Promise { + static async delete(deletMemberExecutivePosition: DeleteMemberExecutivePositionCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(memberExecutivePositions) - .where("id = :id", { id: deleteMemberExecutivePosition.id }) - .andWhere("memberId = :memberId", { memberId: deleteMemberExecutivePosition.memberId }) + .where("id = :id", { id: deletMemberExecutivePosition.id }) + .andWhere("memberId = :memberId", { memberId: deletMemberExecutivePosition.memberId }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/club/member/memberQualificationCommand.ts b/src/command/memberQualificationCommand.ts similarity index 100% rename from src/command/club/member/memberQualificationCommand.ts rename to src/command/memberQualificationCommand.ts diff --git a/src/command/club/member/memberQualificationCommandHandler.ts b/src/command/memberQualificationCommandHandler.ts similarity index 76% rename from src/command/club/member/memberQualificationCommandHandler.ts rename to src/command/memberQualificationCommandHandler.ts index 351cfb6..7faad96 100644 --- a/src/command/club/member/memberQualificationCommandHandler.ts +++ b/src/command/memberQualificationCommandHandler.ts @@ -1,16 +1,18 @@ -import { dataSource } from "../../../data-source"; -import { memberQualifications } from "../../../entity/club/member/memberQualifications"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { qualification } from "../entity/qualification"; +import { memberQualifications } from "../entity/memberQualifications"; +import InternalException from "../exceptions/internalException"; import { CreateMemberQualificationCommand, DeleteMemberQualificationCommand, UpdateMemberQualificationCommand, } from "./memberQualificationCommand"; +import { member } from "../entity/member"; export default abstract class MemberQualificationCommandHandler { /** * @description create memberQualification - * @param {CreateMemberQualificationCommand} createMemberQualification + * @param CreateMemberQualificationCommand * @returns {Promise} */ static async create(createMemberQualification: CreateMemberQualificationCommand): Promise { @@ -35,7 +37,7 @@ export default abstract class MemberQualificationCommandHandler { /** * @description update memberQualification - * @param {UpdateMemberQualificationCommand} updateMemberQualification + * @param UpdateMemberQualificationCommand * @returns {Promise} */ static async update(updateMemberQualification: UpdateMemberQualificationCommand): Promise { @@ -60,16 +62,16 @@ export default abstract class MemberQualificationCommandHandler { /** * @description delete memberQualification - * @param {DeleteMemberQualificationCommand} deleteMemberQualification + * @param DeleteMemberQualificationCommand * @returns {Promise} */ - static async delete(deleteMemberQualification: DeleteMemberQualificationCommand): Promise { + static async delete(deletMemberQualification: DeleteMemberQualificationCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(memberQualifications) - .where("id = :id", { id: deleteMemberQualification.id }) - .andWhere("memberId = :memberId", { memberId: deleteMemberQualification.memberId }) + .where("id = :id", { id: deletMemberQualification.id }) + .andWhere("memberId = :memberId", { memberId: deletMemberQualification.memberId }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/club/member/membershipCommand.ts b/src/command/membershipCommand.ts similarity index 100% rename from src/command/club/member/membershipCommand.ts rename to src/command/membershipCommand.ts diff --git a/src/command/club/member/membershipCommandHandler.ts b/src/command/membershipCommandHandler.ts similarity index 90% rename from src/command/club/member/membershipCommandHandler.ts rename to src/command/membershipCommandHandler.ts index 602d6d7..b52a1dd 100644 --- a/src/command/club/member/membershipCommandHandler.ts +++ b/src/command/membershipCommandHandler.ts @@ -1,6 +1,8 @@ -import { dataSource } from "../../../data-source"; -import { membership } from "../../../entity/club/member/membership"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { member } from "../entity/member"; +import { membership } from "../entity/membership"; +import { membershipStatus } from "../entity/membershipStatus"; +import InternalException from "../exceptions/internalException"; import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand"; export default abstract class MembershipCommandHandler { @@ -31,7 +33,7 @@ export default abstract class MembershipCommandHandler { .createQueryBuilder() .update(membership) .set({ - end: new Date(createMembership.start).setDate(new Date(createMembership.start).getDate() - 1), + end: createMembership.start, terminationReason: "beendet durch neuen Eintrag.", }) .where("end IS NULL") diff --git a/src/command/settings/membershipStatus/membershipStatusCommand.ts b/src/command/membershipStatusCommand.ts similarity index 100% rename from src/command/settings/membershipStatus/membershipStatusCommand.ts rename to src/command/membershipStatusCommand.ts diff --git a/src/command/settings/membershipStatus/membershipStatusCommandHandler.ts b/src/command/membershipStatusCommandHandler.ts similarity index 75% rename from src/command/settings/membershipStatus/membershipStatusCommandHandler.ts rename to src/command/membershipStatusCommandHandler.ts index bc9f30f..b72641e 100644 --- a/src/command/settings/membershipStatus/membershipStatusCommandHandler.ts +++ b/src/command/membershipStatusCommandHandler.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { membershipStatus } from "../../../entity/settings/membershipStatus"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { membershipStatus } from "../entity/membershipStatus"; +import InternalException from "../exceptions/internalException"; import { CreateMembershipStatusCommand, DeleteMembershipStatusCommand, @@ -10,7 +10,7 @@ import { export default abstract class MembershipStatusCommandHandler { /** * @description create membershipStatus - * @param {CreateMembershipStatusCommand} createMembershipStatus + * @param CreateMembershipStatusCommand * @returns {Promise} */ static async create(createMembershipStatus: CreateMembershipStatusCommand): Promise { @@ -32,7 +32,7 @@ export default abstract class MembershipStatusCommandHandler { /** * @description update membershipStatus - * @param {UpdateMembershipStatusCommand} updateMembershipStatus + * @param UpdateMembershipStatusCommand * @returns {Promise} */ static async update(updateMembershipStatus: UpdateMembershipStatusCommand): Promise { @@ -52,15 +52,15 @@ export default abstract class MembershipStatusCommandHandler { /** * @description delete membershipStatus - * @param {DeleteMembershipStatusCommand} deleteMembershipStatus + * @param DeleteMembershipStatusCommand * @returns {Promise} */ - static async delete(deleteMembershipStatus: DeleteMembershipStatusCommand): Promise { + static async delete(deletMembershipStatus: DeleteMembershipStatusCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(membershipStatus) - .where("id = :id", { id: deleteMembershipStatus.id }) + .where("id = :id", { id: deletMembershipStatus.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/club/newsletter/newsletterCommand.ts b/src/command/newsletterCommand.ts similarity index 100% rename from src/command/club/newsletter/newsletterCommand.ts rename to src/command/newsletterCommand.ts diff --git a/src/command/club/newsletter/newsletterCommandHandler.ts b/src/command/newsletterCommandHandler.ts similarity index 84% rename from src/command/club/newsletter/newsletterCommandHandler.ts rename to src/command/newsletterCommandHandler.ts index 38c156b..6667a74 100644 --- a/src/command/club/newsletter/newsletterCommandHandler.ts +++ b/src/command/newsletterCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { newsletter } from "../../../entity/club/newsletter/newsletter"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletter } from "../entity/newsletter"; +import InternalException from "../exceptions/internalException"; import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand"; export default abstract class NewsletterCommandHandler { /** * @description create newsletter - * @param {CreateNewsletterCommand} createNewsletter + * @param CreateNewsletterCommand * @returns {Promise} */ static async create(createNewsletter: CreateNewsletterCommand): Promise { @@ -28,7 +28,7 @@ export default abstract class NewsletterCommandHandler { /** * @description sync newsletter - * @param {SynchronizeNewsletterCommand} syncNewsletter + * @param SynchronizeNewsletterCommand * @returns {Promise} */ static async sync(syncNewsletter: SynchronizeNewsletterCommand): Promise { @@ -53,7 +53,7 @@ export default abstract class NewsletterCommandHandler { /** * @description send newsletter - * @param {SendNewsletterCommand} syncNewsletter + * @param SendNewsletterCommand * @returns {Promise} */ static async send(syncNewsletter: SendNewsletterCommand): Promise { diff --git a/src/command/settings/newsletterConfig/newsletterConfigCommand.ts b/src/command/newsletterConfigCommand.ts similarity index 69% rename from src/command/settings/newsletterConfig/newsletterConfigCommand.ts rename to src/command/newsletterConfigCommand.ts index f07de54..011bc11 100644 --- a/src/command/settings/newsletterConfig/newsletterConfigCommand.ts +++ b/src/command/newsletterConfigCommand.ts @@ -1,4 +1,4 @@ -import { NewsletterConfigType } from "../../../enums/newsletterConfigType"; +import { NewsletterConfigType } from "../enums/newsletterConfigType"; export interface SetNewsletterConfigCommand { comTypeId: number; diff --git a/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts b/src/command/newsletterConfigCommandHandler.ts similarity index 80% rename from src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts rename to src/command/newsletterConfigCommandHandler.ts index 56b41bd..6f6b948 100644 --- a/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts +++ b/src/command/newsletterConfigCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { newsletterConfig } from "../../../entity/settings/newsletterConfig"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletterConfig } from "../entity/newsletterConfig"; +import InternalException from "../exceptions/internalException"; import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "./newsletterConfigCommand"; export default abstract class NewsletterConfigCommandHandler { /** * @description set newsletterConfig - * @param {SetNewsletterConfigCommand} setNewsletterConfig + * @param SetNewsletterConfigCommand * @returns {Promise} */ static async set(setNewsletterConfig: SetNewsletterConfigCommand): Promise { @@ -29,7 +29,7 @@ export default abstract class NewsletterConfigCommandHandler { } /** * @description delete newsletterConfig - * @param {DeleteNewsletterConfigCommand} deleteNewsletterConfig + * @param number * @returns {Promise} */ static async delete(deleteNewsletterConfig: DeleteNewsletterConfigCommand): Promise { diff --git a/src/command/club/newsletter/newsletterDatesCommand.ts b/src/command/newsletterDatesCommand.ts similarity index 100% rename from src/command/club/newsletter/newsletterDatesCommand.ts rename to src/command/newsletterDatesCommand.ts diff --git a/src/command/club/newsletter/newsletterDatesCommandHandler.ts b/src/command/newsletterDatesCommandHandler.ts similarity index 91% rename from src/command/club/newsletter/newsletterDatesCommandHandler.ts rename to src/command/newsletterDatesCommandHandler.ts index efaea75..99ee1ad 100644 --- a/src/command/club/newsletter/newsletterDatesCommandHandler.ts +++ b/src/command/newsletterDatesCommandHandler.ts @@ -1,9 +1,9 @@ import { DeleteResult, EntityManager, InsertResult, UpdateResult } from "typeorm"; -import { dataSource } from "../../../data-source"; -import InternalException from "../../../exceptions/internalException"; -import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService"; +import { dataSource } from "../data-source"; +import InternalException from "../exceptions/internalException"; +import NewsletterDatesService from "../service/newsletterDatesService"; import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand"; -import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates"; +import { newsletterDates } from "../entity/newsletterDates"; export default abstract class NewsletterDatesCommandHandler { /** diff --git a/src/command/club/newsletter/newsletterRecipientsCommand.ts b/src/command/newsletterRecipientsCommand.ts similarity index 100% rename from src/command/club/newsletter/newsletterRecipientsCommand.ts rename to src/command/newsletterRecipientsCommand.ts diff --git a/src/command/club/newsletter/newsletterRecipientsCommandHandler.ts b/src/command/newsletterRecipientsCommandHandler.ts similarity index 87% rename from src/command/club/newsletter/newsletterRecipientsCommandHandler.ts rename to src/command/newsletterRecipientsCommandHandler.ts index 262febc..b321c71 100644 --- a/src/command/club/newsletter/newsletterRecipientsCommandHandler.ts +++ b/src/command/newsletterRecipientsCommandHandler.ts @@ -1,9 +1,9 @@ import { DeleteResult, EntityManager, InsertResult, UpdateResult } from "typeorm"; -import { dataSource } from "../../../data-source"; -import InternalException from "../../../exceptions/internalException"; -import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService"; +import { dataSource } from "../data-source"; +import InternalException from "../exceptions/internalException"; +import NewsletterRecipientsService from "../service/newsletterRecipientsService"; import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand"; -import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients"; +import { newsletterRecipients } from "../entity/newsletterRecipients"; export default abstract class NewsletterRecipientsCommandHandler { /** diff --git a/src/command/club/protocol/protocolAgendaCommand.ts b/src/command/protocolAgendaCommand.ts similarity index 100% rename from src/command/club/protocol/protocolAgendaCommand.ts rename to src/command/protocolAgendaCommand.ts diff --git a/src/command/club/protocol/protocolAgendaCommandHandler.ts b/src/command/protocolAgendaCommandHandler.ts similarity index 79% rename from src/command/club/protocol/protocolAgendaCommandHandler.ts rename to src/command/protocolAgendaCommandHandler.ts index 0c74179..91c7dea 100644 --- a/src/command/club/protocol/protocolAgendaCommandHandler.ts +++ b/src/command/protocolAgendaCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolAgenda } from "../entity/protocolAgenda"; +import InternalException from "../exceptions/internalException"; import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand"; export default abstract class ProtocolAgendaCommandHandler { /** * @description create protocolAgenda - * @param {number} protocolId + * @param {number} * @returns {Promise} */ static async create(protocolId: number): Promise { @@ -30,7 +30,7 @@ export default abstract class ProtocolAgendaCommandHandler { /** * @description sync protocolAgenda - * @param {Array} syncProtocolAgenda + * @param {Array} * @returns {Promise} */ static async sync(syncProtocolAgenda: Array): Promise { diff --git a/src/command/club/protocol/protocolCommand.ts b/src/command/protocolCommand.ts similarity index 100% rename from src/command/club/protocol/protocolCommand.ts rename to src/command/protocolCommand.ts diff --git a/src/command/club/protocol/protocolCommandHandler.ts b/src/command/protocolCommandHandler.ts similarity index 81% rename from src/command/club/protocol/protocolCommandHandler.ts rename to src/command/protocolCommandHandler.ts index 95e5017..f2f293e 100644 --- a/src/command/club/protocol/protocolCommandHandler.ts +++ b/src/command/protocolCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { protocol } from "../../../entity/club/protocol/protocol"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocol } from "../entity/protocol"; +import InternalException from "../exceptions/internalException"; import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand"; export default abstract class ProtocolCommandHandler { /** * @description create protocol - * @param {CreateProtocolCommand} createProtocol + * @param CreateProtocolCommand * @returns {Promise} */ static async create(createProtocol: CreateProtocolCommand): Promise { @@ -29,7 +29,7 @@ export default abstract class ProtocolCommandHandler { /** * @description sync protocol - * @param {SynchronizeProtocolCommand} syncProtocol + * @param SynchronizeProtocolCommand * @returns {Promise} */ static async sync(syncProtocol: SynchronizeProtocolCommand): Promise { diff --git a/src/command/club/protocol/protocolDecisionCommand.ts b/src/command/protocolDecisionCommand.ts similarity index 100% rename from src/command/club/protocol/protocolDecisionCommand.ts rename to src/command/protocolDecisionCommand.ts diff --git a/src/command/club/protocol/protocolDecisionCommandHandler.ts b/src/command/protocolDecisionCommandHandler.ts similarity index 79% rename from src/command/club/protocol/protocolDecisionCommandHandler.ts rename to src/command/protocolDecisionCommandHandler.ts index 19aba38..750a40e 100644 --- a/src/command/club/protocol/protocolDecisionCommandHandler.ts +++ b/src/command/protocolDecisionCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { protocolDecision } from "../../../entity/club/protocol/protocolDecision"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolDecision } from "../entity/protocolDecision"; +import InternalException from "../exceptions/internalException"; import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand"; export default abstract class ProtocolDecisionCommandHandler { /** * @description create protocolDecision - * @param {number} protocolId + * @param {number} * @returns {Promise} */ static async create(protocolId: number): Promise { @@ -29,7 +29,7 @@ export default abstract class ProtocolDecisionCommandHandler { } /** * @description sync protocolDecision - * @param {Array} syncProtocolDecisions + * @param {Array} * @returns {Promise} */ static async sync(syncProtocolDecisions: Array): Promise { diff --git a/src/command/protocolPresenceCommand.ts b/src/command/protocolPresenceCommand.ts new file mode 100644 index 0000000..b39878b --- /dev/null +++ b/src/command/protocolPresenceCommand.ts @@ -0,0 +1,4 @@ +export interface SynchronizeProtocolPresenceCommand { + memberIds: Array; + protocolId: number; +} diff --git a/src/command/protocolPresenceCommandHandler.ts b/src/command/protocolPresenceCommandHandler.ts new file mode 100644 index 0000000..b773cc6 --- /dev/null +++ b/src/command/protocolPresenceCommandHandler.ts @@ -0,0 +1,69 @@ +import { DeleteResult, EntityManager, InsertResult } from "typeorm"; +import { dataSource } from "../data-source"; +import { protocolPresence } from "../entity/protocolPresence"; +import InternalException from "../exceptions/internalException"; +import ProtocolPresenceService from "../service/protocolPrecenseService"; +import { SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand"; + +export default abstract class ProtocolPresenceCommandHandler { + /** + * @description sync protocolPresence + * @param {SynchronizeProtocolPresenceCommand} + * @returns {Promise} + */ + static async sync(syncProtocolPresences: SynchronizeProtocolPresenceCommand): Promise { + let currentPresence = (await ProtocolPresenceService.getAll(syncProtocolPresences.protocolId)).map( + (r) => r.memberId + ); + + return await dataSource.manager + .transaction(async (manager) => { + let newMembers = syncProtocolPresences.memberIds.filter((r) => !currentPresence.includes(r)); + let removeMembers = currentPresence.filter((r) => !syncProtocolPresences.memberIds.includes(r)); + + if (newMembers.length != 0) { + await this.syncPresenceAdd(manager, syncProtocolPresences.protocolId, newMembers); + } + + if (removeMembers.length != 0) { + await this.syncPresenceRemove(manager, syncProtocolPresences.protocolId, removeMembers); + } + }) + .then(() => {}) + .catch((err) => { + throw new InternalException("Failed saving protocol presence", err); + }); + } + + private static async syncPresenceAdd( + manager: EntityManager, + protocolId: number, + memberIds: Array + ): Promise { + return await manager + .createQueryBuilder() + .insert() + .into(protocolPresence) + .values( + memberIds.map((m) => ({ + protocolId, + memberId: m, + })) + ) + .execute(); + } + + private static async syncPresenceRemove( + manager: EntityManager, + protocolId: number, + memberIds: Array + ): Promise { + return await manager + .createQueryBuilder() + .delete() + .from(protocolPresence) + .where("memberId IN (:...ids)", { ids: memberIds }) + .andWhere("protocolId = :protocolId", { protocolId }) + .execute(); + } +} diff --git a/src/command/club/protocol/protocolPrintoutCommand.ts b/src/command/protocolPrintoutCommand.ts similarity index 100% rename from src/command/club/protocol/protocolPrintoutCommand.ts rename to src/command/protocolPrintoutCommand.ts diff --git a/src/command/club/protocol/protocolPrintoutCommandHandler.ts b/src/command/protocolPrintoutCommandHandler.ts similarity index 75% rename from src/command/club/protocol/protocolPrintoutCommandHandler.ts rename to src/command/protocolPrintoutCommandHandler.ts index 9ceabea..c1cdcbe 100644 --- a/src/command/club/protocol/protocolPrintoutCommandHandler.ts +++ b/src/command/protocolPrintoutCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolPrintout } from "../entity/protocolPrintout"; +import InternalException from "../exceptions/internalException"; import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand"; export default abstract class ProtocolPrintoutCommandHandler { /** * @description create protocolPrintout - * @param {CreateProtocolPrintoutCommand} printout + * @param {number} * @returns {Promise} */ static async create(printout: CreateProtocolPrintoutCommand): Promise { diff --git a/src/command/club/protocol/protocolVotingCommand.ts b/src/command/protocolVotingCommand.ts similarity index 100% rename from src/command/club/protocol/protocolVotingCommand.ts rename to src/command/protocolVotingCommand.ts diff --git a/src/command/club/protocol/protocolVotingCommandHandler.ts b/src/command/protocolVotingCommandHandler.ts similarity index 79% rename from src/command/club/protocol/protocolVotingCommandHandler.ts rename to src/command/protocolVotingCommandHandler.ts index 6b8834d..bbc9660 100644 --- a/src/command/club/protocol/protocolVotingCommandHandler.ts +++ b/src/command/protocolVotingCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { protocolVoting } from "../../../entity/club/protocol/protocolVoting"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolVoting } from "../entity/protocolVoting"; +import InternalException from "../exceptions/internalException"; import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand"; export default abstract class ProtocolVotingCommandHandler { /** * @description create protocolVoting - * @param {number} protocolId + * @param {number} * @returns {Promise} */ static async create(protocolId: number): Promise { @@ -29,7 +29,7 @@ export default abstract class ProtocolVotingCommandHandler { } /** * @description sync protocolVoting - * @param {Array} syncProtocolVotings + * @param {Array} * @returns {Promise} */ static async sync(syncProtocolVotings: Array): Promise { diff --git a/src/command/settings/qualification/qualificationCommand.ts b/src/command/qualificationCommand.ts similarity index 100% rename from src/command/settings/qualification/qualificationCommand.ts rename to src/command/qualificationCommand.ts diff --git a/src/command/settings/qualification/qualificationCommandHandler.ts b/src/command/qualificationCommandHandler.ts similarity index 76% rename from src/command/settings/qualification/qualificationCommandHandler.ts rename to src/command/qualificationCommandHandler.ts index 0abd401..67da2f9 100644 --- a/src/command/settings/qualification/qualificationCommandHandler.ts +++ b/src/command/qualificationCommandHandler.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { qualification } from "../../../entity/settings/qualification"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { qualification } from "../entity/qualification"; +import InternalException from "../exceptions/internalException"; import { CreateQualificationCommand, DeleteQualificationCommand, @@ -10,7 +10,7 @@ import { export default abstract class QualificationCommandHandler { /** * @description create qualification - * @param {CreateQualificationCommand} createQualification + * @param CreateQualificationCommand * @returns {Promise} */ static async create(createQualification: CreateQualificationCommand): Promise { @@ -33,7 +33,7 @@ export default abstract class QualificationCommandHandler { /** * @description update qualification - * @param {UpdateQualificationCommand} updateQualification + * @param UpdateQualificationCommand * @returns {Promise} */ static async update(updateQualification: UpdateQualificationCommand): Promise { @@ -54,15 +54,15 @@ export default abstract class QualificationCommandHandler { /** * @description delete qualification - * @param {DeleteQualificationCommand} deleteQualification + * @param DeleteQualificationCommand * @returns {Promise} */ - static async delete(deleteQualification: DeleteQualificationCommand): Promise { + static async delete(deletQualification: DeleteQualificationCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(qualification) - .where("id = :id", { id: deleteQualification.id }) + .where("id = :id", { id: deletQualification.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/settings/queryStore/queryStoreCommand.ts b/src/command/queryStoreCommand.ts similarity index 79% rename from src/command/settings/queryStore/queryStoreCommand.ts rename to src/command/queryStoreCommand.ts index fee7ffc..7043159 100644 --- a/src/command/settings/queryStore/queryStoreCommand.ts +++ b/src/command/queryStoreCommand.ts @@ -1,4 +1,4 @@ -import { DynamicQueryStructure } from "../../../type/dynamicQueries"; +import { DynamicQueryStructure } from "../type/dynamicQueries"; export interface CreateQueryStoreCommand { title: string; diff --git a/src/command/settings/queryStore/queryStoreCommandHandler.ts b/src/command/queryStoreCommandHandler.ts similarity index 78% rename from src/command/settings/queryStore/queryStoreCommandHandler.ts rename to src/command/queryStoreCommandHandler.ts index 3776b5e..7eeb80c 100644 --- a/src/command/settings/queryStore/queryStoreCommandHandler.ts +++ b/src/command/queryStoreCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { query } from "../../../entity/settings/query"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { query } from "../entity/query"; +import InternalException from "../exceptions/internalException"; import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand"; export default abstract class QueryStoreCommandHandler { /** * @description create queryStore - * @param {CreateQueryStoreCommand} createQueryStore + * @param CreateQueryStoreCommand * @returns {Promise} */ static async create(createQueryStore: CreateQueryStoreCommand): Promise { @@ -30,7 +30,7 @@ export default abstract class QueryStoreCommandHandler { /** * @description update queryStore - * @param {UpdateQueryStoreCommand} updateQueryStore + * @param UpdateQueryStoreCommand * @returns {Promise} */ static async update(updateQueryStore: UpdateQueryStoreCommand): Promise { @@ -51,15 +51,15 @@ export default abstract class QueryStoreCommandHandler { /** * @description delete queryStore - * @param {DeleteQueryStoreCommand} deleteQueryStore + * @param DeleteQueryStoreCommand * @returns {Promise} */ - static async delete(deleteQueryStore: DeleteQueryStoreCommand): Promise { + static async delete(deletQueryStore: DeleteQueryStoreCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(query) - .where("id = :id", { id: deleteQueryStore.id }) + .where("id = :id", { id: deletQueryStore.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/refreshCommandHandler.ts b/src/command/refreshCommandHandler.ts index 86841ad..ae6dc0b 100644 --- a/src/command/refreshCommandHandler.ts +++ b/src/command/refreshCommandHandler.ts @@ -4,7 +4,7 @@ import { REFRESH_EXPIRATION } from "../env.defaults"; import InternalException from "../exceptions/internalException"; import { JWTHelper } from "../helpers/jwtHelper"; import { StringHelper } from "../helpers/stringHelper"; -import UserService from "../service/user/userService"; +import UserService from "../service/userService"; import { JWTRefresh } from "../type/jwtTypes"; import { CreateRefreshCommand, DeleteRefreshCommand } from "./refreshCommand"; import ms from "ms"; @@ -12,7 +12,7 @@ import ms from "ms"; export default abstract class RefreshCommandHandler { /** * @description create and save refreshToken to user - * @param {CreateRefreshCommand} createRefresh + * @param CreateRefreshCommand * @returns {Promise} */ static async create(createRefresh: CreateRefreshCommand): Promise { @@ -42,7 +42,7 @@ export default abstract class RefreshCommandHandler { /** * @description delete refresh by user and token - * @param {DeleteRefreshCommand} deleteRefresh + * @param DeleteRefreshCommand * @returns {Promise} */ static async deleteByToken(deleteRefresh: DeleteRefreshCommand): Promise { diff --git a/src/command/resetCommandHandler.ts b/src/command/resetCommandHandler.ts index 9c75aba..6ef1d00 100644 --- a/src/command/resetCommandHandler.ts +++ b/src/command/resetCommandHandler.ts @@ -7,7 +7,7 @@ import { CreateResetCommand, DeleteResetCommand } from "./resetCommand"; export default abstract class ResetCommandHandler { /** * @description create user - * @param {CreateResetCommand} createReset + * @param CreateResetCommand * @returns {Promise} */ static async create(createReset: CreateResetCommand): Promise { @@ -35,7 +35,7 @@ export default abstract class ResetCommandHandler { /** * @description delete reset by mail and token - * @param {DeleteRefreshCommand} deleteReset + * @param DeleteRefreshCommand * @returns {Promise} */ static async deleteByTokenAndMail(deleteReset: DeleteResetCommand): Promise { diff --git a/src/command/user/role/roleCommand.ts b/src/command/roleCommand.ts similarity index 100% rename from src/command/user/role/roleCommand.ts rename to src/command/roleCommand.ts diff --git a/src/command/user/role/roleCommandHandler.ts b/src/command/roleCommandHandler.ts similarity index 83% rename from src/command/user/role/roleCommandHandler.ts rename to src/command/roleCommandHandler.ts index 739d8b9..e967fb3 100644 --- a/src/command/user/role/roleCommandHandler.ts +++ b/src/command/roleCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { role } from "../../../entity/user/role"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { role } from "../entity/role"; +import InternalException from "../exceptions/internalException"; import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand"; export default abstract class RoleCommandHandler { /** * @description create role - * @param {CreateRoleCommand} createRole + * @param CreateRoleCommand * @returns {Promise} */ static async create(createRole: CreateRoleCommand): Promise { @@ -28,7 +28,7 @@ export default abstract class RoleCommandHandler { /** * @description update role - * @param {UpdateRoleCommand} updateRole + * @param UpdateRoleCommand * @returns {Promise} */ static async update(updateRole: UpdateRoleCommand): Promise { @@ -48,7 +48,7 @@ export default abstract class RoleCommandHandler { /** * @description delete role - * @param {DeleteRoleCommand} deleteRole + * @param DeleteRoleCommand * @returns {Promise} */ static async delete(deleteRole: DeleteRoleCommand): Promise { diff --git a/src/command/user/role/rolePermissionCommand.ts b/src/command/rolePermissionCommand.ts similarity index 82% rename from src/command/user/role/rolePermissionCommand.ts rename to src/command/rolePermissionCommand.ts index 3d4021c..dae6ea2 100644 --- a/src/command/user/role/rolePermissionCommand.ts +++ b/src/command/rolePermissionCommand.ts @@ -1,4 +1,4 @@ -import { PermissionString } from "../../../type/permissionTypes"; +import { PermissionString } from "../type/permissionTypes"; export interface CreateRolePermissionCommand { permission: PermissionString; diff --git a/src/command/user/role/rolePermissionCommandHandler.ts b/src/command/rolePermissionCommandHandler.ts similarity index 83% rename from src/command/user/role/rolePermissionCommandHandler.ts rename to src/command/rolePermissionCommandHandler.ts index a9a0b1f..e1d5e2c 100644 --- a/src/command/user/role/rolePermissionCommandHandler.ts +++ b/src/command/rolePermissionCommandHandler.ts @@ -1,21 +1,22 @@ import { DeleteResult, EntityManager, InsertResult } from "typeorm"; -import { dataSource } from "../../../data-source"; -import { rolePermission } from "../../../entity/user/role_permission"; -import InternalException from "../../../exceptions/internalException"; -import RoleService from "../../../service/user/roleService"; +import { dataSource } from "../data-source"; +import { rolePermission } from "../entity/role_permission"; +import InternalException from "../exceptions/internalException"; +import RoleService from "../service/roleService"; import { CreateRolePermissionCommand, DeleteRolePermissionCommand, UpdateRolePermissionsCommand, } from "./rolePermissionCommand"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import RolePermissionService from "../../../service/user/rolePermissionService"; -import { PermissionString } from "../../../type/permissionTypes"; +import PermissionHelper from "../helpers/permissionHelper"; +import RolePermissionService from "../service/rolePermissionService"; +import { role } from "../entity/role"; +import { PermissionString } from "../type/permissionTypes"; export default abstract class RolePermissionCommandHandler { /** * @description update role permissions - * @param {UpdateRolePermissionsCommand} updateRolePermissions + * @param UpdateRolePermissionsCommand * @returns {Promise} */ static async updatePermissions(updateRolePermissions: UpdateRolePermissionsCommand): Promise { @@ -74,7 +75,7 @@ export default abstract class RolePermissionCommandHandler { /** * @description grant permission to user - * @param {CreateRolePermissionCommand} createPermission + * @param CreateRolePermissionCommand * @returns {Promise} */ static async create(createPermission: CreateRolePermissionCommand): Promise { @@ -97,7 +98,7 @@ export default abstract class RolePermissionCommandHandler { /** * @description remove permission from role - * @param {DeleteRolePermissionCommand} deletePermission + * @param DeleteRolePermissionCommand * @returns {Promise} */ static async delete(deletePermission: DeleteRolePermissionCommand): Promise { @@ -108,7 +109,7 @@ export default abstract class RolePermissionCommandHandler { .where("roleId = :id", { id: deletePermission.roleId }) .andWhere("permission = :permission", { permission: deletePermission.permission }) .execute() - .then(() => {}) + .then((res) => {}) .catch((err) => { throw new InternalException("failed role permission removal", err); }); diff --git a/src/command/settings/template/templateCommand.ts b/src/command/templateCommand.ts similarity index 100% rename from src/command/settings/template/templateCommand.ts rename to src/command/templateCommand.ts diff --git a/src/command/settings/template/templateCommandHandler.ts b/src/command/templateCommandHandler.ts similarity index 78% rename from src/command/settings/template/templateCommandHandler.ts rename to src/command/templateCommandHandler.ts index 54ea6f7..1f9b4ce 100644 --- a/src/command/settings/template/templateCommandHandler.ts +++ b/src/command/templateCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { template } from "../../../entity/settings/template"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { template } from "../entity/template"; +import InternalException from "../exceptions/internalException"; import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand"; export default abstract class TemplateCommandHandler { /** * @description create template - * @param {CreateTemplateCommand} createTemplate + * @param CreateTemplateCommand * @returns {Promise} */ static async create(createTemplate: CreateTemplateCommand): Promise { @@ -29,7 +29,7 @@ export default abstract class TemplateCommandHandler { /** * @description update template - * @param {UpdateTemplateCommand} updateTemplate + * @param UpdateTemplateCommand * @returns {Promise} */ static async update(updateTemplate: UpdateTemplateCommand): Promise { @@ -52,15 +52,15 @@ export default abstract class TemplateCommandHandler { /** * @description delete template - * @param {DeleteTemplateCommand} deleteTemplate + * @param DeleteTemplateCommand * @returns {Promise} */ - static async delete(deleteTemplate: DeleteTemplateCommand): Promise { + static async delete(deletTemplate: DeleteTemplateCommand): Promise { return await dataSource .createQueryBuilder() .delete() .from(template) - .where("id = :id", { id: deleteTemplate.id }) + .where("id = :id", { id: deletTemplate.id }) .execute() .then(() => {}) .catch((err) => { diff --git a/src/command/settings/templateUsage/templateUsageCommand.ts b/src/command/templateUsageCommand.ts similarity index 100% rename from src/command/settings/templateUsage/templateUsageCommand.ts rename to src/command/templateUsageCommand.ts diff --git a/src/command/settings/templateUsage/templateUsageCommandHandler.ts b/src/command/templateUsageCommandHandler.ts similarity index 77% rename from src/command/settings/templateUsage/templateUsageCommandHandler.ts rename to src/command/templateUsageCommandHandler.ts index 06c46c9..c9eecce 100644 --- a/src/command/settings/templateUsage/templateUsageCommandHandler.ts +++ b/src/command/templateUsageCommandHandler.ts @@ -1,12 +1,12 @@ -import { dataSource } from "../../../data-source"; -import { templateUsage } from "../../../entity/settings/templateUsage"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { templateUsage } from "../entity/templateUsage"; +import InternalException from "../exceptions/internalException"; import { UpdateTemplateUsageCommand } from "./templateUsageCommand"; export default abstract class TemplateUsageCommandHandler { /** * @description update templateUsage - * @param {UpdateTemplateUsageCommand} updateTemplateUsage + * @param UpdateTemplateUsageCommand * @returns {Promise} */ static async update(updateTemplateUsage: UpdateTemplateUsageCommand): Promise { diff --git a/src/command/user/user/userCommand.ts b/src/command/userCommand.ts similarity index 100% rename from src/command/user/user/userCommand.ts rename to src/command/userCommand.ts diff --git a/src/command/user/user/userCommandHandler.ts b/src/command/userCommandHandler.ts similarity index 89% rename from src/command/user/user/userCommandHandler.ts rename to src/command/userCommandHandler.ts index affab87..6d1c616 100644 --- a/src/command/user/user/userCommandHandler.ts +++ b/src/command/userCommandHandler.ts @@ -1,7 +1,7 @@ import { EntityManager } from "typeorm"; -import { dataSource } from "../../../data-source"; -import { user } from "../../../entity/user/user"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { user } from "../entity/user"; +import InternalException from "../exceptions/internalException"; import { CreateUserCommand, DeleteUserCommand, @@ -10,12 +10,12 @@ import { UpdateUserRolesCommand, UpdateUserSecretCommand, } from "./userCommand"; -import UserService from "../../../service/user/userService"; +import UserService from "../service/userService"; export default abstract class UserCommandHandler { /** * @description create user - * @param {CreateUserCommand} createUser + * @param CreateUserCommand * @returns {Promise} */ static async create(createUser: CreateUserCommand): Promise { @@ -42,7 +42,7 @@ export default abstract class UserCommandHandler { /** * @description update user - * @param {UpdateUserCommand} updateUser + * @param UpdateUserCommand * @returns {Promise} */ static async update(updateUser: UpdateUserCommand): Promise { @@ -65,7 +65,7 @@ export default abstract class UserCommandHandler { /** * @description update user - * @param {UpdateUserSecretCommand} updateUser + * @param UpdateUserSecretCommand * @returns {Promise} */ static async updateSecret(updateUser: UpdateUserSecretCommand): Promise { @@ -85,7 +85,7 @@ export default abstract class UserCommandHandler { /** * @description update user roles - * @param {UpdateUserRolesCommand} updateUserRoles + * @param UpdateUserRolesCommand * @returns {Promise} */ static async updateRoles(updateUserRoles: UpdateUserRolesCommand): Promise { @@ -119,13 +119,13 @@ export default abstract class UserCommandHandler { /** * @description transfer ownership - * @param {TransferUserOwnerCommand} transferOwnership + * @param TransferUserOwnerCommand * @returns {Promise} */ static async transferOwnership(transferOwnership: TransferUserOwnerCommand): Promise { return await dataSource.manager .transaction(async (manager) => { - await manager + manager .createQueryBuilder() .update(user) .set({ @@ -134,7 +134,7 @@ export default abstract class UserCommandHandler { .where("id = :id", { id: transferOwnership.fromId }) .execute(); - await manager + manager .createQueryBuilder() .update(user) .set({ diff --git a/src/command/user/user/userPermissionCommand.ts b/src/command/userPermissionCommand.ts similarity index 82% rename from src/command/user/user/userPermissionCommand.ts rename to src/command/userPermissionCommand.ts index 47f7594..44da15b 100644 --- a/src/command/user/user/userPermissionCommand.ts +++ b/src/command/userPermissionCommand.ts @@ -1,4 +1,4 @@ -import { PermissionString } from "../../../type/permissionTypes"; +import { PermissionString } from "../type/permissionTypes"; export interface CreateUserPermissionCommand { permission: PermissionString; diff --git a/src/command/user/user/userPermissionCommandHandler.ts b/src/command/userPermissionCommandHandler.ts similarity index 84% rename from src/command/user/user/userPermissionCommandHandler.ts rename to src/command/userPermissionCommandHandler.ts index 75c1142..8006ce2 100644 --- a/src/command/user/user/userPermissionCommandHandler.ts +++ b/src/command/userPermissionCommandHandler.ts @@ -1,21 +1,21 @@ import { DeleteResult, EntityManager, InsertResult } from "typeorm"; -import { dataSource } from "../../../data-source"; -import { user } from "../../../entity/user/user"; -import { userPermission } from "../../../entity/user/user_permission"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { user } from "../entity/user"; +import { userPermission } from "../entity/user_permission"; +import InternalException from "../exceptions/internalException"; import { CreateUserPermissionCommand, DeleteUserPermissionCommand, UpdateUserPermissionsCommand, } from "./userPermissionCommand"; -import UserPermissionService from "../../../service/user/userPermissionService"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import { PermissionString } from "../../../type/permissionTypes"; +import UserPermissionService from "../service/userPermissionService"; +import PermissionHelper from "../helpers/permissionHelper"; +import { PermissionString } from "../type/permissionTypes"; export default abstract class UserPermissionCommandHandler { /** * @description update user permissions - * @param {UpdateUserPermissionsCommand} updateUserPermissions + * @param UpdateUserPermissionsCommand * @returns {Promise} */ static async updatePermissions(updateUserPermissions: UpdateUserPermissionsCommand): Promise { @@ -75,7 +75,7 @@ export default abstract class UserPermissionCommandHandler { /** * @description grant permission to user - * @param {CreateUserPermissionCommand} createPermission + * @param CreateUserPermissionCommand * @returns {Promise} */ static async create(createPermission: CreateUserPermissionCommand): Promise { @@ -98,7 +98,7 @@ export default abstract class UserPermissionCommandHandler { /** * @description remove permission to user - * @param {DeleteUserPermissionCommand} deletePermission + * @param DeleteUserPermissionCommand * @returns {Promise} */ static async delete(deletePermission: DeleteUserPermissionCommand): Promise { diff --git a/src/controller/admin/settings/awardController.ts b/src/controller/admin/awardController.ts similarity index 88% rename from src/controller/admin/settings/awardController.ts rename to src/controller/admin/awardController.ts index a87b1c3..695e3b1 100644 --- a/src/controller/admin/settings/awardController.ts +++ b/src/controller/admin/awardController.ts @@ -1,8 +1,8 @@ import { Request, Response } from "express"; -import AwardService from "../../../service/settings/awardService"; -import AwardFactory from "../../../factory/admin/settings/award"; -import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "../../../command/settings/award/awardCommand"; -import AwardCommandHandler from "../../../command/settings/award/awardCommandHandler"; +import AwardService from "../../service/awardService"; +import AwardFactory from "../../factory/admin/award"; +import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "../../command/awardCommand"; +import AwardCommandHandler from "../../command/awardCommandHandler"; /** * @description get all awards diff --git a/src/controller/admin/club/calendarController.ts b/src/controller/admin/calendarController.ts similarity index 89% rename from src/controller/admin/club/calendarController.ts rename to src/controller/admin/calendarController.ts index fcb5ddb..f6a3bcd 100644 --- a/src/controller/admin/club/calendarController.ts +++ b/src/controller/admin/calendarController.ts @@ -1,16 +1,16 @@ import { Request, Response } from "express"; -import CalendarService from "../../../service/club/calendarService"; -import CalendarFactory from "../../../factory/admin/club/calendar"; -import CalendarTypeService from "../../../service/settings/calendarTypeService"; -import CalendarTypeFactory from "../../../factory/admin/settings/calendarType"; -import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "../../../command/club/calendar/calendarCommand"; -import CalendarCommandHandler from "../../../command/club/calendar/calendarCommandHandler"; +import CalendarService from "../../service/calendarService"; +import CalendarFactory from "../../factory/admin/calendar"; +import CalendarTypeService from "../../service/calendarTypeService"; +import CalendarTypeFactory from "../../factory/admin/calendarType"; +import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "../../command/calendarCommand"; +import CalendarCommandHandler from "../../command/calendarCommandHandler"; import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand, -} from "../../../command/settings/calendarType/calendarTypeCommand"; -import CalendarTypeCommandHandler from "../../../command/settings/calendarType/calendarTypeCommandHandler"; +} from "../../command/calendarTypeCommand"; +import CalendarTypeCommandHandler from "../../command/calendarTypeCommandHandler"; /** * @description get all calendar items diff --git a/src/controller/admin/club/queryBuilderController.ts b/src/controller/admin/club/queryBuilderController.ts deleted file mode 100644 index 1fa4cb5..0000000 --- a/src/controller/admin/club/queryBuilderController.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Request, Response } from "express"; -import DynamicQueryBuilder from "../../../helpers/dynamicQueryBuilder"; -import { dataSource } from "../../../data-source"; - -/** - * @description get all table metas - * @param req {Request} Express req object - * @param res {Response} Express res object - * @returns {Promise<*>} - */ -export async function getAllTableMeta(req: Request, res: Response): Promise { - let tableMetas = DynamicQueryBuilder.getAllTableMeta(); - - res.json(tableMetas); -} - -/** - * @description get meta by tablename - * @param req {Request} Express req object - * @param res {Response} Express res object - * @returns {Promise<*>} - */ -export async function getTableMetaByTablename(req: Request, res: Response): Promise { - const tablename = req.params.tablename; - let tableMeta = DynamicQueryBuilder.getTableMeta(tablename); - - res.json(tableMeta); -} - -/** - * @description execute Query - * @param req {Request} Express req object - * @param res {Response} Express res object - * @returns {Promise<*>} - */ -export async function executeQuery(req: Request, res: Response): Promise { - let offset = parseInt((req.query.offset as string) ?? "0"); - let count = parseInt((req.query.count as string) ?? "25"); - const query = req.body.query; - - let result = await DynamicQueryBuilder.executeQuery(query, offset, count); - - res.json(result); -} diff --git a/src/controller/admin/settings/communicationTypeController.ts b/src/controller/admin/communicationTypeController.ts similarity index 86% rename from src/controller/admin/settings/communicationTypeController.ts rename to src/controller/admin/communicationTypeController.ts index ad46b03..2d0b4e0 100644 --- a/src/controller/admin/settings/communicationTypeController.ts +++ b/src/controller/admin/communicationTypeController.ts @@ -1,13 +1,13 @@ import { Request, Response } from "express"; -import CommunicationTypeService from "../../../service/settings/communicationTypeService"; -import CommunicationTypeFactory from "../../../factory/admin/settings/communicationType"; -import CommunicationService from "../../../service/club/member/communicationService"; +import CommunicationTypeService from "../../service/communicationTypeService"; +import CommunicationTypeFactory from "../../factory/admin/communicationType"; +import CommunicationService from "../../service/communicationService"; import { CreateCommunicationTypeCommand, DeleteCommunicationTypeCommand, UpdateCommunicationTypeCommand, -} from "../../../command/settings/communicationType/communicationTypeCommand"; -import CommunicationTypeCommandHandler from "../../../command/settings/communicationType/communicationTypeCommandHandler"; +} from "../../command/communicationTypeCommand"; +import CommunicationTypeCommandHandler from "../../command/communicationTypeCommandHandler"; /** * @description get all communicationTypes diff --git a/src/controller/admin/settings/executivePositionController.ts b/src/controller/admin/executivePositionController.ts similarity index 86% rename from src/controller/admin/settings/executivePositionController.ts rename to src/controller/admin/executivePositionController.ts index 15437ef..2c1c77d 100644 --- a/src/controller/admin/settings/executivePositionController.ts +++ b/src/controller/admin/executivePositionController.ts @@ -1,12 +1,12 @@ import { Request, Response } from "express"; -import ExecutivePositionService from "../../../service/settings/executivePositionService"; -import ExecutivePositionFactory from "../../../factory/admin/settings/executivePosition"; +import ExecutivePositionService from "../../service/executivePositionService"; +import ExecutivePositionFactory from "../../factory/admin/executivePosition"; import { CreateExecutivePositionCommand, DeleteExecutivePositionCommand, UpdateExecutivePositionCommand, -} from "../../../command/settings/executivePosition/executivePositionCommand"; -import ExecutivePositionCommandHandler from "../../../command/settings/executivePosition/executivePositionCommandHandler"; +} from "../../command/executivePositionCommand"; +import ExecutivePositionCommandHandler from "../../command/executivePositionCommandHandler"; /** * @description get all executivePositions diff --git a/src/controller/admin/club/memberController.ts b/src/controller/admin/memberController.ts similarity index 87% rename from src/controller/admin/club/memberController.ts rename to src/controller/admin/memberController.ts index dacbbae..9aa6446 100644 --- a/src/controller/admin/club/memberController.ts +++ b/src/controller/admin/memberController.ts @@ -1,55 +1,53 @@ import { Request, Response } from "express"; -import MemberService from "../../../service/club/member/memberService"; -import MemberFactory from "../../../factory/admin/club/member/member"; -import MembershipService from "../../../service/club/member/membershipService"; -import MembershipFactory from "../../../factory/admin/club/member/membership"; -import MemberAwardService from "../../../service/club/member/memberAwardService"; -import MemberAwardFactory from "../../../factory/admin/club/member/memberAward"; -import MemberQualificationService from "../../../service/club/member/memberQualificationService"; -import MemberQualificationFactory from "../../../factory/admin/club/member/memberQualification"; -import MemberExecutivePositionService from "../../../service/club/member/memberExecutivePositionService"; -import MemberExecutivePositionFactory from "../../../factory/admin/club/member/memberExecutivePosition"; -import CommunicationService from "../../../service/club/member/communicationService"; -import CommunicationFactory from "../../../factory/admin/club/member/communication"; +import MemberService from "../../service/memberService"; +import MemberFactory from "../../factory/admin/member"; +import MembershipService from "../../service/membershipService"; +import MembershipFactory from "../../factory/admin/membership"; +import MemberAwardService from "../../service/memberAwardService"; +import MemberAwardFactory from "../../factory/admin/memberAward"; +import MemberQualificationService from "../../service/memberQualificationService"; +import MemberQualificationFactory from "../../factory/admin/memberQualification"; +import MemberExecutivePositionService from "../../service/memberExecutivePositionService"; +import MemberExecutivePositionFactory from "../../factory/admin/memberExecutivePosition"; +import CommunicationService from "../../service/communicationService"; +import CommunicationFactory from "../../factory/admin/communication"; import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand, UpdateMemberNewsletterCommand, -} from "../../../command/club/member/memberCommand"; -import MemberCommandHandler from "../../../command/club/member/memberCommandHandler"; +} from "../../command/memberCommand"; +import MemberCommandHandler from "../../command/memberCommandHandler"; import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand, -} from "../../../command/club/member/membershipCommand"; -import MembershipCommandHandler from "../../../command/club/member/membershipCommandHandler"; +} from "../../command/membershipCommand"; +import MembershipCommandHandler from "../../command/membershipCommandHandler"; import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand, -} from "../../../command/club/member/memberAwardCommand"; -import MemberAwardCommandHandler from "../../../command/club/member/memberAwardCommandHandler"; +} from "../../command/memberAwardCommand"; +import MemberAwardCommandHandler from "../../command/memberAwardCommandHandler"; import { CreateMemberExecutivePositionCommand, DeleteMemberExecutivePositionCommand, UpdateMemberExecutivePositionCommand, -} from "../../../command/club/member/memberExecutivePositionCommand"; -import MemberExecutivePositionCommandHandler from "../../../command/club/member/memberExecutivePositionCommandHandler"; +} from "../../command/memberExecutivePositionCommand"; +import MemberExecutivePositionCommandHandler from "../../command/memberExecutivePositionCommandHandler"; import { CreateMemberQualificationCommand, DeleteMemberQualificationCommand, UpdateMemberQualificationCommand, -} from "../../../command/club/member/memberQualificationCommand"; -import MemberQualificationCommandHandler from "../../../command/club/member/memberQualificationCommandHandler"; +} from "../../command/memberQualificationCommand"; +import MemberQualificationCommandHandler from "../../command/memberQualificationCommandHandler"; import { CreateCommunicationCommand, DeleteCommunicationCommand, UpdateCommunicationCommand, -} from "../../../command/club/member/communicationCommand"; -import CommunicationCommandHandler from "../../../command/club/member/communicationCommandHandler"; -import {PdfExport} from "../../../helpers/pdfExport"; -import {PermissionModule} from "../../../type/permissionTypes"; +} from "../../command/communicationCommand"; +import CommunicationCommandHandler from "../../command/communicationCommandHandler"; /** * @description get all members @@ -220,33 +218,6 @@ export async function getCommunicationByMemberAndRecord(req: Request, res: Respo 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 { - 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 * @param req {Request} Express req object diff --git a/src/controller/admin/settings/membershipStatusController.ts b/src/controller/admin/membershipStatusController.ts similarity index 86% rename from src/controller/admin/settings/membershipStatusController.ts rename to src/controller/admin/membershipStatusController.ts index 9c5fa23..e840773 100644 --- a/src/controller/admin/settings/membershipStatusController.ts +++ b/src/controller/admin/membershipStatusController.ts @@ -1,12 +1,12 @@ import { Request, Response } from "express"; -import MembershipStatusService from "../../../service/settings/membershipStatusService"; -import MembershipStatusFactory from "../../../factory/admin/settings/membershipStatus"; +import MembershipStatusService from "../../service/membershipStatusService"; +import MembershipStatusFactory from "../../factory/admin/membershipStatus"; import { CreateMembershipStatusCommand, DeleteMembershipStatusCommand, UpdateMembershipStatusCommand, -} from "../../../command/settings/membershipStatus/membershipStatusCommand"; -import MembershipStatusCommandHandler from "../../../command/settings/membershipStatus/membershipStatusCommandHandler"; +} from "../../command/membershipStatusCommand"; +import MembershipStatusCommandHandler from "../../command/membershipStatusCommandHandler"; /** * @description get all membershipStatus diff --git a/src/controller/admin/settings/newsletterConfigController.ts b/src/controller/admin/newsletterConfigController.ts similarity index 83% rename from src/controller/admin/settings/newsletterConfigController.ts rename to src/controller/admin/newsletterConfigController.ts index f047816..3abe4b5 100644 --- a/src/controller/admin/settings/newsletterConfigController.ts +++ b/src/controller/admin/newsletterConfigController.ts @@ -1,8 +1,8 @@ import { Request, Response } from "express"; -import NewsletterConfigService from "../../../service/settings/newsletterConfigService"; -import NewsletterConfigFactory from "../../../factory/admin/settings/newsletterConfig"; -import NewsletterConfigCommandHandler from "../../../command/settings/newsletterConfig/newsletterConfigCommandHandler"; -import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "../../../command/settings/newsletterConfig/newsletterConfigCommand"; +import NewsletterConfigService from "../../service/newsletterConfigService"; +import NewsletterConfigFactory from "../../factory/admin/newsletterConfig"; +import NewsletterConfigCommandHandler from "../../command/newsletterConfigCommandHandler"; +import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "../../command/newsletterConfigCommand"; /** * @description get all newsletterConfigs diff --git a/src/controller/admin/club/newsletterController.ts b/src/controller/admin/newsletterController.ts similarity index 86% rename from src/controller/admin/club/newsletterController.ts rename to src/controller/admin/newsletterController.ts index 7c322e9..87e62ca 100644 --- a/src/controller/admin/club/newsletterController.ts +++ b/src/controller/admin/newsletterController.ts @@ -1,24 +1,24 @@ import { Request, Response } from "express"; -import NewsletterService from "../../../service/club/newsletter/newsletterService"; -import NewsletterFactory from "../../../factory/admin/club/newsletter/newsletter"; -import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService"; -import NewsletterDatesFactory from "../../../factory/admin/club/newsletter/newsletterDates"; -import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService"; -import NewsletterRecipientsFactory from "../../../factory/admin/club/newsletter/newsletterRecipients"; -import { FileSystemHelper } from "../../../helpers/fileSystemHelper"; -import { CreateNewsletterCommand, SynchronizeNewsletterCommand } from "../../../command/club/newsletter/newsletterCommand"; -import NewsletterCommandHandler from "../../../command/club/newsletter/newsletterCommandHandler"; -import { SynchronizeNewsletterDatesCommand } from "../../../command/club/newsletter/newsletterDatesCommand"; -import NewsletterDatesCommandHandler from "../../../command/club/newsletter/newsletterDatesCommandHandler"; -import { SynchronizeNewsletterRecipientsCommand } from "../../../command/club/newsletter/newsletterRecipientsCommand"; -import NewsletterRecipientsCommandHandler from "../../../command/club/newsletter/newsletterRecipientsCommandHandler"; -import { NewsletterDatesViewModel } from "../../../viewmodel/admin/club/newsletter/newsletterDates.models"; -import { PdfExport } from "../../../helpers/pdfExport"; -import UserService from "../../../service/user/userService"; -import { TemplateHelper } from "../../../helpers/templateHelper"; -import MailHelper from "../../../helpers/mailHelper"; -import { NewsletterEventType, NewsletterHelper } from "../../../helpers/newsletterHelper"; -import { Salutation } from "../../../enums/salutation"; +import NewsletterService from "../../service/newsletterService"; +import NewsletterFactory from "../../factory/admin/newsletter"; +import NewsletterDatesService from "../../service/newsletterDatesService"; +import NewsletterDatesFactory from "../../factory/admin/newsletterDates"; +import NewsletterRecipientsService from "../../service/newsletterRecipientsService"; +import NewsletterRecipientsFactory from "../../factory/admin/newsletterRecipients"; +import { FileSystemHelper } from "../../helpers/fileSystemHelper"; +import { CreateNewsletterCommand, SynchronizeNewsletterCommand } from "../../command/newsletterCommand"; +import NewsletterCommandHandler from "../../command/newsletterCommandHandler"; +import { SynchronizeNewsletterDatesCommand } from "../../command/newsletterDatesCommand"; +import NewsletterDatesCommandHandler from "../../command/newsletterDatesCommandHandler"; +import { SynchronizeNewsletterRecipientsCommand } from "../../command/newsletterRecipientsCommand"; +import NewsletterRecipientsCommandHandler from "../../command/newsletterRecipientsCommandHandler"; +import { NewsletterDatesViewModel } from "../../viewmodel/admin/newsletterDates.models"; +import { PdfExport } from "../../helpers/pdfExport"; +import UserService from "../../service/userService"; +import { TemplateHelper } from "../../helpers/templateHelper"; +import MailHelper from "../../helpers/mailHelper"; +import { NewsletterEventType, NewsletterHelper } from "../../helpers/newsletterHelper"; +import { Salutation } from "../../enums/salutation"; /** * @description get all newsletters diff --git a/src/controller/admin/club/protocolController.ts b/src/controller/admin/protocolController.ts similarity index 75% rename from src/controller/admin/club/protocolController.ts rename to src/controller/admin/protocolController.ts index bba8aa0..a82608f 100644 --- a/src/controller/admin/club/protocolController.ts +++ b/src/controller/admin/protocolController.ts @@ -1,34 +1,33 @@ import { Request, Response } from "express"; -import ProtocolService from "../../../service/club/protocol/protocolService"; -import ProtocolFactory from "../../../factory/admin/club/protocol/protocol"; -import ProtocolAgendaService from "../../../service/club/protocol/protocolAgendaService"; -import ProtocolAgendaFactory from "../../../factory/admin/club/protocol/protocolAgenda"; -import ProtocolDecisionService from "../../../service/club/protocol/protocolDecisionService"; -import ProtocolDecisionFactory from "../../../factory/admin/club/protocol/protocolDecision"; -import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService"; -import ProtocolPresenceFactory from "../../../factory/admin/club/protocol/protocolPresence"; -import ProtocolVotingService from "../../../service/club/protocol/protocolVotingService"; -import ProtocolVotingFactory from "../../../factory/admin/club/protocol/protocolVoting"; -import { CreateProtocolCommand, SynchronizeProtocolCommand } from "../../../command/club/protocol/protocolCommand"; -import ProtocolCommandHandler from "../../../command/club/protocol/protocolCommandHandler"; -import { SynchronizeProtocolAgendaCommand } from "../../../command/club/protocol/protocolAgendaCommand"; -import ProtocolAgendaCommandHandler from "../../../command/club/protocol/protocolAgendaCommandHandler"; -import { ProtocolAgendaViewModel } from "../../../viewmodel/admin/club/protocol/protocolAgenda.models"; -import ProtocolDecisionCommandHandler from "../../../command/club/protocol/protocolDecisionCommandHandler"; -import { ProtocolDecisionViewModel } from "../../../viewmodel/admin/club/protocol/protocolDecision.models"; -import ProtocolPresenceCommandHandler from "../../../command/club/protocol/protocolPresenceCommandHandler"; -import { SynchronizeProtocolPresenceCommand } from "../../../command/club/protocol/protocolPresenceCommand"; -import { SynchronizeProtocolDecisionCommand } from "../../../command/club/protocol/protocolDecisionCommand"; -import { SynchronizeProtocolVotingCommand } from "../../../command/club/protocol/protocolVotingCommand"; -import { ProtocolVotingViewModel } from "../../../viewmodel/admin/club/protocol/protocolVoting.models"; -import ProtocolVotingCommandHandler from "../../../command/club/protocol/protocolVotingCommandHandler"; -import { PdfExport } from "../../../helpers/pdfExport"; -import ProtocolPrintoutService from "../../../service/club/protocol/protocolPrintoutService"; -import ProtocolPrintoutFactory from "../../../factory/admin/club/protocol/protocolPrintout"; -import { CreateProtocolPrintoutCommand } from "../../../command/club/protocol/protocolPrintoutCommand"; -import ProtocolPrintoutCommandHandler from "../../../command/club/protocol/protocolPrintoutCommandHandler"; -import { FileSystemHelper } from "../../../helpers/fileSystemHelper"; -import { ProtocolPresenceViewModel } from "../../../viewmodel/admin/club/protocol/protocolPresence.models"; +import ProtocolService from "../../service/protocolService"; +import ProtocolFactory from "../../factory/admin/protocol"; +import ProtocolAgendaService from "../../service/protocolAgendaService"; +import ProtocolAgendaFactory from "../../factory/admin/protocolAgenda"; +import ProtocolDecisionService from "../../service/protocolDecisionService"; +import ProtocolDecisionFactory from "../../factory/admin/protocolDecision"; +import ProtocolPresenceService from "../../service/protocolPrecenseService"; +import ProtocolPresenceFactory from "../../factory/admin/protocolPresence"; +import ProtocolVotingService from "../../service/protocolVotingService"; +import ProtocolVotingFactory from "../../factory/admin/protocolVoting"; +import { CreateProtocolCommand, SynchronizeProtocolCommand } from "../../command/protocolCommand"; +import ProtocolCommandHandler from "../../command/protocolCommandHandler"; +import { SynchronizeProtocolAgendaCommand } from "../../command/protocolAgendaCommand"; +import ProtocolAgendaCommandHandler from "../../command/protocolAgendaCommandHandler"; +import { ProtocolAgendaViewModel } from "../../viewmodel/admin/protocolAgenda.models"; +import ProtocolDecisionCommandHandler from "../../command/protocolDecisionCommandHandler"; +import { ProtocolDecisionViewModel } from "../../viewmodel/admin/protocolDecision.models"; +import ProtocolPresenceCommandHandler from "../../command/protocolPresenceCommandHandler"; +import { SynchronizeProtocolPresenceCommand } from "../../command/protocolPresenceCommand"; +import { SynchronizeProtocolDecisionCommand } from "../../command/protocolDecisionCommand"; +import { SynchronizeProtocolVotingCommand } from "../../command/protocolVotingCommand"; +import { ProtocolVotingViewModel } from "../../viewmodel/admin/protocolVoting.models"; +import ProtocolVotingCommandHandler from "../../command/protocolVotingCommandHandler"; +import { PdfExport } from "../../helpers/pdfExport"; +import ProtocolPrintoutService from "../../service/protocolPrintoutService"; +import ProtocolPrintoutFactory from "../../factory/admin/protocolPrintout"; +import { CreateProtocolPrintoutCommand } from "../../command/protocolPrintoutCommand"; +import ProtocolPrintoutCommandHandler from "../../command/protocolPrintoutCommandHandler"; +import { FileSystemHelper } from "../../helpers/fileSystemHelper"; /** * @description get all protocols @@ -144,9 +143,7 @@ export async function getProtocolPrintoutByIdAndPrint(req: Request, res: Respons let printout = await ProtocolPrintoutService.getById(printoutId, protocolId); - let filepath = FileSystemHelper.formatPath("protocol", printout.filename); - - res.sendFile(filepath, { + res.sendFile(process.cwd() + `/export/${printout.filename}.pdf`, { headers: { "Content-Type": "application/pdf", }, @@ -229,7 +226,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P let votings = await ProtocolVotingService.getAll(protocolId); let iteration = await ProtocolPrintoutService.getCount(protocolId); - let title = `${protocol.title} - ${new Date(protocol.date).toLocaleDateString("de-DE", { + let title = `Sitzungsprotokoll - ${new Date(protocol.date).toLocaleDateString("de-DE", { day: "2-digit", month: "long", year: "numeric", @@ -259,8 +256,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P end: protocol.endtime, agenda, decisions, - presence: presence.filter((p) => !p.absent).map((p) => p.member), - absent: presence.filter((p) => p.absent).map((p) => p.member), + presence: presence.map((p) => p.member), votings, }, }); @@ -268,7 +264,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P let printout: CreateProtocolPrintoutCommand = { title, iteration: iteration + 1, - filename: `${filename}.pdf`, + filename: FileSystemHelper.normalizePath("protocol", filename), protocolId, }; await ProtocolPrintoutCommandHandler.create(printout); @@ -383,13 +379,10 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response */ export async function synchronizeProtocolPrecenseById(req: Request, res: Response): Promise { let protocolId = parseInt(req.params.protocolId); - let presence = req.body.presence as Array; + let presence = req.body.presence as Array; let syncPresence: SynchronizeProtocolPresenceCommand = { - members: presence.map((p) => ({ - memberId: p.memberId, - absent: p.absent, - })), + memberIds: presence, protocolId, }; await ProtocolPresenceCommandHandler.sync(syncPresence); diff --git a/src/controller/admin/settings/qualificationController.ts b/src/controller/admin/qualificationController.ts similarity index 88% rename from src/controller/admin/settings/qualificationController.ts rename to src/controller/admin/qualificationController.ts index 75c9b15..c7074d5 100644 --- a/src/controller/admin/settings/qualificationController.ts +++ b/src/controller/admin/qualificationController.ts @@ -1,12 +1,12 @@ import { Request, Response } from "express"; -import QualificationService from "../../../service/settings/qualification"; -import QualificationFactory from "../../../factory/admin/settings/qualification"; +import QualificationService from "../../service/qualification"; +import QualificationFactory from "../../factory/admin/qualification"; import { CreateQualificationCommand, DeleteQualificationCommand, UpdateQualificationCommand, -} from "../../../command/settings/qualification/qualificationCommand"; -import QualificationCommandHandler from "../../../command/settings/qualification/qualificationCommandHandler"; +} from "../../command/qualificationCommand"; +import QualificationCommandHandler from "../../command/qualificationCommandHandler"; /** * @description get all qualifications diff --git a/src/controller/admin/queryBuilderController.ts b/src/controller/admin/queryBuilderController.ts new file mode 100644 index 0000000..e6bb519 --- /dev/null +++ b/src/controller/admin/queryBuilderController.ts @@ -0,0 +1,108 @@ +import { Request, Response } from "express"; +import DynamicQueryBuilder from "../../helpers/dynamicQueryBuilder"; +import { dataSource } from "../../data-source"; + +/** + * @description get all table metas + * @param req {Request} Express req object + * @param res {Response} Express res object + * @returns {Promise<*>} + */ +export async function getAllTableMeta(req: Request, res: Response): Promise { + let tableMetas = DynamicQueryBuilder.getAllTableMeta(); + + res.json(tableMetas); +} + +/** + * @description get meta by tablename + * @param req {Request} Express req object + * @param res {Response} Express res object + * @returns {Promise<*>} + */ +export async function getTableMetaByTablename(req: Request, res: Response): Promise { + const tablename = req.params.tablename; + let tableMeta = DynamicQueryBuilder.getTableMeta(tablename); + + res.json(tableMeta); +} + +/** + * @description execute Query + * @param req {Request} Express req object + * @param res {Response} Express res object + * @returns {Promise<*>} + */ +export async function executeQuery(req: Request, res: Response): Promise { + let offset = parseInt((req.query.offset as string) ?? "0"); + let count = parseInt((req.query.count as string) ?? "25"); + const query = req.body.query; + + if (typeof query == "string") { + const upperQuery = query.trim().toUpperCase(); + if (!upperQuery.startsWith("SELECT") || /INSERT|UPDATE|DELETE|ALTER|DROP|CREATE|TRUNCATE/.test(upperQuery)) { + return res.json({ + stats: "error", + sql: query, + code: "UNALLOWED", + msg: "Not allowed to change rows", + }); + } + + try { + let data: Array = []; + + const result = await dataSource + .transaction(async (manager) => { + data = await manager.query(query); + + throw new Error("AllwaysRollbackQuery"); + }) + .catch((error) => { + if (error.message === "AllwaysRollbackQuery") { + return { + stats: "success", + rows: data, + total: data.length, + offset: offset, + count: count, + }; + } else { + return { + stats: "error", + sql: error.sql, + code: error.code, + msg: error.sqlMessage, + }; + } + }); + res.send(result); + } catch (error) { + res.json({ + stats: "error", + sql: error.sql, + code: error.code, + msg: error.sqlMessage, + }); + } + } else { + try { + let [rows, total] = await DynamicQueryBuilder.buildQuery(query, offset, count).getManyAndCount(); + + res.json({ + stats: "success", + rows: DynamicQueryBuilder.flattenQueryResult(rows), + total: total, + offset: offset, + count: count, + }); + } catch (error) { + res.json({ + stats: "error", + sql: error.sql, + code: error.code, + msg: error.sqlMessage, + }); + } + } +} diff --git a/src/controller/admin/settings/queryStoreController.ts b/src/controller/admin/queryStoreController.ts similarity index 87% rename from src/controller/admin/settings/queryStoreController.ts rename to src/controller/admin/queryStoreController.ts index 397b898..6c6e9c6 100644 --- a/src/controller/admin/settings/queryStoreController.ts +++ b/src/controller/admin/queryStoreController.ts @@ -1,12 +1,12 @@ import { Request, Response } from "express"; -import QueryStoreFactory from "../../../factory/admin/settings/queryStore"; -import QueryStoreService from "../../../service/settings/queryStoreService"; +import QueryStoreFactory from "../../factory/admin/queryStore"; +import QueryStoreService from "../../service/queryStoreService"; import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand, -} from "../../../command/settings/queryStore/queryStoreCommand"; -import QueryStoreCommandHandler from "../../../command/settings/queryStore/queryStoreCommandHandler"; +} from "../../command/queryStoreCommand"; +import QueryStoreCommandHandler from "../../command/queryStoreCommandHandler"; /** * @description get all queryStores diff --git a/src/controller/admin/user/roleController.ts b/src/controller/admin/roleController.ts similarity index 83% rename from src/controller/admin/user/roleController.ts rename to src/controller/admin/roleController.ts index f482b63..67f6f78 100644 --- a/src/controller/admin/user/roleController.ts +++ b/src/controller/admin/roleController.ts @@ -1,12 +1,12 @@ import { Request, Response } from "express"; -import RoleService from "../../../service/user/roleService"; -import RoleFactory from "../../../factory/admin/user/role"; -import RolePermissionService from "../../../service/user/rolePermissionService"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../../command/user/role/roleCommand"; -import RoleCommandHandler from "../../../command/user/role/roleCommandHandler"; -import { UpdateRolePermissionsCommand } from "../../../command/user/role/rolePermissionCommand"; -import RolePermissionCommandHandler from "../../../command/user/role/rolePermissionCommandHandler"; +import RoleService from "../../service/roleService"; +import RoleFactory from "../../factory/admin/role"; +import RolePermissionService from "../../service/rolePermissionService"; +import PermissionHelper from "../../helpers/permissionHelper"; +import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../command/roleCommand"; +import RoleCommandHandler from "../../command/roleCommandHandler"; +import { UpdateRolePermissionsCommand } from "../../command/rolePermissionCommand"; +import RolePermissionCommandHandler from "../../command/rolePermissionCommandHandler"; /** * @description get All roles diff --git a/src/controller/admin/settings/templateController.ts b/src/controller/admin/templateController.ts similarity index 91% rename from src/controller/admin/settings/templateController.ts rename to src/controller/admin/templateController.ts index eb9d31e..9f867f9 100644 --- a/src/controller/admin/settings/templateController.ts +++ b/src/controller/admin/templateController.ts @@ -1,8 +1,8 @@ import { Request, Response } from "express"; -import TemplateService from "../../../service/settings/templateService"; -import TemplateFactory from "../../../factory/admin/settings/template"; -import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "../../../command/settings/template/templateCommand"; -import TemplateCommandHandler from "../../../command/settings/template/templateCommandHandler"; +import TemplateService from "../../service/templateService"; +import TemplateFactory from "../../factory/admin/template"; +import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "../../command/templateCommand"; +import TemplateCommandHandler from "../../command/templateCommandHandler"; /** * @description get all templates diff --git a/src/controller/admin/settings/templateUsageController.ts b/src/controller/admin/templateUsageController.ts similarity index 76% rename from src/controller/admin/settings/templateUsageController.ts rename to src/controller/admin/templateUsageController.ts index eb8b71f..0a75af3 100644 --- a/src/controller/admin/settings/templateUsageController.ts +++ b/src/controller/admin/templateUsageController.ts @@ -1,13 +1,13 @@ import { Request, Response } from "express"; -import TemplateUsageService from "../../../service/settings/templateUsageService"; -import TemplateUsageFactory from "../../../factory/admin/settings/templateUsage"; -import { UpdateTemplateUsageCommand } from "../../../command/settings/templateUsage/templateUsageCommand"; -import TemplateUsageCommandHandler from "../../../command/settings/templateUsage/templateUsageCommandHandler"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import ForbiddenRequestException from "../../../exceptions/forbiddenRequestException"; -import { PermissionModule } from "../../../type/permissionTypes"; -import { PdfExport } from "../../../helpers/pdfExport"; -import { DemoDataHelper } from "../../../helpers/demoDataHelper"; +import TemplateUsageService from "../../service/templateUsageService"; +import TemplateUsageFactory from "../../factory/admin/templateUsage"; +import { UpdateTemplateUsageCommand } from "../../command/templateUsageCommand"; +import TemplateUsageCommandHandler from "../../command/templateUsageCommandHandler"; +import PermissionHelper from "../../helpers/permissionHelper"; +import ForbiddenRequestException from "../../exceptions/forbiddenRequestException"; +import { PermissionModule } from "../../type/permissionTypes"; +import { PdfExport } from "../../helpers/pdfExport"; +import { DemoDataHelper } from "../../helpers/demoDataHelper"; /** * @description get all templateUsages @@ -21,8 +21,8 @@ export async function getAllTemplateUsages(req: Request, res: Response): Promise if (!req.isOwner) { templateUsages = templateUsages.filter((tu) => { return ( - PermissionHelper.can(req.permissions, "update", "settings", tu.scope.split(".")[0] as PermissionModule) || - PermissionHelper.can(req.permissions, "update", "club", tu.scope.split(".")[0] as PermissionModule) + PermissionHelper.can(req.permissions, "update", "settings", tu.scope) || + PermissionHelper.can(req.permissions, "update", "club", tu.scope) ); }); } diff --git a/src/controller/admin/user/userController.ts b/src/controller/admin/userController.ts similarity index 84% rename from src/controller/admin/user/userController.ts rename to src/controller/admin/userController.ts index 8862699..0177fec 100644 --- a/src/controller/admin/user/userController.ts +++ b/src/controller/admin/userController.ts @@ -1,15 +1,15 @@ import { Request, Response } from "express"; -import UserService from "../../../service/user/userService"; -import UserFactory from "../../../factory/admin/user/user"; -import UserPermissionService from "../../../service/user/userPermissionService"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import RoleFactory from "../../../factory/admin/user/role"; -import { DeleteUserCommand, UpdateUserCommand, UpdateUserRolesCommand } from "../../../command/user/user/userCommand"; -import UserCommandHandler from "../../../command/user/user/userCommandHandler"; -import MailHelper from "../../../helpers/mailHelper"; -import { CLUB_NAME } from "../../../env.defaults"; -import { UpdateUserPermissionsCommand } from "../../../command/user/user/userPermissionCommand"; -import UserPermissionCommandHandler from "../../../command/user/user/userPermissionCommandHandler"; +import UserService from "../../service/userService"; +import UserFactory from "../../factory/admin/user"; +import UserPermissionService from "../../service/userPermissionService"; +import PermissionHelper from "../../helpers/permissionHelper"; +import RoleFactory from "../../factory/admin/role"; +import { DeleteUserCommand, UpdateUserCommand, UpdateUserRolesCommand } from "../../command/userCommand"; +import UserCommandHandler from "../../command/userCommandHandler"; +import MailHelper from "../../helpers/mailHelper"; +import { CLUB_NAME } from "../../env.defaults"; +import { UpdateUserPermissionsCommand } from "../../command/userPermissionCommand"; +import UserPermissionCommandHandler from "../../command/userPermissionCommandHandler"; /** * @description get All users diff --git a/src/controller/authController.ts b/src/controller/authController.ts index dd4fee7..7b2494b 100644 --- a/src/controller/authController.ts +++ b/src/controller/authController.ts @@ -4,13 +4,13 @@ import { JWTToken } from "../type/jwtTypes"; import InternalException from "../exceptions/internalException"; import RefreshCommandHandler from "../command/refreshCommandHandler"; import { CreateRefreshCommand, DeleteRefreshCommand } from "../command/refreshCommand"; -import UserService from "../service/user/userService"; +import UserService from "../service/userService"; import speakeasy from "speakeasy"; import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException"; import RefreshService from "../service/refreshService"; -import UserPermissionService from "../service/user/userPermissionService"; +import UserPermissionService from "../service/userPermissionService"; import PermissionHelper from "../helpers/permissionHelper"; -import RolePermissionService from "../service/user/rolePermissionService"; +import RolePermissionService from "../service/rolePermissionService"; /** * @description Check authentication status by token diff --git a/src/controller/inviteController.ts b/src/controller/inviteController.ts index 544aa14..bb08cd6 100644 --- a/src/controller/inviteController.ts +++ b/src/controller/inviteController.ts @@ -7,18 +7,18 @@ import { CreateRefreshCommand } from "../command/refreshCommand"; import speakeasy from "speakeasy"; import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException"; import QRCode from "qrcode"; -import { CreateUserCommand } from "../command/user/user/userCommand"; -import UserCommandHandler from "../command/user/user/userCommandHandler"; -import { CreateInviteCommand, DeleteInviteCommand } from "../command/user/user/inviteCommand"; -import InviteCommandHandler from "../command/user/user/inviteCommandHandler"; +import { CreateUserCommand } from "../command/userCommand"; +import UserCommandHandler from "../command/userCommandHandler"; +import { CreateInviteCommand, DeleteInviteCommand } from "../command/inviteCommand"; +import InviteCommandHandler from "../command/inviteCommandHandler"; import MailHelper from "../helpers/mailHelper"; -import InviteService from "../service/user/inviteService"; -import UserService from "../service/user/userService"; +import InviteService from "../service/inviteService"; +import UserService from "../service/userService"; import CustomRequestException from "../exceptions/customRequestException"; import { CLUB_NAME } from "../env.defaults"; -import { CreateUserPermissionCommand } from "../command/user/user/userPermissionCommand"; -import UserPermissionCommandHandler from "../command/user/user/userPermissionCommandHandler"; -import InviteFactory from "../factory/admin/user/invite"; +import { CreateUserPermissionCommand } from "../command/userPermissionCommand"; +import UserPermissionCommandHandler from "../command/userPermissionCommandHandler"; +import InviteFactory from "../factory/admin/invite"; /** * @description get all invites diff --git a/src/controller/publicController.ts b/src/controller/publicController.ts index b3bf2b0..d933522 100644 --- a/src/controller/publicController.ts +++ b/src/controller/publicController.ts @@ -1,11 +1,11 @@ import { Request, Response } from "express"; -import CalendarService from "../service/club/calendarService"; -import CalendarTypeService from "../service/settings/calendarTypeService"; -import { calendar } from "../entity/club/calendar"; +import CalendarService from "../service/calendarService"; +import CalendarTypeService from "../service/calendarTypeService"; +import { calendar } from "../entity/calendar"; import { createEvents } from "ics"; import moment from "moment"; import InternalException from "../exceptions/internalException"; -import CalendarFactory from "../factory/admin/club/calendar"; +import CalendarFactory from "../factory/admin/calendar"; import { CalendarHelper } from "../helpers/calendarHelper"; /** diff --git a/src/controller/resetController.ts b/src/controller/resetController.ts index eec65b4..fe0554c 100644 --- a/src/controller/resetController.ts +++ b/src/controller/resetController.ts @@ -11,13 +11,13 @@ import { CreateResetCommand, DeleteResetCommand } from "../command/resetCommand" import ResetCommandHandler from "../command/resetCommandHandler"; import MailHelper from "../helpers/mailHelper"; import ResetService from "../service/resetService"; -import UserService from "../service/user/userService"; +import UserService from "../service/userService"; import { CLUB_NAME } from "../env.defaults"; import PermissionHelper from "../helpers/permissionHelper"; -import RolePermissionService from "../service/user/rolePermissionService"; -import UserPermissionService from "../service/user/userPermissionService"; -import { UpdateUserSecretCommand } from "../command/user/user/userCommand"; -import UserCommandHandler from "../command/user/user/userCommandHandler"; +import RolePermissionService from "../service/rolePermissionService"; +import UserPermissionService from "../service/userPermissionService"; +import { UpdateUserSecretCommand } from "../command/userCommand"; +import UserCommandHandler from "../command/userCommandHandler"; /** * @description request totp reset diff --git a/src/controller/userController.ts b/src/controller/userController.ts index a29487b..ebea67a 100644 --- a/src/controller/userController.ts +++ b/src/controller/userController.ts @@ -3,10 +3,10 @@ import speakeasy from "speakeasy"; import QRCode from "qrcode"; import InternalException from "../exceptions/internalException"; import { CLUB_NAME } from "../env.defaults"; -import UserService from "../service/user/userService"; -import UserFactory from "../factory/admin/user/user"; -import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/user/user/userCommand"; -import UserCommandHandler from "../command/user/user/userCommandHandler"; +import UserService from "../service/userService"; +import UserFactory from "../factory/admin/user"; +import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/userCommand"; +import UserCommandHandler from "../command/userCommandHandler"; import ForbiddenRequestException from "../exceptions/forbiddenRequestException"; /** diff --git a/src/data-source.ts b/src/data-source.ts index 7af52a0..8074d2d 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -3,18 +3,18 @@ import "reflect-metadata"; import { DataSource } from "typeorm"; import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE } from "./env.defaults"; -import { user } from "./entity/user/user"; +import { user } from "./entity/user"; import { refresh } from "./entity/refresh"; -import { invite } from "./entity/user/invite"; -import { userPermission } from "./entity/user/user_permission"; -import { role } from "./entity/user/role"; -import { rolePermission } from "./entity/user/role_permission"; -import { award } from "./entity/settings/award"; -import { communication } from "./entity/club/member/communication"; -import { communicationType } from "./entity/settings/communicationType"; -import { executivePosition } from "./entity/settings/executivePosition"; -import { membershipStatus } from "./entity/settings/membershipStatus"; -import { qualification } from "./entity/settings/qualification"; +import { invite } from "./entity/invite"; +import { userPermission } from "./entity/user_permission"; +import { role } from "./entity/role"; +import { rolePermission } from "./entity/role_permission"; +import { award } from "./entity/award"; +import { communication } from "./entity/communication"; +import { communicationType } from "./entity/communicationType"; +import { executivePosition } from "./entity/executivePosition"; +import { membershipStatus } from "./entity/membershipStatus"; +import { qualification } from "./entity/qualification"; import { Initial1724317398939 } from "./migrations/1724317398939-initial"; import { RefreshPrimaryChange1724573307851 } from "./migrations/1724573307851-refreshPrimaryChange"; @@ -22,50 +22,48 @@ import { Invite1724579024939 } from "./migrations/1724579024939-invite"; import { Permissions1724661484664 } from "./migrations/1724661484664-permissions"; import { RolePermission1724771491085 } from "./migrations/1724771491085-role_permission"; import { MemberBaseData1725435669492 } from "./migrations/1725435669492-member_base_data"; -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"; +import { member } from "./entity/member"; +import { memberAwards } from "./entity/memberAwards"; +import { memberExecutivePositions } from "./entity/memberExecutivePositions"; +import { memberQualifications } from "./entity/memberQualifications"; +import { membership } from "./entity/membership"; import { Memberdata1726301836849 } from "./migrations/1726301836849-memberdata"; import { CommunicationFields1727439800630 } from "./migrations/1727439800630-communicationFields"; import { Ownership1728313041449 } from "./migrations/1728313041449-ownership"; -import { protocol } from "./entity/club/protocol/protocol"; -import { protocolAgenda } from "./entity/club/protocol/protocolAgenda"; -import { protocolDecision } from "./entity/club/protocol/protocolDecision"; -import { protocolPresence } from "./entity/club/protocol/protocolPresence"; -import { protocolVoting } from "./entity/club/protocol/protocolVoting"; -import { protocolPrintout } from "./entity/club/protocol/protocolPrintout"; +import { protocol } from "./entity/protocol"; +import { protocolAgenda } from "./entity/protocolAgenda"; +import { protocolDecision } from "./entity/protocolDecision"; +import { protocolPresence } from "./entity/protocolPresence"; +import { protocolVoting } from "./entity/protocolVoting"; +import { protocolPrintout } from "./entity/protocolPrintout"; import { Protocol1729347911107 } from "./migrations/1729347911107-protocol"; -import { calendar } from "./entity/club/calendar"; -import { calendarType } from "./entity/settings/calendarType"; +import { calendar } from "./entity/calendar"; +import { calendarType } from "./entity/calendarType"; import { Calendar1729947763295 } from "./migrations/1729947763295-calendar"; import { reset } from "./entity/reset"; import { ResetToken1732358596823 } from "./migrations/1732358596823-resetToken"; import { SMSAlarming1732696919191 } from "./migrations/1732696919191-SMSAlarming"; import { SecuringCalendarType1733249553766 } from "./migrations/1733249553766-securingCalendarType"; -import { query } from "./entity/settings/query"; +import { query } from "./entity/query"; import { QueryStore1734187754677 } from "./migrations/1734187754677-queryStore"; import { memberView } from "./views/memberView"; import { memberExecutivePositionsView } from "./views/memberExecutivePositionView"; import { memberQualificationsView } from "./views/memberQualificationsView"; import { membershipView } from "./views/membershipsView"; import { MemberDataViews1734520998539 } from "./migrations/1734520998539-memberDataViews"; -import { template } from "./entity/settings/template"; +import { template } from "./entity/template"; import { Template1734854680201 } from "./migrations/1734854680201-template"; -import { templateUsage } from "./entity/settings/templateUsage"; +import { templateUsage } from "./entity/templateUsage"; import { TemplateUsage1734949173739 } from "./migrations/1734949173739-templateUsage"; -import { newsletter } from "./entity/club/newsletter/newsletter"; -import { newsletterDates } from "./entity/club/newsletter/newsletterDates"; -import { newsletterRecipients } from "./entity/club/newsletter/newsletterRecipients"; +import { newsletter } from "./entity/newsletter"; +import { newsletterDates } from "./entity/newsletterDates"; +import { newsletterRecipients } from "./entity/newsletterRecipients"; import { Newsletter1735118780511 } from "./migrations/1735118780511-newsletter"; -import { newsletterConfig } from "./entity/settings/newsletterConfig"; +import { newsletterConfig } from "./entity/newsletterConfig"; import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig"; +import { TemplateMargins1735733514043 } from "./migrations/1735733514043-templateMargins"; import { InternalId1735822722235 } from "./migrations/1735822722235-internalId"; import { PostalCode1735927918979 } from "./migrations/1735927918979-postalCode"; -import { ProtocolAbsent1736072179716 } from "./migrations/1736072179716-protocolAbsent"; -import { Memberlist1736079005086 } from "./migrations/1736079005086-memberlist"; -import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extendViewValues"; const dataSource = new DataSource({ type: DB_TYPE as any, @@ -137,11 +135,9 @@ const dataSource = new DataSource({ TemplateUsage1734949173739, Newsletter1735118780511, NewsletterConfig1735207446910, + TemplateMargins1735733514043, InternalId1735822722235, PostalCode1735927918979, - ProtocolAbsent1736072179716, - Memberlist1736079005086, - ExtendViewValues1736084198860, ], migrationsRun: true, migrationsTransactionMode: "each", diff --git a/src/demodata/member.list.data.ts b/src/demodata/member.list.data.ts deleted file mode 100644 index 7244fd9..0000000 --- a/src/demodata/member.list.data.ts +++ /dev/null @@ -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> } = { - member: [ - { - firstname: "Julian", - lastname: "Krauser", - }, - ] -} diff --git a/src/demodata/newsletter.data.ts b/src/demodata/newsletter.data.ts index 8729264..41a81f4 100644 --- a/src/demodata/newsletter.data.ts +++ b/src/demodata/newsletter.data.ts @@ -1,5 +1,5 @@ -import { calendar } from "../entity/club/calendar"; -import { member } from "../entity/club/member/member"; +import { calendar } from "../entity/calendar"; +import { member } from "../entity/member"; import { Salutation } from "../enums/salutation"; export const newsletterDemoData: { diff --git a/src/demodata/protocol.data.ts b/src/demodata/protocol.data.ts index 8d18b2a..1feeace 100644 --- a/src/demodata/protocol.data.ts +++ b/src/demodata/protocol.data.ts @@ -1,7 +1,7 @@ -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"; +import { member } from "../entity/member"; +import { protocolAgenda } from "../entity/protocolAgenda"; +import { protocolDecision } from "../entity/protocolDecision"; +import { protocolVoting } from "../entity/protocolVoting"; export const protocolDemoData: { title: string; @@ -13,7 +13,6 @@ export const protocolDemoData: { agenda: Array>; decisions: Array>; presence: Array>; - absent: Array>; votings: Array>; } = { title: "Beispiel Protokoll Daten", @@ -45,7 +44,6 @@ export const protocolDemoData: { lastname: "Krauser", }, ], - absent: [], votings: [ { topic: "Abstimmung xy", diff --git a/src/entity/settings/award.ts b/src/entity/award.ts similarity index 84% rename from src/entity/settings/award.ts rename to src/entity/award.ts index 74d5260..cf26689 100644 --- a/src/entity/settings/award.ts +++ b/src/entity/award.ts @@ -1,5 +1,5 @@ import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm"; -import { memberAwards } from "../club/member/memberAwards"; +import { memberAwards } from "./memberAwards"; @Entity() export class award { diff --git a/src/entity/club/calendar.ts b/src/entity/calendar.ts similarity index 94% rename from src/entity/club/calendar.ts rename to src/entity/calendar.ts index c8c2cb6..041a998 100644 --- a/src/entity/club/calendar.ts +++ b/src/entity/calendar.ts @@ -9,7 +9,7 @@ import { AfterUpdate, BeforeUpdate, } from "typeorm"; -import { calendarType } from "../settings/calendarType"; +import { calendarType } from "./calendarType"; @Entity() export class calendar { diff --git a/src/entity/settings/calendarType.ts b/src/entity/calendarType.ts similarity index 93% rename from src/entity/settings/calendarType.ts rename to src/entity/calendarType.ts index 1e99e26..0214117 100644 --- a/src/entity/settings/calendarType.ts +++ b/src/entity/calendarType.ts @@ -1,5 +1,5 @@ import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm"; -import { calendar } from "../club/calendar"; +import { calendar } from "./calendar"; @Entity() export class calendarType { diff --git a/src/entity/club/member/communication.ts b/src/entity/communication.ts similarity index 95% rename from src/entity/club/member/communication.ts rename to src/entity/communication.ts index 42b1bd7..df081be 100644 --- a/src/entity/club/member/communication.ts +++ b/src/entity/communication.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { member } from "./member"; -import { communicationType } from "../../settings/communicationType"; +import { communicationType } from "./communicationType"; @Entity() export class communication { diff --git a/src/entity/settings/communicationType.ts b/src/entity/communicationType.ts similarity index 90% rename from src/entity/settings/communicationType.ts rename to src/entity/communicationType.ts index 1c81be5..c9161df 100644 --- a/src/entity/settings/communicationType.ts +++ b/src/entity/communicationType.ts @@ -1,6 +1,6 @@ import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm"; -import { communication } from "../club/member/communication"; -import { CommunicationFieldType, communicationFieldTypes } from "../../type/fieldTypes"; +import { communication } from "./communication"; +import { CommunicationFieldType, communicationFieldTypes } from "../type/fieldTypes"; @Entity() export class communicationType { diff --git a/src/entity/settings/executivePosition.ts b/src/entity/executivePosition.ts similarity index 82% rename from src/entity/settings/executivePosition.ts rename to src/entity/executivePosition.ts index 8d77bf7..e88cea2 100644 --- a/src/entity/settings/executivePosition.ts +++ b/src/entity/executivePosition.ts @@ -1,5 +1,5 @@ import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm"; -import { memberExecutivePositions } from "../club/member/memberExecutivePositions"; +import { memberExecutivePositions } from "./memberExecutivePositions"; @Entity() export class executivePosition { diff --git a/src/entity/user/invite.ts b/src/entity/invite.ts similarity index 100% rename from src/entity/user/invite.ts rename to src/entity/invite.ts diff --git a/src/entity/club/member/member.ts b/src/entity/member.ts similarity index 92% rename from src/entity/club/member/member.ts rename to src/entity/member.ts index 1defb1f..6fef6cf 100644 --- a/src/entity/club/member/member.ts +++ b/src/entity/member.ts @@ -1,11 +1,11 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm"; -import { Salutation } from "../../../enums/salutation"; +import { Salutation } from "../enums/salutation"; import { membership } from "./membership"; import { memberAwards } from "./memberAwards"; import { memberQualifications } from "./memberQualifications"; import { memberExecutivePositions } from "./memberExecutivePositions"; import { communication } from "./communication"; -import { CommunicationViewModel } from "../../../viewmodel/admin/club/member/communication.models"; +import { CommunicationViewModel } from "../viewmodel/admin/communication.models"; @Entity() export class member { diff --git a/src/entity/club/member/memberAwards.ts b/src/entity/memberAwards.ts similarity index 94% rename from src/entity/club/member/memberAwards.ts rename to src/entity/memberAwards.ts index ef5b473..e25420e 100644 --- a/src/entity/club/member/memberAwards.ts +++ b/src/entity/memberAwards.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { member } from "./member"; -import { award } from "../../settings/award"; +import { award } from "./award"; @Entity() export class memberAwards { diff --git a/src/entity/club/member/memberExecutivePositions.ts b/src/entity/memberExecutivePositions.ts similarity index 92% rename from src/entity/club/member/memberExecutivePositions.ts rename to src/entity/memberExecutivePositions.ts index b4475ef..fea07e9 100644 --- a/src/entity/club/member/memberExecutivePositions.ts +++ b/src/entity/memberExecutivePositions.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { member } from "./member"; -import { executivePosition } from "../../settings/executivePosition"; +import { executivePosition } from "./executivePosition"; @Entity() export class memberExecutivePositions { diff --git a/src/entity/club/member/memberQualifications.ts b/src/entity/memberQualifications.ts similarity index 93% rename from src/entity/club/member/memberQualifications.ts rename to src/entity/memberQualifications.ts index c4d7d09..bbc67e9 100644 --- a/src/entity/club/member/memberQualifications.ts +++ b/src/entity/memberQualifications.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { member } from "./member"; -import { qualification } from "../../settings/qualification"; +import { qualification } from "./qualification"; @Entity() export class memberQualifications { diff --git a/src/entity/club/member/membership.ts b/src/entity/membership.ts similarity index 93% rename from src/entity/club/member/membership.ts rename to src/entity/membership.ts index 9ed2e3a..51801cb 100644 --- a/src/entity/club/member/membership.ts +++ b/src/entity/membership.ts @@ -1,6 +1,6 @@ import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm"; import { member } from "./member"; -import { membershipStatus } from "../../settings/membershipStatus"; +import { membershipStatus } from "./membershipStatus"; @Entity() export class membership { diff --git a/src/entity/settings/membershipStatus.ts b/src/entity/membershipStatus.ts similarity index 86% rename from src/entity/settings/membershipStatus.ts rename to src/entity/membershipStatus.ts index 4362171..980d88b 100644 --- a/src/entity/settings/membershipStatus.ts +++ b/src/entity/membershipStatus.ts @@ -1,5 +1,5 @@ import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm"; -import { membership } from "../club/member/membership"; +import { membership } from "./membership"; @Entity() export class membershipStatus { diff --git a/src/entity/club/newsletter/newsletter.ts b/src/entity/newsletter.ts similarity index 92% rename from src/entity/club/newsletter/newsletter.ts rename to src/entity/newsletter.ts index 021ce23..9393e53 100644 --- a/src/entity/club/newsletter/newsletter.ts +++ b/src/entity/newsletter.ts @@ -1,8 +1,8 @@ import { Column, Entity, ManyToOne, OneToMany, PrimaryColumn } from "typeorm"; import { newsletterDates } from "./newsletterDates"; -import { member } from "../member/member"; +import { member } from "./member"; import { newsletterRecipients } from "./newsletterRecipients"; -import { query } from "../../settings/query"; +import { query } from "./query"; @Entity() export class newsletter { diff --git a/src/entity/settings/newsletterConfig.ts b/src/entity/newsletterConfig.ts similarity index 90% rename from src/entity/settings/newsletterConfig.ts rename to src/entity/newsletterConfig.ts index ae335ce..6ad74ab 100644 --- a/src/entity/settings/newsletterConfig.ts +++ b/src/entity/newsletterConfig.ts @@ -1,5 +1,5 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; -import { NewsletterConfigType } from "../../enums/newsletterConfigType"; +import { NewsletterConfigType } from "../enums/newsletterConfigType"; import { communicationType } from "./communicationType"; @Entity() diff --git a/src/entity/club/newsletter/newsletterDates.ts b/src/entity/newsletterDates.ts similarity index 94% rename from src/entity/club/newsletter/newsletterDates.ts rename to src/entity/newsletterDates.ts index 700400f..aefb8ee 100644 --- a/src/entity/club/newsletter/newsletterDates.ts +++ b/src/entity/newsletterDates.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { newsletter } from "./newsletter"; -import { calendar } from "../calendar"; +import { calendar } from "./calendar"; @Entity() export class newsletterDates { diff --git a/src/entity/club/newsletter/newsletterRecipients.ts b/src/entity/newsletterRecipients.ts similarity index 93% rename from src/entity/club/newsletter/newsletterRecipients.ts rename to src/entity/newsletterRecipients.ts index 21f696f..b57bce4 100644 --- a/src/entity/club/newsletter/newsletterRecipients.ts +++ b/src/entity/newsletterRecipients.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { newsletter } from "./newsletter"; -import { member } from "../member/member"; +import { member } from "./member"; @Entity() export class newsletterRecipients { diff --git a/src/entity/club/protocol/protocol.ts b/src/entity/protocol.ts similarity index 100% rename from src/entity/club/protocol/protocol.ts rename to src/entity/protocol.ts diff --git a/src/entity/club/protocol/protocolAgenda.ts b/src/entity/protocolAgenda.ts similarity index 100% rename from src/entity/club/protocol/protocolAgenda.ts rename to src/entity/protocolAgenda.ts diff --git a/src/entity/club/protocol/protocolDecision.ts b/src/entity/protocolDecision.ts similarity index 100% rename from src/entity/club/protocol/protocolDecision.ts rename to src/entity/protocolDecision.ts diff --git a/src/entity/club/protocol/protocolPresence.ts b/src/entity/protocolPresence.ts similarity index 81% rename from src/entity/club/protocol/protocolPresence.ts rename to src/entity/protocolPresence.ts index ef7f0cb..5d80b10 100644 --- a/src/entity/club/protocol/protocolPresence.ts +++ b/src/entity/protocolPresence.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { protocol } from "./protocol"; -import { member } from "../member/member"; +import { member } from "./member"; @Entity() export class protocolPresence { @@ -10,9 +10,6 @@ export class protocolPresence { @PrimaryColumn() protocolId: number; - @Column({ type: "boolean", default: false }) - absent: boolean; - @ManyToOne(() => member, { nullable: false, onDelete: "CASCADE", diff --git a/src/entity/club/protocol/protocolPrintout.ts b/src/entity/protocolPrintout.ts similarity index 100% rename from src/entity/club/protocol/protocolPrintout.ts rename to src/entity/protocolPrintout.ts diff --git a/src/entity/club/protocol/protocolVoting.ts b/src/entity/protocolVoting.ts similarity index 100% rename from src/entity/club/protocol/protocolVoting.ts rename to src/entity/protocolVoting.ts diff --git a/src/entity/settings/qualification.ts b/src/entity/qualification.ts similarity index 86% rename from src/entity/settings/qualification.ts rename to src/entity/qualification.ts index 8e76ff8..513a31f 100644 --- a/src/entity/settings/qualification.ts +++ b/src/entity/qualification.ts @@ -1,5 +1,5 @@ import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm"; -import { memberQualifications } from "../club/member/memberQualifications"; +import { memberQualifications } from "./memberQualifications"; @Entity() export class qualification { diff --git a/src/entity/settings/query.ts b/src/entity/query.ts similarity index 100% rename from src/entity/settings/query.ts rename to src/entity/query.ts diff --git a/src/entity/refresh.ts b/src/entity/refresh.ts index 560d7c2..bf99f21 100644 --- a/src/entity/refresh.ts +++ b/src/entity/refresh.ts @@ -1,5 +1,5 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; -import { user } from "./user/user"; +import { user } from "./user"; @Entity() export class refresh { diff --git a/src/entity/user/role.ts b/src/entity/role.ts similarity index 100% rename from src/entity/user/role.ts rename to src/entity/role.ts diff --git a/src/entity/user/role_permission.ts b/src/entity/role_permission.ts similarity index 86% rename from src/entity/user/role_permission.ts rename to src/entity/role_permission.ts index 68d4331..c1d7d4d 100644 --- a/src/entity/user/role_permission.ts +++ b/src/entity/role_permission.ts @@ -1,5 +1,5 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; -import { PermissionString } from "../../type/permissionTypes"; +import { PermissionString } from "../type/permissionTypes"; import { role } from "./role"; @Entity() diff --git a/src/entity/settings/template.ts b/src/entity/template.ts similarity index 100% rename from src/entity/settings/template.ts rename to src/entity/template.ts diff --git a/src/entity/settings/templateUsage.ts b/src/entity/templateUsage.ts similarity index 88% rename from src/entity/settings/templateUsage.ts rename to src/entity/templateUsage.ts index 1b487f4..00f41bf 100644 --- a/src/entity/settings/templateUsage.ts +++ b/src/entity/templateUsage.ts @@ -1,11 +1,11 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { template } from "./template"; -import { PermissionModule } from "../../type/permissionTypes"; +import { PermissionModule } from "../type/permissionTypes"; @Entity() export class templateUsage { @PrimaryColumn({ type: "varchar", length: 255 }) - scope: `${PermissionModule}`|`${PermissionModule}.${string}`; + scope: PermissionModule; @Column({ type: "int", nullable: true }) headerId: number | null; diff --git a/src/entity/user/user.ts b/src/entity/user.ts similarity index 100% rename from src/entity/user/user.ts rename to src/entity/user.ts diff --git a/src/entity/user/user_permission.ts b/src/entity/user_permission.ts similarity index 83% rename from src/entity/user/user_permission.ts rename to src/entity/user_permission.ts index 7d782ae..34e6cf5 100644 --- a/src/entity/user/user_permission.ts +++ b/src/entity/user_permission.ts @@ -1,6 +1,6 @@ import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm"; import { user } from "./user"; -import { PermissionObject, PermissionString } from "../../type/permissionTypes"; +import { PermissionObject, PermissionString } from "../type/permissionTypes"; @Entity() export class userPermission { diff --git a/src/factory/admin/settings/award.ts b/src/factory/admin/award.ts similarity index 79% rename from src/factory/admin/settings/award.ts rename to src/factory/admin/award.ts index 3191a4f..440e957 100644 --- a/src/factory/admin/settings/award.ts +++ b/src/factory/admin/award.ts @@ -1,5 +1,5 @@ -import { award } from "../../../entity/settings/award"; -import { AwardViewModel } from "../../../viewmodel/admin/settings/award.models"; +import { award } from "../../entity/award"; +import { AwardViewModel } from "../../viewmodel/admin/award.models"; export default abstract class AwardFactory { /** diff --git a/src/factory/admin/club/calendar.ts b/src/factory/admin/calendar.ts similarity index 81% rename from src/factory/admin/club/calendar.ts rename to src/factory/admin/calendar.ts index 33eb7f2..aa29be2 100644 --- a/src/factory/admin/club/calendar.ts +++ b/src/factory/admin/calendar.ts @@ -1,6 +1,6 @@ -import { calendar } from "../../../entity/club/calendar"; -import { CalendarViewModel } from "../../../viewmodel/admin/club/calendar.models"; -import CalendarTypeFactory from "../settings/calendarType"; +import { calendar } from "../../entity/calendar"; +import { CalendarViewModel } from "../../viewmodel/admin/calendar.models"; +import CalendarTypeFactory from "./calendarType"; export default abstract class CalendarFactory { /** diff --git a/src/factory/admin/settings/calendarType.ts b/src/factory/admin/calendarType.ts similarity index 81% rename from src/factory/admin/settings/calendarType.ts rename to src/factory/admin/calendarType.ts index 2ee7ce2..25aed4e 100644 --- a/src/factory/admin/settings/calendarType.ts +++ b/src/factory/admin/calendarType.ts @@ -1,5 +1,5 @@ -import { calendarType } from "../../../entity/settings/calendarType"; -import { CalendarTypeViewModel } from "../../../viewmodel/admin/settings/calendarType.models"; +import { calendarType } from "../../entity/calendarType"; +import { CalendarTypeViewModel } from "../../viewmodel/admin/calendarType.models"; export default abstract class CalendarTypeFactory { /** diff --git a/src/factory/admin/club/member/communication.ts b/src/factory/admin/communication.ts similarity index 81% rename from src/factory/admin/club/member/communication.ts rename to src/factory/admin/communication.ts index 702cfc5..79b5f8a 100644 --- a/src/factory/admin/club/member/communication.ts +++ b/src/factory/admin/communication.ts @@ -1,6 +1,6 @@ -import { communication } from "../../../../entity/club/member/communication"; -import { CommunicationViewModel } from "../../../../viewmodel/admin/club/member/communication.models"; -import CommunicationTypeFactory from "../../settings/communicationType"; +import { communication } from "../../entity/communication"; +import { CommunicationViewModel } from "../../viewmodel/admin/communication.models"; +import CommunicationTypeFactory from "./communicationType"; export default abstract class CommunicationFactory { /** diff --git a/src/factory/admin/settings/communicationType.ts b/src/factory/admin/communicationType.ts similarity index 79% rename from src/factory/admin/settings/communicationType.ts rename to src/factory/admin/communicationType.ts index 5721f0e..5ee28ea 100644 --- a/src/factory/admin/settings/communicationType.ts +++ b/src/factory/admin/communicationType.ts @@ -1,5 +1,5 @@ -import { communicationType } from "../../../entity/settings/communicationType"; -import { CommunicationTypeViewModel } from "../../../viewmodel/admin/settings/communicationType.models"; +import { communicationType } from "../../entity/communicationType"; +import { CommunicationTypeViewModel } from "../../viewmodel/admin/communicationType.models"; export default abstract class CommunicationTypeFactory { /** diff --git a/src/factory/admin/settings/executivePosition.ts b/src/factory/admin/executivePosition.ts similarity index 78% rename from src/factory/admin/settings/executivePosition.ts rename to src/factory/admin/executivePosition.ts index 5c44bd9..9a1b3b6 100644 --- a/src/factory/admin/settings/executivePosition.ts +++ b/src/factory/admin/executivePosition.ts @@ -1,5 +1,5 @@ -import { executivePosition } from "../../../entity/settings/executivePosition"; -import { ExecutivePositionViewModel } from "../../../viewmodel/admin/settings/executivePosition.models"; +import { executivePosition } from "../../entity/executivePosition"; +import { ExecutivePositionViewModel } from "../../viewmodel/admin/executivePosition.models"; export default abstract class ExecutivePositionFactory { /** diff --git a/src/factory/admin/user/invite.ts b/src/factory/admin/invite.ts similarity index 82% rename from src/factory/admin/user/invite.ts rename to src/factory/admin/invite.ts index 6aa5647..a1ac7a7 100644 --- a/src/factory/admin/user/invite.ts +++ b/src/factory/admin/invite.ts @@ -1,5 +1,5 @@ -import { invite } from "../../../entity/user/invite"; -import { InviteViewModel } from "../../../viewmodel/admin/user/invite.models"; +import { invite } from "../../entity/invite"; +import { InviteViewModel } from "../../viewmodel/admin/invite.models"; export default abstract class InviteFactory { /** diff --git a/src/factory/admin/club/member/member.ts b/src/factory/admin/member.ts similarity index 90% rename from src/factory/admin/club/member/member.ts rename to src/factory/admin/member.ts index 42faf7c..01419e8 100644 --- a/src/factory/admin/club/member/member.ts +++ b/src/factory/admin/member.ts @@ -1,5 +1,5 @@ -import { member } from "../../../../entity/club/member/member"; -import { MemberViewModel } from "../../../../viewmodel/admin/club/member/member.models"; +import { member } from "../../entity/member"; +import { MemberViewModel } from "../../viewmodel/admin/member.models"; import CommunicationFactory from "./communication"; import MembershipFactory from "./membership"; diff --git a/src/factory/admin/club/member/memberAward.ts b/src/factory/admin/memberAward.ts similarity index 80% rename from src/factory/admin/club/member/memberAward.ts rename to src/factory/admin/memberAward.ts index 6161da2..756eaf3 100644 --- a/src/factory/admin/club/member/memberAward.ts +++ b/src/factory/admin/memberAward.ts @@ -1,5 +1,5 @@ -import { memberAwards } from "../../../../entity/club/member/memberAwards"; -import { MemberAwardViewModel } from "../../../../viewmodel/admin/club/member/memberAward.models"; +import { memberAwards } from "../../entity/memberAwards"; +import { MemberAwardViewModel } from "../../viewmodel/admin/memberAward.models"; export default abstract class MemberAwardFactory { /** diff --git a/src/factory/admin/club/member/memberExecutivePosition.ts b/src/factory/admin/memberExecutivePosition.ts similarity index 80% rename from src/factory/admin/club/member/memberExecutivePosition.ts rename to src/factory/admin/memberExecutivePosition.ts index 166d881..71655e5 100644 --- a/src/factory/admin/club/member/memberExecutivePosition.ts +++ b/src/factory/admin/memberExecutivePosition.ts @@ -1,5 +1,5 @@ -import { memberExecutivePositions } from "../../../../entity/club/member/memberExecutivePositions"; -import { MemberExecutivePositionViewModel } from "../../../../viewmodel/admin/club/member/memberExecutivePosition.models"; +import { memberExecutivePositions } from "../../entity/memberExecutivePositions"; +import { MemberExecutivePositionViewModel } from "../../viewmodel/admin/memberExecutivePosition.models"; export default abstract class MemberExecutivePositionFactory { /** diff --git a/src/factory/admin/club/member/memberQualification.ts b/src/factory/admin/memberQualification.ts similarity index 81% rename from src/factory/admin/club/member/memberQualification.ts rename to src/factory/admin/memberQualification.ts index 730dda7..917f78f 100644 --- a/src/factory/admin/club/member/memberQualification.ts +++ b/src/factory/admin/memberQualification.ts @@ -1,5 +1,5 @@ -import { memberQualifications } from "../../../../entity/club/member/memberQualifications"; -import { MemberQualificationViewModel } from "../../../../viewmodel/admin/club/member/memberQualification.models"; +import { memberQualifications } from "../../entity/memberQualifications"; +import { MemberQualificationViewModel } from "../../viewmodel/admin/memberQualification.models"; export default abstract class MemberQualificationFactory { /** diff --git a/src/factory/admin/club/member/membership.ts b/src/factory/admin/membership.ts similarity index 81% rename from src/factory/admin/club/member/membership.ts rename to src/factory/admin/membership.ts index 8736785..2a711c4 100644 --- a/src/factory/admin/club/member/membership.ts +++ b/src/factory/admin/membership.ts @@ -1,5 +1,5 @@ -import { membership } from "../../../../entity/club/member/membership"; -import { MembershipViewModel } from "../../../../viewmodel/admin/club/member/membership.models"; +import { membership } from "../../entity/membership"; +import { MembershipViewModel } from "../../viewmodel/admin/membership.models"; export default abstract class MembershipFactory { /** diff --git a/src/factory/admin/settings/membershipStatus.ts b/src/factory/admin/membershipStatus.ts similarity index 78% rename from src/factory/admin/settings/membershipStatus.ts rename to src/factory/admin/membershipStatus.ts index f45f5b8..43a11c2 100644 --- a/src/factory/admin/settings/membershipStatus.ts +++ b/src/factory/admin/membershipStatus.ts @@ -1,5 +1,5 @@ -import { membershipStatus } from "../../../entity/settings/membershipStatus"; -import { MembershipStatusViewModel } from "../../../viewmodel/admin/settings/membershipStatus.models"; +import { membershipStatus } from "../../entity/membershipStatus"; +import { MembershipStatusViewModel } from "../../viewmodel/admin/membershipStatus.models"; export default abstract class MembershipStatusFactory { /** diff --git a/src/factory/admin/club/newsletter/newsletter.ts b/src/factory/admin/newsletter.ts similarity index 81% rename from src/factory/admin/club/newsletter/newsletter.ts rename to src/factory/admin/newsletter.ts index dff2de4..d734564 100644 --- a/src/factory/admin/club/newsletter/newsletter.ts +++ b/src/factory/admin/newsletter.ts @@ -1,6 +1,6 @@ -import { newsletter } from "../../../../entity/club/newsletter/newsletter"; -import { NewsletterViewModel } from "../../../../viewmodel/admin/club/newsletter/newsletter.models"; -import QueryStoreFactory from "../../settings/queryStore"; +import { newsletter } from "../../entity/newsletter"; +import { NewsletterViewModel } from "../../viewmodel/admin/newsletter.models"; +import QueryStoreFactory from "./queryStore"; export default abstract class NewsletterFactory { /** diff --git a/src/factory/admin/settings/newsletterConfig.ts b/src/factory/admin/newsletterConfig.ts similarity index 82% rename from src/factory/admin/settings/newsletterConfig.ts rename to src/factory/admin/newsletterConfig.ts index f71889e..854bd83 100644 --- a/src/factory/admin/settings/newsletterConfig.ts +++ b/src/factory/admin/newsletterConfig.ts @@ -1,5 +1,5 @@ -import { newsletterConfig } from "../../../entity/settings/newsletterConfig"; -import { NewsletterConfigViewModel } from "../../../viewmodel/admin/settings/newsletterConfig.models"; +import { newsletterConfig } from "../../entity/newsletterConfig"; +import { NewsletterConfigViewModel } from "../../viewmodel/admin/newsletterConfig.models"; import CommunicationTypeFactory from "./communicationType"; export default abstract class NewsletterConfigFactory { diff --git a/src/factory/admin/club/newsletter/newsletterDates.ts b/src/factory/admin/newsletterDates.ts similarity index 74% rename from src/factory/admin/club/newsletter/newsletterDates.ts rename to src/factory/admin/newsletterDates.ts index 8474a47..232e7ac 100644 --- a/src/factory/admin/club/newsletter/newsletterDates.ts +++ b/src/factory/admin/newsletterDates.ts @@ -1,7 +1,7 @@ -import { newsletterDates } from "../../../../entity/club/newsletter/newsletterDates"; -import { NewsletterDatesViewModel } from "../../../../viewmodel/admin/club/newsletter/newsletterDates.models"; -import CalendarFactory from "../calendar"; -import MemberFactory from "../member/member"; +import { newsletterDates } from "../../entity/newsletterDates"; +import { NewsletterDatesViewModel } from "../../viewmodel/admin/newsletterDates.models"; +import CalendarFactory from "./calendar"; +import MemberFactory from "./member"; export default abstract class NewsletterDatesFactory { /** diff --git a/src/factory/admin/club/newsletter/newsletterRecipients.ts b/src/factory/admin/newsletterRecipients.ts similarity index 75% rename from src/factory/admin/club/newsletter/newsletterRecipients.ts rename to src/factory/admin/newsletterRecipients.ts index eb62681..9a1e332 100644 --- a/src/factory/admin/club/newsletter/newsletterRecipients.ts +++ b/src/factory/admin/newsletterRecipients.ts @@ -1,6 +1,6 @@ -import { newsletterRecipients } from "../../../../entity/club/newsletter/newsletterRecipients"; -import { NewsletterRecipientsViewModel } from "../../../../viewmodel/admin/club/newsletter/newsletterRecipients.models"; -import MemberFactory from "../member/member"; +import { newsletterRecipients } from "../../entity/newsletterRecipients"; +import { NewsletterRecipientsViewModel } from "../../viewmodel/admin/newsletterRecipients.models"; +import MemberFactory from "./member"; export default abstract class NewsletterRecipientsFactory { /** diff --git a/src/factory/admin/club/protocol/protocol.ts b/src/factory/admin/protocol.ts similarity index 80% rename from src/factory/admin/club/protocol/protocol.ts rename to src/factory/admin/protocol.ts index 9e90df7..9b86894 100644 --- a/src/factory/admin/club/protocol/protocol.ts +++ b/src/factory/admin/protocol.ts @@ -1,5 +1,5 @@ -import { protocol } from "../../../../entity/club/protocol/protocol"; -import { ProtocolViewModel } from "../../../../viewmodel/admin/club/protocol/protocol.models"; +import { protocol } from "../../entity/protocol"; +import { ProtocolViewModel } from "../../viewmodel/admin/protocol.models"; export default abstract class ProtocolFactory { /** diff --git a/src/factory/admin/club/protocol/protocolAgenda.ts b/src/factory/admin/protocolAgenda.ts similarity index 78% rename from src/factory/admin/club/protocol/protocolAgenda.ts rename to src/factory/admin/protocolAgenda.ts index aa15b75..432c479 100644 --- a/src/factory/admin/club/protocol/protocolAgenda.ts +++ b/src/factory/admin/protocolAgenda.ts @@ -1,5 +1,5 @@ -import { protocolAgenda } from "../../../../entity/club/protocol/protocolAgenda"; -import { ProtocolAgendaViewModel } from "../../../../viewmodel/admin/club/protocol/protocolAgenda.models"; +import { protocolAgenda } from "../../entity/protocolAgenda"; +import { ProtocolAgendaViewModel } from "../../viewmodel/admin/protocolAgenda.models"; export default abstract class ProtocolAgendaFactory { /** diff --git a/src/factory/admin/club/protocol/protocolDecision.ts b/src/factory/admin/protocolDecision.ts similarity index 78% rename from src/factory/admin/club/protocol/protocolDecision.ts rename to src/factory/admin/protocolDecision.ts index 0fbfff5..3e33823 100644 --- a/src/factory/admin/club/protocol/protocolDecision.ts +++ b/src/factory/admin/protocolDecision.ts @@ -1,5 +1,5 @@ -import { protocolDecision } from "../../../../entity/club/protocol/protocolDecision"; -import { ProtocolDecisionViewModel } from "../../../../viewmodel/admin/club/protocol/protocolDecision.models"; +import { protocolDecision } from "../../entity/protocolDecision"; +import { ProtocolDecisionViewModel } from "../../viewmodel/admin/protocolDecision.models"; export default abstract class ProtocolDecisionFactory { /** diff --git a/src/factory/admin/club/protocol/protocolPresence.ts b/src/factory/admin/protocolPresence.ts similarity index 71% rename from src/factory/admin/club/protocol/protocolPresence.ts rename to src/factory/admin/protocolPresence.ts index 37ca37a..59a70ad 100644 --- a/src/factory/admin/club/protocol/protocolPresence.ts +++ b/src/factory/admin/protocolPresence.ts @@ -1,6 +1,6 @@ -import { protocolPresence } from "../../../../entity/club/protocol/protocolPresence"; -import { ProtocolPresenceViewModel } from "../../../../viewmodel/admin/club/protocol/protocolPresence.models"; -import MemberFactory from "../member/member"; +import { protocolPresence } from "../../entity/protocolPresence"; +import { ProtocolPresenceViewModel } from "../../viewmodel/admin/protocolPresence.models"; +import MemberFactory from "./member"; export default abstract class ProtocolPresenceFactory { /** @@ -11,7 +11,7 @@ export default abstract class ProtocolPresenceFactory { public static mapToSingle(record: protocolPresence): ProtocolPresenceViewModel { return { memberId: record.member.id, - absent: record.absent, + member: MemberFactory.mapToSingle(record.member), protocolId: record.protocolId, }; } diff --git a/src/factory/admin/club/protocol/protocolPrintout.ts b/src/factory/admin/protocolPrintout.ts similarity index 79% rename from src/factory/admin/club/protocol/protocolPrintout.ts rename to src/factory/admin/protocolPrintout.ts index 8d202a2..a93fad1 100644 --- a/src/factory/admin/club/protocol/protocolPrintout.ts +++ b/src/factory/admin/protocolPrintout.ts @@ -1,5 +1,5 @@ -import { protocolPrintout } from "../../../../entity/club/protocol/protocolPrintout"; -import { ProtocolPrintoutViewModel } from "../../../../viewmodel/admin/club/protocol/protocolPrintout.models"; +import { protocolPrintout } from "../../entity/protocolPrintout"; +import { ProtocolPrintoutViewModel } from "../../viewmodel/admin/protocolPrintout.models"; export default abstract class ProtocolPrintoutFactory { /** diff --git a/src/factory/admin/club/protocol/protocolVoting.ts b/src/factory/admin/protocolVoting.ts similarity index 80% rename from src/factory/admin/club/protocol/protocolVoting.ts rename to src/factory/admin/protocolVoting.ts index 2f4fa4e..19865fb 100644 --- a/src/factory/admin/club/protocol/protocolVoting.ts +++ b/src/factory/admin/protocolVoting.ts @@ -1,5 +1,5 @@ -import { protocolVoting } from "../../../../entity/club/protocol/protocolVoting"; -import { ProtocolVotingViewModel } from "../../../../viewmodel/admin/club/protocol/protocolVoting.models"; +import { protocolVoting } from "../../entity/protocolVoting"; +import { ProtocolVotingViewModel } from "../../viewmodel/admin/protocolVoting.models"; export default abstract class ProtocolVotingFactory { /** diff --git a/src/factory/admin/settings/qualification.ts b/src/factory/admin/qualification.ts similarity index 79% rename from src/factory/admin/settings/qualification.ts rename to src/factory/admin/qualification.ts index 0a6a05f..f7edb62 100644 --- a/src/factory/admin/settings/qualification.ts +++ b/src/factory/admin/qualification.ts @@ -1,5 +1,5 @@ -import { qualification } from "../../../entity/settings/qualification"; -import { QualificationViewModel } from "../../../viewmodel/admin/settings/qualification.models"; +import { qualification } from "../../entity/qualification"; +import { QualificationViewModel } from "../../viewmodel/admin/qualification.models"; export default abstract class QualificationFactory { /** diff --git a/src/factory/admin/settings/queryStore.ts b/src/factory/admin/queryStore.ts similarity index 82% rename from src/factory/admin/settings/queryStore.ts rename to src/factory/admin/queryStore.ts index 067c494..7574ab8 100644 --- a/src/factory/admin/settings/queryStore.ts +++ b/src/factory/admin/queryStore.ts @@ -1,5 +1,5 @@ -import { query } from "../../../entity/settings/query"; -import { QueryStoreViewModel } from "../../../viewmodel/admin/settings/queryStore.models"; +import { query } from "../../entity/query"; +import { QueryStoreViewModel } from "../../viewmodel/admin/queryStore.models"; export default abstract class QueryStoreFactory { /** diff --git a/src/factory/admin/user/role.ts b/src/factory/admin/role.ts similarity index 76% rename from src/factory/admin/user/role.ts rename to src/factory/admin/role.ts index 8490735..6e1817c 100644 --- a/src/factory/admin/user/role.ts +++ b/src/factory/admin/role.ts @@ -1,6 +1,6 @@ -import { role } from "../../../entity/user/role"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import { RoleViewModel } from "../../../viewmodel/admin/user/role.models"; +import { role } from "../../entity/role"; +import PermissionHelper from "../../helpers/permissionHelper"; +import { RoleViewModel } from "../../viewmodel/admin/role.models"; export default abstract class RoleFactory { /** diff --git a/src/factory/admin/settings/template.ts b/src/factory/admin/template.ts similarity index 81% rename from src/factory/admin/settings/template.ts rename to src/factory/admin/template.ts index ba87719..7da05e0 100644 --- a/src/factory/admin/settings/template.ts +++ b/src/factory/admin/template.ts @@ -1,5 +1,5 @@ -import { template } from "../../../entity/settings/template"; -import { TemplateViewModel } from "../../../viewmodel/admin/settings/template.models"; +import { template } from "../../entity/template"; +import { TemplateViewModel } from "../../viewmodel/admin/template.models"; export default abstract class TemplateFactory { /** diff --git a/src/factory/admin/settings/templateUsage.ts b/src/factory/admin/templateUsage.ts similarity index 85% rename from src/factory/admin/settings/templateUsage.ts rename to src/factory/admin/templateUsage.ts index a34f50f..3472d52 100644 --- a/src/factory/admin/settings/templateUsage.ts +++ b/src/factory/admin/templateUsage.ts @@ -1,5 +1,5 @@ -import { templateUsage } from "../../../entity/settings/templateUsage"; -import { TemplateUsageViewModel } from "../../../viewmodel/admin/settings/templateUsage.models"; +import { templateUsage } from "../../entity/templateUsage"; +import { TemplateUsageViewModel } from "../../viewmodel/admin/templateUsage.models"; export default abstract class TemplateUsageFactory { /** diff --git a/src/factory/admin/user/user.ts b/src/factory/admin/user.ts similarity index 86% rename from src/factory/admin/user/user.ts rename to src/factory/admin/user.ts index 0a82ace..ca8524f 100644 --- a/src/factory/admin/user/user.ts +++ b/src/factory/admin/user.ts @@ -1,6 +1,6 @@ -import { user } from "../../../entity/user/user"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import { UserViewModel } from "../../../viewmodel/admin/user/user.models"; +import { user } from "../../entity/user"; +import PermissionHelper from "../../helpers/permissionHelper"; +import { UserViewModel } from "../../viewmodel/admin/user.models"; import RoleFactory from "./role"; export default abstract class UserFactory { diff --git a/src/helpers/calendarHelper.ts b/src/helpers/calendarHelper.ts index 32ec7fc..86409be 100644 --- a/src/helpers/calendarHelper.ts +++ b/src/helpers/calendarHelper.ts @@ -1,5 +1,5 @@ import { createEvents } from "ics"; -import { calendar } from "../entity/club/calendar"; +import { calendar } from "../entity/calendar"; import moment from "moment"; import { CLUB_NAME, CLUB_WEBSITE, MAIL_USERNAME } from "../env.defaults"; diff --git a/src/helpers/demoDataHelper.ts b/src/helpers/demoDataHelper.ts index 3187ca1..e02e5b5 100644 --- a/src/helpers/demoDataHelper.ts +++ b/src/helpers/demoDataHelper.ts @@ -1,17 +1,14 @@ import { newsletterDemoData } from "../demodata/newsletter.data"; import { protocolDemoData } from "../demodata/protocol.data"; import { PermissionModule } from "../type/permissionTypes"; -import {memberlistDemoData} from "../demodata/member.list.data"; export abstract class DemoDataHelper { - static getData(scope: `${PermissionModule}`|`${PermissionModule}.${string}`) { + static getData(scope: PermissionModule) { switch (scope) { case "protocol": return protocolDemoData; case "newsletter": return newsletterDemoData; - case "member.list": - return memberlistDemoData; default: return {}; } diff --git a/src/helpers/dynamicQueryBuilder.ts b/src/helpers/dynamicQueryBuilder.ts index f0962d3..a97e7a2 100644 --- a/src/helpers/dynamicQueryBuilder.ts +++ b/src/helpers/dynamicQueryBuilder.ts @@ -252,7 +252,7 @@ export default abstract class DynamicQueryBuilder { }); }); results = tempResults; - } else if (value && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) { + } else if (value && typeof value === "object" && !Array.isArray(value)) { const objResults = flatten(value as QueryResult, newKey); const tempResults: Array<{ [key: string]: FieldType }> = []; results.forEach((res) => { diff --git a/src/helpers/fileSystemHelper.ts b/src/helpers/fileSystemHelper.ts index db6b95e..5813f6a 100644 --- a/src/helpers/fileSystemHelper.ts +++ b/src/helpers/fileSystemHelper.ts @@ -29,7 +29,7 @@ export abstract class FileSystemHelper { } static formatPath(...args: string[]) { - return join(process.cwd(), "files", ...args); + return join(process.cwd(), "export", ...args); } static normalizePath(...args: string[]) { diff --git a/src/helpers/jwtHelper.ts b/src/helpers/jwtHelper.ts index b8a62a5..993f41f 100644 --- a/src/helpers/jwtHelper.ts +++ b/src/helpers/jwtHelper.ts @@ -2,9 +2,9 @@ import jwt from "jsonwebtoken"; import { JWTData, JWTToken } from "../type/jwtTypes"; import { JWT_SECRET, JWT_EXPIRATION } from "../env.defaults"; import InternalException from "../exceptions/internalException"; -import RolePermissionService from "../service/user/rolePermissionService"; -import UserPermissionService from "../service/user/userPermissionService"; -import UserService from "../service/user/userService"; +import RolePermissionService from "../service/rolePermissionService"; +import UserPermissionService from "../service/userPermissionService"; +import UserService from "../service/userService"; import PermissionHelper from "./permissionHelper"; export abstract class JWTHelper { diff --git a/src/helpers/newsletterHelper.ts b/src/helpers/newsletterHelper.ts index 458f854..70d71c9 100644 --- a/src/helpers/newsletterHelper.ts +++ b/src/helpers/newsletterHelper.ts @@ -1,12 +1,12 @@ import Mail from "nodemailer/lib/mailer"; -import { member } from "../entity/club/member/member"; -import { newsletter } from "../entity/club/newsletter/newsletter"; -import { newsletterDates } from "../entity/club/newsletter/newsletterDates"; -import { newsletterRecipients } from "../entity/club/newsletter/newsletterRecipients"; -import MemberService from "../service/club/member/memberService"; -import NewsletterDatesService from "../service/club/newsletter/newsletterDatesService"; -import NewsletterRecipientsService from "../service/club/newsletter/newsletterRecipientsService"; -import NewsletterService from "../service/club/newsletter/newsletterService"; +import { member } from "../entity/member"; +import { newsletter } from "../entity/newsletter"; +import { newsletterDates } from "../entity/newsletterDates"; +import { newsletterRecipients } from "../entity/newsletterRecipients"; +import MemberService from "../service/memberService"; +import NewsletterDatesService from "../service/newsletterDatesService"; +import NewsletterRecipientsService from "../service/newsletterRecipientsService"; +import NewsletterService from "../service/newsletterService"; import { CalendarHelper } from "./calendarHelper"; import DynamicQueryBuilder from "./dynamicQueryBuilder"; import { FileSystemHelper } from "./fileSystemHelper"; @@ -14,7 +14,7 @@ import MailHelper from "./mailHelper"; import { CLUB_NAME } from "../env.defaults"; import { TemplateHelper } from "./templateHelper"; import { PdfExport } from "./pdfExport"; -import NewsletterConfigService from "../service/settings/newsletterConfigService"; +import NewsletterConfigService from "../service/newsletterConfigService"; import { NewsletterConfigType } from "../enums/newsletterConfigType"; import InternalException from "../exceptions/internalException"; import EventEmitter from "events"; @@ -251,10 +251,7 @@ export abstract class NewsletterHelper { this.formatJobEmit("progress", "pdf", newsletterId, pdfRecipients.length, 0, "starting sending"); - for (const [index, rec] of [ - ...pdfRecipients, - { id: 0, firstname: "Alle Mitglieder", lastname: CLUB_NAME } as member, - ].entries()) { + for (const [index, rec] of pdfRecipients.entries()) { this.formatJobEmit( "progress", "pdf", diff --git a/src/helpers/pdfExport.ts b/src/helpers/pdfExport.ts index 00a65a8..ee1af97 100644 --- a/src/helpers/pdfExport.ts +++ b/src/helpers/pdfExport.ts @@ -13,7 +13,7 @@ export abstract class PdfExport { saveToDisk = true, folder = "", }: { - template: `${PermissionModule}`|`${PermissionModule}.${string}`; + template: PermissionModule; title?: string; filename?: string; data?: any; diff --git a/src/helpers/templateHelper.ts b/src/helpers/templateHelper.ts index f7d8aa6..eb681b6 100644 --- a/src/helpers/templateHelper.ts +++ b/src/helpers/templateHelper.ts @@ -1,6 +1,6 @@ -import TemplateService from "../service/settings/templateService"; +import TemplateService from "../service/templateService"; import { PermissionModule } from "../type/permissionTypes"; -import TemplateUsageService from "../service/settings/templateUsageService"; +import TemplateUsageService from "../service/templateUsageService"; import Handlebars, { template } from "handlebars"; import { FileSystemHelper } from "./fileSystemHelper"; @@ -34,7 +34,7 @@ export abstract class TemplateHelper { bodyData = {}, footerData = {}, }: { - module: `${PermissionModule}`|`${PermissionModule}.${string}`; + module: PermissionModule; title?: string; headerData?: any; bodyData?: any; diff --git a/src/middleware/allowSetup.ts b/src/middleware/allowSetup.ts index 18844bd..e2306bf 100644 --- a/src/middleware/allowSetup.ts +++ b/src/middleware/allowSetup.ts @@ -1,5 +1,5 @@ import { Request, Response } from "express"; -import UserService from "../service/user/userService"; +import UserService from "../service/userService"; import CustomRequestException from "../exceptions/customRequestException"; export default async function allowSetup(req: Request, res: Response, next: Function) { diff --git a/src/migrations/1734520998539-memberDataViews.ts b/src/migrations/1734520998539-memberDataViews.ts index 4e0df38..d03fd94 100644 --- a/src/migrations/1734520998539-memberDataViews.ts +++ b/src/migrations/1734520998539-memberDataViews.ts @@ -1,8 +1,8 @@ import { DataSource, MigrationInterface, QueryRunner, View } from "typeorm"; -import { member } from "../entity/club/member/member"; -import { memberExecutivePositions } from "../entity/club/member/memberExecutivePositions"; -import { memberQualifications } from "../entity/club/member/memberQualifications"; -import { membership } from "../entity/club/member/membership"; +import { member } from "../entity/member"; +import { memberExecutivePositions } from "../entity/memberExecutivePositions"; +import { memberQualifications } from "../entity/memberQualifications"; +import { membership } from "../entity/membership"; export class MemberDataViews1734520998539 implements MigrationInterface { name = "MemberDataViews1734520998539"; diff --git a/src/migrations/1734949173739-templateUsage.ts b/src/migrations/1734949173739-templateUsage.ts index de98006..2f419d4 100644 --- a/src/migrations/1734949173739-templateUsage.ts +++ b/src/migrations/1734949173739-templateUsage.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner, Table, TableForeignKey } from "typeorm"; import { DB_TYPE } from "../env.defaults"; -import { templateUsage } from "../entity/settings/templateUsage"; +import { templateUsage } from "../entity/templateUsage"; export class TemplateUsage1734949173739 implements MigrationInterface { name = "TemplateUsage1734949173739"; @@ -16,8 +16,6 @@ export class TemplateUsage1734949173739 implements MigrationInterface { { name: "headerId", type: variableType_int, isNullable: true }, { name: "bodyId", type: variableType_int, isNullable: true }, { name: "footerId", type: variableType_int, isNullable: true }, - { name: "headerHeight", type: variableType_int, default: null, isNullable: true }, - { name: "footerHeight", type: variableType_int, default: null, isNullable: true }, ], }), true diff --git a/src/migrations/1735118780511-newsletter.ts b/src/migrations/1735118780511-newsletter.ts index 16985f9..a6294d0 100644 --- a/src/migrations/1735118780511-newsletter.ts +++ b/src/migrations/1735118780511-newsletter.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner, Table, TableForeignKey } from "typeorm"; import { DB_TYPE } from "../env.defaults"; -import { templateUsage } from "../entity/settings/templateUsage"; +import { templateUsage } from "../entity/templateUsage"; export class Newsletter1735118780511 implements MigrationInterface { name = "Newsletter1735118780511"; diff --git a/src/migrations/1735733514043-templateMargins.ts b/src/migrations/1735733514043-templateMargins.ts new file mode 100644 index 0000000..784d4fd --- /dev/null +++ b/src/migrations/1735733514043-templateMargins.ts @@ -0,0 +1,35 @@ +import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; +import { DB_TYPE } from "../env.defaults"; + +export class TemplateMargins1735733514043 implements MigrationInterface { + name = "TemplateMargins1735733514043"; + + public async up(queryRunner: QueryRunner): Promise { + const variableType_int = DB_TYPE == "mysql" ? "int" : "integer"; + + await queryRunner.addColumn( + "template_usage", + new TableColumn({ + name: "headerHeight", + type: variableType_int, + default: null, + isNullable: true, + }) + ); + + await queryRunner.addColumn( + "template_usage", + new TableColumn({ + name: "footerHeight", + type: variableType_int, + default: null, + isNullable: true, + }) + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn("template_usage", "footerHeight"); + await queryRunner.dropColumn("template_usage", "headerHeight"); + } +} diff --git a/src/migrations/1735822722235-internalId.ts b/src/migrations/1735822722235-internalId.ts index 02063a2..9dccc0f 100644 --- a/src/migrations/1735822722235-internalId.ts +++ b/src/migrations/1735822722235-internalId.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; -import { membership } from "../entity/club/member/membership"; -import { member } from "../entity/club/member/member"; +import { membership } from "../entity/membership"; +import { member } from "../entity/member"; export class InternalId1735822722235 implements MigrationInterface { name = "InternalId1735822722235"; diff --git a/src/migrations/1736072179716-protocolAbsent.ts b/src/migrations/1736072179716-protocolAbsent.ts deleted file mode 100644 index d6a859f..0000000 --- a/src/migrations/1736072179716-protocolAbsent.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; - -export class ProtocolAbsent1736072179716 implements MigrationInterface { - name = "ProtocolAbsent1736072179716"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - "protocol_presence", - new TableColumn({ - name: "absent", - type: "tinyint", - default: "0", - isNullable: false, - }) - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn("protocol_presence", "absent"); - } -} diff --git a/src/migrations/1736079005086-memberlist.ts b/src/migrations/1736079005086-memberlist.ts deleted file mode 100644 index 6cb6241..0000000 --- a/src/migrations/1736079005086-memberlist.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; -import { templateUsage } from "../entity/settings/templateUsage"; -import {PermissionModule} from "../type/permissionTypes"; - -export class Memberlist1736079005086 implements MigrationInterface { - name = "Memberlist1736079005086"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.manager - .createQueryBuilder() - .insert() - .into(templateUsage) - .values({ scope: "member.list" }) - .orIgnore() - .execute(); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.manager - .createQueryBuilder() - .delete() - .from(templateUsage) - .where({ scope: "member.list" }) - .execute(); - } -} diff --git a/src/migrations/1736084198860-extendViewValues.ts b/src/migrations/1736084198860-extendViewValues.ts deleted file mode 100644 index c09064d..0000000 --- a/src/migrations/1736084198860-extendViewValues.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { DataSource, MigrationInterface, QueryRunner, View } from "typeorm"; -import { member } from "../entity/club/member/member"; -import { memberExecutivePositions } from "../entity/club/member/memberExecutivePositions"; -import { memberQualifications } from "../entity/club/member/memberQualifications"; -import { membership } from "../entity/club/member/membership"; - -export class ExtendViewValues1736084198860 implements MigrationInterface { - name = "ExtendViewValues1736084198860"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.dropView("membership_view"); - await queryRunner.dropView("member_view"); - - await queryRunner.createView( - new View({ - name: "member_view", - expression: (datasource: DataSource) => - datasource - .getRepository(member) - .createQueryBuilder("member") - .select("member.id", "id") - .addSelect("member.salutation", "salutation") - .addSelect("member.firstname", "firstname") - .addSelect("member.lastname", "lastname") - .addSelect("member.nameaffix", "nameaffix") - .addSelect("member.birthdate", "birthdate") - .addSelect("TIMESTAMPDIFF(YEAR, member.birthdate, CURDATE())", "todayAge") - .addSelect("YEAR(CURDATE()) - YEAR(member.birthdate)", "ageThisYear") - .addSelect("CONCAT('_', FROM_DAYS(TIMESTAMPDIFF(DAY, member.birthdate, CURDATE())))", "exactAge"), - }), - true - ); - await queryRunner.createView( - new View({ - name: "membership_view", - expression: (datasource: DataSource) => - datasource - .getRepository(membership) - .createQueryBuilder("membership") - .select("status.id", "statusId") - .addSelect("status.status", "status") - .addSelect("member.id", "memberId") - .addSelect("member.salutation", "memberSalutation") - .addSelect("member.firstname", "memberFirstname") - .addSelect("member.lastname", "memberLastname") - .addSelect("member.nameaffix", "memberNameaffix") - .addSelect("member.birthdate", "memberBirthdate") - .addSelect( - "SUM(TIMESTAMPDIFF(DAY, membership.start, COALESCE(membership.end, CURRENT_DATE)))", - "durationInDays" - ) - .addSelect( - "CONCAT('_', FROM_DAYS(SUM(TIMESTAMPDIFF(DAY, membership.start, COALESCE(membership.end, CURRENT_DATE)))))", - "durationInYears" - ) - .leftJoin("membership.status", "status") - .leftJoin("membership.member", "member") - .groupBy("status.id"), - }), - true - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropView("membership_view"); - await queryRunner.dropView("member_view"); - - await queryRunner.createView( - new View({ - name: "member_view", - expression: (datasource: DataSource) => - datasource - .getRepository(member) - .createQueryBuilder("member") - .select("member.id", "id") - .addSelect("member.salutation", "salutation") - .addSelect("member.firstname", "firstname") - .addSelect("member.lastname", "lastname") - .addSelect("member.nameaffix", "nameaffix") - .addSelect("member.birthdate", "birthdate") - .addSelect("TIMESTAMPDIFF(YEAR, member.birthdate, CURDATE())", "todayAge") - .addSelect("YEAR(CURDATE()) - YEAR(member.birthdate)", "ageThisYear"), - }), - true - ); - await queryRunner.createView( - new View({ - name: "membership_view", - expression: (datasource: DataSource) => - datasource - .getRepository(membership) - .createQueryBuilder("membership") - .select("status.id", "statusId") - .addSelect("status.status", "status") - .addSelect("member.id", "memberId") - .addSelect("member.salutation", "memberSalutation") - .addSelect("member.firstname", "memberFirstname") - .addSelect("member.lastname", "memberLastname") - .addSelect("member.nameaffix", "memberNameaffix") - .addSelect("member.birthdate", "memberBirthdate") - .addSelect( - "SUM(TIMESTAMPDIFF(DAY, membership.start, COALESCE(membership.end, CURRENT_DATE)))", - "durationInDays" - ) - .leftJoin("membership.status", "status") - .leftJoin("membership.member", "member") - .groupBy("status.id"), - }), - true - ); - } -} diff --git a/src/routes/admin/settings/award.ts b/src/routes/admin/award.ts similarity index 88% rename from src/routes/admin/settings/award.ts rename to src/routes/admin/award.ts index d5eddeb..f9781df 100644 --- a/src/routes/admin/settings/award.ts +++ b/src/routes/admin/award.ts @@ -5,8 +5,8 @@ import { getAllAwards, getAwardById, updateAward, -} from "../../../controller/admin/settings/awardController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/awardController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/club/calendar.ts b/src/routes/admin/calendar.ts similarity index 89% rename from src/routes/admin/club/calendar.ts rename to src/routes/admin/calendar.ts index 3cfff57..7503dee 100644 --- a/src/routes/admin/club/calendar.ts +++ b/src/routes/admin/calendar.ts @@ -10,8 +10,8 @@ import { updateCalendarType, deleteCalendarItem, deleteCalendarType, -} from "../../../controller/admin/club/calendarController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/calendarController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/calendarType.ts b/src/routes/admin/calendarType.ts similarity index 90% rename from src/routes/admin/settings/calendarType.ts rename to src/routes/admin/calendarType.ts index 37cf230..953036d 100644 --- a/src/routes/admin/settings/calendarType.ts +++ b/src/routes/admin/calendarType.ts @@ -10,8 +10,8 @@ import { updateCalendarType, deleteCalendarItem, deleteCalendarType, -} from "../../../controller/admin/club/calendarController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/calendarController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/communicationType.ts b/src/routes/admin/communicationType.ts similarity index 90% rename from src/routes/admin/settings/communicationType.ts rename to src/routes/admin/communicationType.ts index aaf3c46..4fc185f 100644 --- a/src/routes/admin/settings/communicationType.ts +++ b/src/routes/admin/communicationType.ts @@ -6,8 +6,8 @@ import { getCommunicationTypeAvailableColumns, getCommunicationTypeById, updateCommunicationType, -} from "../../../controller/admin/settings/communicationTypeController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/communicationTypeController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/executivePosition.ts b/src/routes/admin/executivePosition.ts similarity index 88% rename from src/routes/admin/settings/executivePosition.ts rename to src/routes/admin/executivePosition.ts index dd698ea..2d0c934 100644 --- a/src/routes/admin/settings/executivePosition.ts +++ b/src/routes/admin/executivePosition.ts @@ -5,8 +5,8 @@ import { getAllExecutivePositions, getExecutivePositionById, updateExecutivePosition, -} from "../../../controller/admin/settings/executivePositionController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/executivePositionController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/index.ts b/src/routes/admin/index.ts index cd7c935..8d627af 100644 --- a/src/routes/admin/index.ts +++ b/src/routes/admin/index.ts @@ -1,26 +1,26 @@ import express from "express"; import PermissionHelper from "../../helpers/permissionHelper"; -import award from "./settings/award"; -import communicationType from "./settings/communicationType"; -import executivePosition from "./settings/executivePosition"; -import membershipStatus from "./settings/membershipStatus"; -import qualification from "./settings/qualification"; -import calendarType from "./settings/calendarType"; -import queryStore from "./settings/queryStore"; -import template from "./settings/template"; -import templateUsage from "./settings/templateUsage"; -import newsletterConfig from "./settings/newsletterConfig"; +import award from "./award"; +import communicationType from "./communicationType"; +import executivePosition from "./executivePosition"; +import membershipStatus from "./membershipStatus"; +import qualification from "./qualification"; +import calendarType from "./calendarType"; +import queryStore from "./queryStore"; +import template from "./template"; +import templateUsage from "./templateUsage"; +import newsletterConfig from "./newsletterConfig"; -import member from "./club/member"; -import protocol from "./club/protocol"; -import calendar from "./club/calendar"; -import queryBuilder from "./club/queryBuilder"; -import newsletter from "./club/newsletter"; +import member from "./member"; +import protocol from "./protocol"; +import calendar from "./calendar"; +import queryBuilder from "./queryBuilder"; +import newsletter from "./newsletter"; -import role from "./user/role"; -import user from "./user/user"; -import invite from "./user/invite"; +import role from "./role"; +import user from "./user"; +import invite from "./invite"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/user/invite.ts b/src/routes/admin/invite.ts similarity index 78% rename from src/routes/admin/user/invite.ts rename to src/routes/admin/invite.ts index 814a13c..0eb5070 100644 --- a/src/routes/admin/user/invite.ts +++ b/src/routes/admin/invite.ts @@ -1,6 +1,6 @@ import express, { Request, Response } from "express"; -import PermissionHelper from "../../../helpers/permissionHelper"; -import { deleteInvite, getInvites, inviteUser } from "../../../controller/inviteController"; +import PermissionHelper from "../../helpers/permissionHelper"; +import { deleteInvite, getInvites, inviteUser } from "../../controller/inviteController"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/club/member.ts b/src/routes/admin/member.ts similarity index 82% rename from src/routes/admin/club/member.ts rename to src/routes/admin/member.ts index f014d37..bd45549 100644 --- a/src/routes/admin/club/member.ts +++ b/src/routes/admin/member.ts @@ -1,38 +1,37 @@ import express, { Request, Response } from "express"; import { - addAwardToMember, - addCommunicationToMember, - addExecutivePositionToMember, - addMembershipToMember, - addQualificationToMember, - createMember, - createMemberPrintoutList, - deleteAwardOfMember, - deleteCommunicationOfMember, - deleteExecutivePositionOfMember, - deleteMemberById, - deleteMembershipOfMember, - deleteQualificationOfMember, - getAllMembers, - getAwardByMemberAndRecord, - getAwardsByMember, - getCommunicationByMemberAndRecord, - getCommunicationsByMember, - getExecutivePositionByMemberAndRecord, - getExecutivePositionsByMember, - getMemberById, - getMembershipByMemberAndRecord, - getMembershipsByMember, - getQualificationByMemberAndRecord, - getQualificationsByMember, - updateAwardOfMember, - updateCommunicationOfMember, - updateExecutivePositionOfMember, - updateMemberById, - updateMembershipOfMember, - updateQualificationOfMember, -} from "../../../controller/admin/club/memberController"; -import PermissionHelper from "../../../helpers/permissionHelper"; + addAwardToMember, + addCommunicationToMember, + addExecutivePositionToMember, + addMembershipToMember, + addQualificationToMember, + createMember, + deleteAwardOfMember, + deleteCommunicationOfMember, + deleteExecutivePositionOfMember, + deleteMemberById, + deleteMembershipOfMember, + deleteQualificationOfMember, + getAllMembers, + getAwardByMemberAndRecord, + getAwardsByMember, + getCommunicationByMemberAndRecord, + getCommunicationsByMember, + getExecutivePositionByMemberAndRecord, + getExecutivePositionsByMember, + getMemberById, + getMembershipByMemberAndRecord, + getMembershipsByMember, + getQualificationByMemberAndRecord, + getQualificationsByMember, + updateAwardOfMember, + updateCommunicationOfMember, + updateExecutivePositionOfMember, + updateMemberById, + updateMembershipOfMember, + updateQualificationOfMember, +} from "../../controller/admin/memberController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); @@ -44,10 +43,6 @@ router.get("/:id", async (req: Request, res: Response) => { await getMemberById(req, res); }); -router.get("/print/namelist", async (req: Request, res: Response) => { - await createMemberPrintoutList(req, res); -}); - router.get("/:memberId/memberships", async (req: Request, res: Response) => { await getMembershipsByMember(req, res); }); diff --git a/src/routes/admin/settings/membershipStatus.ts b/src/routes/admin/membershipStatus.ts similarity index 88% rename from src/routes/admin/settings/membershipStatus.ts rename to src/routes/admin/membershipStatus.ts index 72673f1..665d97b 100644 --- a/src/routes/admin/settings/membershipStatus.ts +++ b/src/routes/admin/membershipStatus.ts @@ -5,8 +5,8 @@ import { getAllMembershipStatus, getMembershipStatusById, updateMembershipStatus, -} from "../../../controller/admin/settings/membershipStatusController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/membershipStatusController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/club/newsletter.ts b/src/routes/admin/newsletter.ts similarity index 96% rename from src/routes/admin/club/newsletter.ts rename to src/routes/admin/newsletter.ts index 9a71bbf..d7b6edb 100644 --- a/src/routes/admin/club/newsletter.ts +++ b/src/routes/admin/newsletter.ts @@ -16,8 +16,8 @@ import { createNewsletterPrintoutPreviewById, getNewsletterPrintoutProgressById, getNewsletterSendingProgressById, -} from "../../../controller/admin/club/newsletterController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/newsletterController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/newsletterConfig.ts b/src/routes/admin/newsletterConfig.ts similarity index 86% rename from src/routes/admin/settings/newsletterConfig.ts rename to src/routes/admin/newsletterConfig.ts index a874cc7..05cb0e9 100644 --- a/src/routes/admin/settings/newsletterConfig.ts +++ b/src/routes/admin/newsletterConfig.ts @@ -4,8 +4,8 @@ import { getAllNewsletterConfigs, getNewsletterConfigById, setNewsletterConfig, -} from "../../../controller/admin/settings/newsletterConfigController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/newsletterConfigController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/club/protocol.ts b/src/routes/admin/protocol.ts similarity index 96% rename from src/routes/admin/club/protocol.ts rename to src/routes/admin/protocol.ts index 245fb2f..48c5e6c 100644 --- a/src/routes/admin/club/protocol.ts +++ b/src/routes/admin/protocol.ts @@ -18,8 +18,8 @@ import { synchronizeProtocolDecisonsById, synchronizeProtocolPrecenseById, synchronizeProtocolVotingsById, -} from "../../../controller/admin/club/protocolController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/protocolController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/qualification.ts b/src/routes/admin/qualification.ts similarity index 88% rename from src/routes/admin/settings/qualification.ts rename to src/routes/admin/qualification.ts index efa34a8..cab8f22 100644 --- a/src/routes/admin/settings/qualification.ts +++ b/src/routes/admin/qualification.ts @@ -5,8 +5,8 @@ import { getAllQualifications, getQualificationById, updateQualification, -} from "../../../controller/admin/settings/qualificationController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/qualificationController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/club/queryBuilder.ts b/src/routes/admin/queryBuilder.ts similarity index 89% rename from src/routes/admin/club/queryBuilder.ts rename to src/routes/admin/queryBuilder.ts index 5578b9d..d09b9c3 100644 --- a/src/routes/admin/club/queryBuilder.ts +++ b/src/routes/admin/queryBuilder.ts @@ -1,5 +1,5 @@ import express, { Request, Response } from "express"; -import { executeQuery, getAllTableMeta, getTableMetaByTablename } from "../../../controller/admin/club/queryBuilderController"; +import { executeQuery, getAllTableMeta, getTableMetaByTablename } from "../../controller/admin/queryBuilderController"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/queryStore.ts b/src/routes/admin/queryStore.ts similarity index 88% rename from src/routes/admin/settings/queryStore.ts rename to src/routes/admin/queryStore.ts index 85b408c..e160187 100644 --- a/src/routes/admin/settings/queryStore.ts +++ b/src/routes/admin/queryStore.ts @@ -1,12 +1,12 @@ import express, { Request, Response } from "express"; -import PermissionHelper from "../../../helpers/permissionHelper"; +import PermissionHelper from "../../helpers/permissionHelper"; import { createQueryStore, deleteQueryStore, getAllQueryStores, getQueryStoreById, updateQueryStore, -} from "../../../controller/admin/settings/queryStoreController"; +} from "../../controller/admin/queryStoreController"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/user/role.ts b/src/routes/admin/role.ts similarity index 91% rename from src/routes/admin/user/role.ts rename to src/routes/admin/role.ts index c9f831c..4f50b7c 100644 --- a/src/routes/admin/user/role.ts +++ b/src/routes/admin/role.ts @@ -1,5 +1,5 @@ import express, { Request, Response } from "express"; -import PermissionHelper from "../../../helpers/permissionHelper"; +import PermissionHelper from "../../helpers/permissionHelper"; import { createRole, deleteRole, @@ -8,7 +8,7 @@ import { getRolePermissions, updateRole, updateRolePermissions, -} from "../../../controller/admin/user/roleController"; +} from "../../controller/admin/roleController"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/template.ts b/src/routes/admin/template.ts similarity index 90% rename from src/routes/admin/settings/template.ts rename to src/routes/admin/template.ts index e04f7d4..492837e 100644 --- a/src/routes/admin/settings/template.ts +++ b/src/routes/admin/template.ts @@ -6,8 +6,8 @@ import { getAllTemplates, getTemplateById, updateTemplate, -} from "../../../controller/admin/settings/templateController"; -import PermissionHelper from "../../../helpers/permissionHelper"; +} from "../../controller/admin/templateController"; +import PermissionHelper from "../../helpers/permissionHelper"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/settings/templateUsage.ts b/src/routes/admin/templateUsage.ts similarity index 68% rename from src/routes/admin/settings/templateUsage.ts rename to src/routes/admin/templateUsage.ts index 6c8f3a9..d25b321 100644 --- a/src/routes/admin/settings/templateUsage.ts +++ b/src/routes/admin/templateUsage.ts @@ -1,12 +1,12 @@ import express, { Request, Response } from "express"; -import PermissionHelper from "../../../helpers/permissionHelper"; +import PermissionHelper from "../../helpers/permissionHelper"; import { getAllTemplateUsages, printTemplateUsageDemo, updateTemplateUsage, -} from "../../../controller/admin/settings/templateUsageController"; -import { PermissionModule } from "../../../type/permissionTypes"; -import ForbiddenRequestException from "../../../exceptions/forbiddenRequestException"; +} from "../../controller/admin/templateUsageController"; +import { PermissionModule } from "../../type/permissionTypes"; +import ForbiddenRequestException from "../../exceptions/forbiddenRequestException"; var router = express.Router({ mergeParams: true }); diff --git a/src/routes/admin/user/user.ts b/src/routes/admin/user.ts similarity index 88% rename from src/routes/admin/user/user.ts rename to src/routes/admin/user.ts index 693e8ea..6c774cd 100644 --- a/src/routes/admin/user/user.ts +++ b/src/routes/admin/user.ts @@ -1,5 +1,5 @@ import express, { Request, Response } from "express"; -import PermissionHelper from "../../../helpers/permissionHelper"; +import PermissionHelper from "../../helpers/permissionHelper"; import { deleteUser, getAllUsers, @@ -9,8 +9,8 @@ import { updateUser, updateUserPermissions, updateUserRoles, -} from "../../../controller/admin/user/userController"; -import { inviteUser } from "../../../controller/inviteController"; +} from "../../controller/admin/userController"; +import { inviteUser } from "../../controller/inviteController"; var router = express.Router({ mergeParams: true }); diff --git a/src/service/settings/awardService.ts b/src/service/awardService.ts similarity index 79% rename from src/service/settings/awardService.ts rename to src/service/awardService.ts index 414ea01..a24f126 100644 --- a/src/service/settings/awardService.ts +++ b/src/service/awardService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { award } from "../../entity/settings/award"; -import { member } from "../../entity/club/member/member"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { award } from "../entity/award"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; export default abstract class AwardService { /** diff --git a/src/service/club/calendarService.ts b/src/service/calendarService.ts similarity index 92% rename from src/service/club/calendarService.ts rename to src/service/calendarService.ts index 0714cd3..5bbf4f4 100644 --- a/src/service/club/calendarService.ts +++ b/src/service/calendarService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { calendar } from "../../entity/club/calendar"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { calendar } from "../entity/calendar"; +import InternalException from "../exceptions/internalException"; export default abstract class CalendarService { /** diff --git a/src/service/settings/calendarTypeService.ts b/src/service/calendarTypeService.ts similarity index 89% rename from src/service/settings/calendarTypeService.ts rename to src/service/calendarTypeService.ts index 0bbc5bb..08e76ea 100644 --- a/src/service/settings/calendarTypeService.ts +++ b/src/service/calendarTypeService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { calendarType } from "../../entity/settings/calendarType"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { calendarType } from "../entity/calendarType"; +import InternalException from "../exceptions/internalException"; export default abstract class CalendarTypeService { /** diff --git a/src/service/club/member/communicationService.ts b/src/service/communicationService.ts similarity index 91% rename from src/service/club/member/communicationService.ts rename to src/service/communicationService.ts index f0c2f04..03073fa 100644 --- a/src/service/club/member/communicationService.ts +++ b/src/service/communicationService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { communication } from "../../../entity/club/member/communication"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { communication } from "../entity/communication"; +import InternalException from "../exceptions/internalException"; export default abstract class CommunicationService { /** diff --git a/src/service/settings/communicationTypeService.ts b/src/service/communicationTypeService.ts similarity index 84% rename from src/service/settings/communicationTypeService.ts rename to src/service/communicationTypeService.ts index cecc1fc..7edb4e2 100644 --- a/src/service/settings/communicationTypeService.ts +++ b/src/service/communicationTypeService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { communicationType } from "../../entity/settings/communicationType"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { communicationType } from "../entity/communicationType"; +import InternalException from "../exceptions/internalException"; export default abstract class CommunicationTypeService { /** diff --git a/src/service/settings/executivePositionService.ts b/src/service/executivePositionService.ts similarity index 78% rename from src/service/settings/executivePositionService.ts rename to src/service/executivePositionService.ts index e69e96f..344ad20 100644 --- a/src/service/settings/executivePositionService.ts +++ b/src/service/executivePositionService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { executivePosition } from "../../entity/settings/executivePosition"; -import { memberExecutivePositions } from "../../entity/club/member/memberExecutivePositions"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { executivePosition } from "../entity/executivePosition"; +import { memberExecutivePositions } from "../entity/memberExecutivePositions"; +import InternalException from "../exceptions/internalException"; export default abstract class ExecutivePositionService { /** diff --git a/src/service/user/inviteService.ts b/src/service/inviteService.ts similarity index 86% rename from src/service/user/inviteService.ts rename to src/service/inviteService.ts index 6b2a701..f6e6a7c 100644 --- a/src/service/user/inviteService.ts +++ b/src/service/inviteService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { invite } from "../../entity/user/invite"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { invite } from "../entity/invite"; +import InternalException from "../exceptions/internalException"; export default abstract class InviteService { /** diff --git a/src/service/club/member/memberAwardService.ts b/src/service/memberAwardService.ts similarity index 87% rename from src/service/club/member/memberAwardService.ts rename to src/service/memberAwardService.ts index 16ed55c..a9998c2 100644 --- a/src/service/club/member/memberAwardService.ts +++ b/src/service/memberAwardService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { memberAwards } from "../../../entity/club/member/memberAwards"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { memberAwards } from "../entity/memberAwards"; +import InternalException from "../exceptions/internalException"; export default abstract class MemberAwardService { /** diff --git a/src/service/club/member/memberExecutivePositionService.ts b/src/service/memberExecutivePositionService.ts similarity index 88% rename from src/service/club/member/memberExecutivePositionService.ts rename to src/service/memberExecutivePositionService.ts index 89cf23c..7f903be 100644 --- a/src/service/club/member/memberExecutivePositionService.ts +++ b/src/service/memberExecutivePositionService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { memberExecutivePositions } from "../entity/memberExecutivePositions"; +import InternalException from "../exceptions/internalException"; export default abstract class MemberExecutivePositionService { /** diff --git a/src/service/club/member/memberQualificationService.ts b/src/service/memberQualificationService.ts similarity index 88% rename from src/service/club/member/memberQualificationService.ts rename to src/service/memberQualificationService.ts index 9685c19..a90503e 100644 --- a/src/service/club/member/memberQualificationService.ts +++ b/src/service/memberQualificationService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { memberQualifications } from "../../../entity/club/member/memberQualifications"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { memberQualifications } from "../entity/memberQualifications"; +import InternalException from "../exceptions/internalException"; export default abstract class MemberQualificationService { /** diff --git a/src/service/club/member/memberService.ts b/src/service/memberService.ts similarity index 85% rename from src/service/club/member/memberService.ts rename to src/service/memberService.ts index 4ac3a6d..531c4b6 100644 --- a/src/service/club/member/memberService.ts +++ b/src/service/memberService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../../data-source"; -import { member } from "../../../entity/club/member/member"; -import { membership } from "../../../entity/club/member/membership"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { member } from "../entity/member"; +import { membership } from "../entity/membership"; +import InternalException from "../exceptions/internalException"; export default abstract class MemberService { /** @@ -9,7 +9,7 @@ export default abstract class MemberService { * @returns {Promise<[Array, number]>} */ static async getAll(offset: number = 0, count: number = 25, search: string = ""): Promise<[Array, number]> { - let query = dataSource + let query = await dataSource .getRepository(member) .createQueryBuilder("member") .leftJoinAndMapOne( @@ -54,7 +54,7 @@ export default abstract class MemberService { }); } - return await query + return query .offset(offset) .limit(count) .orderBy("member.lastname") @@ -114,25 +114,6 @@ export default abstract class MemberService { }); } - /** - * @description get members where membership is setz - * @returns {Promise} - */ - static async getByRunningMembership(): Promise> { - return await dataSource - .getRepository(member) - .createQueryBuilder("member") - .leftJoinAndSelect("member.memberships", "membership") - .where("membership.end IS NULL") - .getMany() - .then((res) => { - return res; - }) - .catch((err) => { - throw new InternalException("member not found by id", err); - }); - } - /** * @description get newsletter by member by id * @param {number} id diff --git a/src/service/club/member/membershipService.ts b/src/service/membershipService.ts similarity index 88% rename from src/service/club/member/membershipService.ts rename to src/service/membershipService.ts index a00daf2..96805cc 100644 --- a/src/service/club/member/membershipService.ts +++ b/src/service/membershipService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { membership } from "../../../entity/club/member/membership"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { membership } from "../entity/membership"; +import InternalException from "../exceptions/internalException"; export default abstract class MembershipService { /** diff --git a/src/service/settings/membershipStatusService.ts b/src/service/membershipStatusService.ts similarity index 80% rename from src/service/settings/membershipStatusService.ts rename to src/service/membershipStatusService.ts index 23269f1..b1032c6 100644 --- a/src/service/settings/membershipStatusService.ts +++ b/src/service/membershipStatusService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { membershipStatus } from "../../entity/settings/membershipStatus"; -import InternalException from "../../exceptions/internalException"; -import { membership } from "../../entity/club/member/membership"; +import { dataSource } from "../data-source"; +import { membershipStatus } from "../entity/membershipStatus"; +import InternalException from "../exceptions/internalException"; +import { membership } from "../entity/membership"; export default abstract class MembershipStatusService { /** diff --git a/src/service/settings/newsletterConfigService.ts b/src/service/newsletterConfigService.ts similarity index 82% rename from src/service/settings/newsletterConfigService.ts rename to src/service/newsletterConfigService.ts index 5ef66a3..f85970d 100644 --- a/src/service/settings/newsletterConfigService.ts +++ b/src/service/newsletterConfigService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { newsletterConfig } from "../../entity/settings/newsletterConfig"; -import { member } from "../../entity/club/member/member"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletterConfig } from "../entity/newsletterConfig"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; export default abstract class NewsletterConfigService { /** diff --git a/src/service/club/newsletter/newsletterDatesService.ts b/src/service/newsletterDatesService.ts similarity index 74% rename from src/service/club/newsletter/newsletterDatesService.ts rename to src/service/newsletterDatesService.ts index 10c4e7a..08c4b0e 100644 --- a/src/service/club/newsletter/newsletterDatesService.ts +++ b/src/service/newsletterDatesService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../../data-source"; -import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates"; -import { member } from "../../../entity/club/member/member"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletterDates } from "../entity/newsletterDates"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; export default abstract class NewsletterDatesService { /** diff --git a/src/service/club/newsletter/newsletterRecipientsService.ts b/src/service/newsletterRecipientsService.ts similarity index 76% rename from src/service/club/newsletter/newsletterRecipientsService.ts rename to src/service/newsletterRecipientsService.ts index fe570de..8e0f9a5 100644 --- a/src/service/club/newsletter/newsletterRecipientsService.ts +++ b/src/service/newsletterRecipientsService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../../data-source"; -import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients"; -import { member } from "../../../entity/club/member/member"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletterRecipients } from "../entity/newsletterRecipients"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; export default abstract class NewsletterRecipientsService { /** diff --git a/src/service/club/newsletter/newsletterService.ts b/src/service/newsletterService.ts similarity index 85% rename from src/service/club/newsletter/newsletterService.ts rename to src/service/newsletterService.ts index 24c2a3f..f522233 100644 --- a/src/service/club/newsletter/newsletterService.ts +++ b/src/service/newsletterService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { newsletter } from "../../../entity/club/newsletter/newsletter"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { newsletter } from "../entity/newsletter"; +import InternalException from "../exceptions/internalException"; export default abstract class NewsletterService { /** diff --git a/src/service/club/protocol/protocolAgendaService.ts b/src/service/protocolAgendaService.ts similarity index 84% rename from src/service/club/protocol/protocolAgendaService.ts rename to src/service/protocolAgendaService.ts index c0899bd..4409d05 100644 --- a/src/service/club/protocol/protocolAgendaService.ts +++ b/src/service/protocolAgendaService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolAgenda } from "../entity/protocolAgenda"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolAgendaService { /** diff --git a/src/service/club/protocol/protocolDecisionService.ts b/src/service/protocolDecisionService.ts similarity index 84% rename from src/service/club/protocol/protocolDecisionService.ts rename to src/service/protocolDecisionService.ts index 62dd672..b818313 100644 --- a/src/service/club/protocol/protocolDecisionService.ts +++ b/src/service/protocolDecisionService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocolDecision } from "../../../entity/club/protocol/protocolDecision"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolDecision } from "../entity/protocolDecision"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolDecisionService { /** diff --git a/src/service/club/protocol/protocolPrecenseService.ts b/src/service/protocolPrecenseService.ts similarity index 76% rename from src/service/club/protocol/protocolPrecenseService.ts rename to src/service/protocolPrecenseService.ts index ac3a82f..2fc9c94 100644 --- a/src/service/club/protocol/protocolPrecenseService.ts +++ b/src/service/protocolPrecenseService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocolPresence } from "../../../entity/club/protocol/protocolPresence"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolPresence } from "../entity/protocolPresence"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolPresenceService { /** diff --git a/src/service/club/protocol/protocolPrintoutService.ts b/src/service/protocolPrintoutService.ts similarity index 89% rename from src/service/club/protocol/protocolPrintoutService.ts rename to src/service/protocolPrintoutService.ts index a1815fb..aaf39ed 100644 --- a/src/service/club/protocol/protocolPrintoutService.ts +++ b/src/service/protocolPrintoutService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolPrintout } from "../entity/protocolPrintout"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolPrintoutService { /** diff --git a/src/service/club/protocol/protocolService.ts b/src/service/protocolService.ts similarity index 84% rename from src/service/club/protocol/protocolService.ts rename to src/service/protocolService.ts index 12526fe..53e0baf 100644 --- a/src/service/club/protocol/protocolService.ts +++ b/src/service/protocolService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocol } from "../../../entity/club/protocol/protocol"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocol } from "../entity/protocol"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolService { /** diff --git a/src/service/club/protocol/protocolVotingService.ts b/src/service/protocolVotingService.ts similarity index 84% rename from src/service/club/protocol/protocolVotingService.ts rename to src/service/protocolVotingService.ts index cc7c5f6..55792fe 100644 --- a/src/service/club/protocol/protocolVotingService.ts +++ b/src/service/protocolVotingService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../../data-source"; -import { protocolVoting } from "../../../entity/club/protocol/protocolVoting"; -import InternalException from "../../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { protocolVoting } from "../entity/protocolVoting"; +import InternalException from "../exceptions/internalException"; export default abstract class ProtocolVotingService { /** diff --git a/src/service/settings/qualification.ts b/src/service/qualification.ts similarity index 75% rename from src/service/settings/qualification.ts rename to src/service/qualification.ts index 585d1ae..4009b64 100644 --- a/src/service/settings/qualification.ts +++ b/src/service/qualification.ts @@ -1,8 +1,8 @@ -import { dataSource } from "../../data-source"; -import { memberQualifications } from "../../entity/club/member/memberQualifications"; -import { qualification } from "../../entity/settings/qualification"; -import { user } from "../../entity/user/user"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { memberQualifications } from "../entity/memberQualifications"; +import { qualification } from "../entity/qualification"; +import { user } from "../entity/user"; +import InternalException from "../exceptions/internalException"; export default abstract class QualificationService { /** diff --git a/src/service/settings/queryStoreService.ts b/src/service/queryStoreService.ts similarity index 84% rename from src/service/settings/queryStoreService.ts rename to src/service/queryStoreService.ts index 8dfbcf8..93145f9 100644 --- a/src/service/settings/queryStoreService.ts +++ b/src/service/queryStoreService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { query } from "../../entity/settings/query"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { query } from "../entity/query"; +import InternalException from "../exceptions/internalException"; export default abstract class QueryStoreService { /** diff --git a/src/service/user/rolePermissionService.ts b/src/service/rolePermissionService.ts similarity index 82% rename from src/service/user/rolePermissionService.ts rename to src/service/rolePermissionService.ts index e40930f..7021a2a 100644 --- a/src/service/user/rolePermissionService.ts +++ b/src/service/rolePermissionService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { rolePermission } from "../../entity/user/role_permission"; -import { userPermission } from "../../entity/user/user_permission"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { rolePermission } from "../entity/role_permission"; +import { userPermission } from "../entity/user_permission"; +import InternalException from "../exceptions/internalException"; export default abstract class RolePermissionService { /** diff --git a/src/service/user/roleService.ts b/src/service/roleService.ts similarity index 86% rename from src/service/user/roleService.ts rename to src/service/roleService.ts index 82cdaae..a344a0a 100644 --- a/src/service/user/roleService.ts +++ b/src/service/roleService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { role } from "../../entity/user/role"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { role } from "../entity/role"; +import InternalException from "../exceptions/internalException"; export default abstract class RoleService { /** diff --git a/src/service/settings/templateService.ts b/src/service/templateService.ts similarity index 79% rename from src/service/settings/templateService.ts rename to src/service/templateService.ts index 4ace459..52517bc 100644 --- a/src/service/settings/templateService.ts +++ b/src/service/templateService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { template } from "../../entity/settings/template"; -import { member } from "../../entity/club/member/member"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { template } from "../entity/template"; +import { member } from "../entity/member"; +import InternalException from "../exceptions/internalException"; export default abstract class TemplateService { /** diff --git a/src/service/settings/templateUsageService.ts b/src/service/templateUsageService.ts similarity index 88% rename from src/service/settings/templateUsageService.ts rename to src/service/templateUsageService.ts index e944edc..25b61ee 100644 --- a/src/service/settings/templateUsageService.ts +++ b/src/service/templateUsageService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { templateUsage } from "../../entity/settings/templateUsage"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { templateUsage } from "../entity/templateUsage"; +import InternalException from "../exceptions/internalException"; export default abstract class TemplateUsageService { /** diff --git a/src/service/user/userPermissionService.ts b/src/service/userPermissionService.ts similarity index 76% rename from src/service/user/userPermissionService.ts rename to src/service/userPermissionService.ts index 2f5a059..c060264 100644 --- a/src/service/user/userPermissionService.ts +++ b/src/service/userPermissionService.ts @@ -1,6 +1,6 @@ -import { dataSource } from "../../data-source"; -import { userPermission } from "../../entity/user/user_permission"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { userPermission } from "../entity/user_permission"; +import InternalException from "../exceptions/internalException"; export default abstract class UserPermissionService { /** diff --git a/src/service/user/userService.ts b/src/service/userService.ts similarity index 94% rename from src/service/user/userService.ts rename to src/service/userService.ts index 2ff9ed1..bc880b1 100644 --- a/src/service/user/userService.ts +++ b/src/service/userService.ts @@ -1,7 +1,7 @@ -import { dataSource } from "../../data-source"; -import { role } from "../../entity/user/role"; -import { user } from "../../entity/user/user"; -import InternalException from "../../exceptions/internalException"; +import { dataSource } from "../data-source"; +import { role } from "../entity/role"; +import { user } from "../entity/user"; +import InternalException from "../exceptions/internalException"; export default abstract class UserService { /** diff --git a/src/templates/member.list.body.template.html b/src/templates/member.list.body.template.html deleted file mode 100644 index 9cb0396..0000000 --- a/src/templates/member.list.body.template.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Mitgliederliste - - -

Mitgliederliste

-
- - - {{#each member}} - - - - - {{/each}} -
{{this.firstname}} {{this.lastname}} {{this.nameaffix}}
- - - diff --git a/src/templates/member.list.footer.template.html b/src/templates/member.list.footer.template.html deleted file mode 100644 index 7a3190b..0000000 --- a/src/templates/member.list.footer.template.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Seite von -
diff --git a/src/templates/newsletter.body.template.html b/src/templates/newsletter.body.template.html index 01433c0..941d89e 100644 --- a/src/templates/newsletter.body.template.html +++ b/src/templates/newsletter.body.template.html @@ -13,7 +13,6 @@

{{this.formattedStarttime}}: {{this.title}}

{{{this.content}}} -
{{/each}}

diff --git a/src/templates/protocol.body.template.html b/src/templates/protocol.body.template.html index c37fa75..98a2a21 100644 --- a/src/templates/protocol.body.template.html +++ b/src/templates/protocol.body.template.html @@ -14,9 +14,11 @@

Anwesenheit ({{presence.length}})

-

{{#each presence}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}

-

Abwesenheit ({{absent.length}})

-

{{#each absent}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}

+
    + {{#each presence}} +
  • {{this.firstname}} {{this.lastname}}
  • + {{/each}} +

Agenda

{{#each agenda}} diff --git a/src/viewmodel/admin/settings/award.models.ts b/src/viewmodel/admin/award.models.ts similarity index 100% rename from src/viewmodel/admin/settings/award.models.ts rename to src/viewmodel/admin/award.models.ts diff --git a/src/viewmodel/admin/club/calendar.models.ts b/src/viewmodel/admin/calendar.models.ts similarity index 76% rename from src/viewmodel/admin/club/calendar.models.ts rename to src/viewmodel/admin/calendar.models.ts index 77a9622..b65fb88 100644 --- a/src/viewmodel/admin/club/calendar.models.ts +++ b/src/viewmodel/admin/calendar.models.ts @@ -1,4 +1,4 @@ -import { CalendarTypeViewModel } from "../settings/calendarType.models"; +import { CalendarTypeViewModel } from "./calendarType.models"; export interface CalendarViewModel { id: string; diff --git a/src/viewmodel/admin/settings/calendarType.models.ts b/src/viewmodel/admin/calendarType.models.ts similarity index 100% rename from src/viewmodel/admin/settings/calendarType.models.ts rename to src/viewmodel/admin/calendarType.models.ts diff --git a/src/viewmodel/admin/club/member/communication.models.ts b/src/viewmodel/admin/communication.models.ts similarity index 78% rename from src/viewmodel/admin/club/member/communication.models.ts rename to src/viewmodel/admin/communication.models.ts index b6c0b29..b7f9dd7 100644 --- a/src/viewmodel/admin/club/member/communication.models.ts +++ b/src/viewmodel/admin/communication.models.ts @@ -1,4 +1,4 @@ -import { CommunicationTypeViewModel } from "../../settings/communicationType.models"; +import { CommunicationTypeViewModel } from "./communicationType.models"; export interface CommunicationViewModel { id: number; diff --git a/src/viewmodel/admin/settings/communicationType.models.ts b/src/viewmodel/admin/communicationType.models.ts similarity index 64% rename from src/viewmodel/admin/settings/communicationType.models.ts rename to src/viewmodel/admin/communicationType.models.ts index a4b8881..845b555 100644 --- a/src/viewmodel/admin/settings/communicationType.models.ts +++ b/src/viewmodel/admin/communicationType.models.ts @@ -1,4 +1,4 @@ -import { CommunicationFieldType } from "../../../type/fieldTypes"; +import { CommunicationFieldType } from "../../type/fieldTypes"; export interface CommunicationTypeViewModel { id: number; diff --git a/src/viewmodel/admin/settings/executivePosition.models.ts b/src/viewmodel/admin/executivePosition.models.ts similarity index 100% rename from src/viewmodel/admin/settings/executivePosition.models.ts rename to src/viewmodel/admin/executivePosition.models.ts diff --git a/src/viewmodel/admin/user/invite.models.ts b/src/viewmodel/admin/invite.models.ts similarity index 100% rename from src/viewmodel/admin/user/invite.models.ts rename to src/viewmodel/admin/invite.models.ts diff --git a/src/viewmodel/admin/club/member/member.models.ts b/src/viewmodel/admin/member.models.ts similarity index 90% rename from src/viewmodel/admin/club/member/member.models.ts rename to src/viewmodel/admin/member.models.ts index 60e1a27..76f1a9a 100644 --- a/src/viewmodel/admin/club/member/member.models.ts +++ b/src/viewmodel/admin/member.models.ts @@ -1,4 +1,4 @@ -import { Salutation } from "../../../../enums/salutation"; +import { Salutation } from "../../enums/salutation"; import { CommunicationViewModel } from "./communication.models"; import { MembershipViewModel } from "./membership.models"; diff --git a/src/viewmodel/admin/club/member/memberAward.models.ts b/src/viewmodel/admin/memberAward.models.ts similarity index 100% rename from src/viewmodel/admin/club/member/memberAward.models.ts rename to src/viewmodel/admin/memberAward.models.ts diff --git a/src/viewmodel/admin/club/member/memberExecutivePosition.models.ts b/src/viewmodel/admin/memberExecutivePosition.models.ts similarity index 100% rename from src/viewmodel/admin/club/member/memberExecutivePosition.models.ts rename to src/viewmodel/admin/memberExecutivePosition.models.ts diff --git a/src/viewmodel/admin/club/member/memberQualification.models.ts b/src/viewmodel/admin/memberQualification.models.ts similarity index 100% rename from src/viewmodel/admin/club/member/memberQualification.models.ts rename to src/viewmodel/admin/memberQualification.models.ts diff --git a/src/viewmodel/admin/club/member/membership.models.ts b/src/viewmodel/admin/membership.models.ts similarity index 100% rename from src/viewmodel/admin/club/member/membership.models.ts rename to src/viewmodel/admin/membership.models.ts diff --git a/src/viewmodel/admin/settings/membershipStatus.models.ts b/src/viewmodel/admin/membershipStatus.models.ts similarity index 100% rename from src/viewmodel/admin/settings/membershipStatus.models.ts rename to src/viewmodel/admin/membershipStatus.models.ts diff --git a/src/viewmodel/admin/club/newsletter/newsletter.models.ts b/src/viewmodel/admin/newsletter.models.ts similarity index 79% rename from src/viewmodel/admin/club/newsletter/newsletter.models.ts rename to src/viewmodel/admin/newsletter.models.ts index 9cf9bb6..cfd8b42 100644 --- a/src/viewmodel/admin/club/newsletter/newsletter.models.ts +++ b/src/viewmodel/admin/newsletter.models.ts @@ -1,4 +1,4 @@ -import { QueryStoreViewModel } from "../../settings/queryStore.models"; +import { QueryStoreViewModel } from "./queryStore.models"; export interface NewsletterViewModel { id: number; diff --git a/src/viewmodel/admin/settings/newsletterConfig.models.ts b/src/viewmodel/admin/newsletterConfig.models.ts similarity index 73% rename from src/viewmodel/admin/settings/newsletterConfig.models.ts rename to src/viewmodel/admin/newsletterConfig.models.ts index 3538bfe..d21e4bf 100644 --- a/src/viewmodel/admin/settings/newsletterConfig.models.ts +++ b/src/viewmodel/admin/newsletterConfig.models.ts @@ -1,4 +1,4 @@ -import { NewsletterConfigType } from "../../../enums/newsletterConfigType"; +import { NewsletterConfigType } from "../../enums/newsletterConfigType"; import { CommunicationTypeViewModel } from "./communicationType.models"; export interface NewsletterConfigViewModel { diff --git a/src/viewmodel/admin/club/newsletter/newsletterDates.models.ts b/src/viewmodel/admin/newsletterDates.models.ts similarity index 76% rename from src/viewmodel/admin/club/newsletter/newsletterDates.models.ts rename to src/viewmodel/admin/newsletterDates.models.ts index b8254ca..074056d 100644 --- a/src/viewmodel/admin/club/newsletter/newsletterDates.models.ts +++ b/src/viewmodel/admin/newsletterDates.models.ts @@ -1,4 +1,4 @@ -import { CalendarViewModel } from "../calendar.models"; +import { CalendarViewModel } from "./calendar.models"; export interface NewsletterDatesViewModel { newsletterId: number; diff --git a/src/viewmodel/admin/club/newsletter/newsletterRecipients.models.ts b/src/viewmodel/admin/newsletterRecipients.models.ts similarity index 67% rename from src/viewmodel/admin/club/newsletter/newsletterRecipients.models.ts rename to src/viewmodel/admin/newsletterRecipients.models.ts index 7db108a..a1030a7 100644 --- a/src/viewmodel/admin/club/newsletter/newsletterRecipients.models.ts +++ b/src/viewmodel/admin/newsletterRecipients.models.ts @@ -1,4 +1,4 @@ -import { MemberViewModel } from "../member/member.models"; +import { MemberViewModel } from "./member.models"; export interface NewsletterRecipientsViewModel { newsletterId: number; diff --git a/src/viewmodel/admin/club/protocol/protocol.models.ts b/src/viewmodel/admin/protocol.models.ts similarity index 100% rename from src/viewmodel/admin/club/protocol/protocol.models.ts rename to src/viewmodel/admin/protocol.models.ts diff --git a/src/viewmodel/admin/club/protocol/protocolAgenda.models.ts b/src/viewmodel/admin/protocolAgenda.models.ts similarity index 100% rename from src/viewmodel/admin/club/protocol/protocolAgenda.models.ts rename to src/viewmodel/admin/protocolAgenda.models.ts diff --git a/src/viewmodel/admin/club/protocol/protocolDecision.models.ts b/src/viewmodel/admin/protocolDecision.models.ts similarity index 100% rename from src/viewmodel/admin/club/protocol/protocolDecision.models.ts rename to src/viewmodel/admin/protocolDecision.models.ts diff --git a/src/viewmodel/admin/club/protocol/protocolPresence.models.ts b/src/viewmodel/admin/protocolPresence.models.ts similarity index 53% rename from src/viewmodel/admin/club/protocol/protocolPresence.models.ts rename to src/viewmodel/admin/protocolPresence.models.ts index 476dc99..9c10f59 100644 --- a/src/viewmodel/admin/club/protocol/protocolPresence.models.ts +++ b/src/viewmodel/admin/protocolPresence.models.ts @@ -1,7 +1,7 @@ -import { MemberViewModel } from "../member/member.models"; +import { MemberViewModel } from "./member.models"; export interface ProtocolPresenceViewModel { memberId: number; - absent: boolean; + member: MemberViewModel; protocolId: number; } diff --git a/src/viewmodel/admin/club/protocol/protocolPrintout.models.ts b/src/viewmodel/admin/protocolPrintout.models.ts similarity index 100% rename from src/viewmodel/admin/club/protocol/protocolPrintout.models.ts rename to src/viewmodel/admin/protocolPrintout.models.ts diff --git a/src/viewmodel/admin/club/protocol/protocolVoting.models.ts b/src/viewmodel/admin/protocolVoting.models.ts similarity index 100% rename from src/viewmodel/admin/club/protocol/protocolVoting.models.ts rename to src/viewmodel/admin/protocolVoting.models.ts diff --git a/src/viewmodel/admin/settings/qualification.models.ts b/src/viewmodel/admin/qualification.models.ts similarity index 100% rename from src/viewmodel/admin/settings/qualification.models.ts rename to src/viewmodel/admin/qualification.models.ts diff --git a/src/viewmodel/admin/settings/queryStore.models.ts b/src/viewmodel/admin/queryStore.models.ts similarity index 61% rename from src/viewmodel/admin/settings/queryStore.models.ts rename to src/viewmodel/admin/queryStore.models.ts index 2e8ce4a..ff697c6 100644 --- a/src/viewmodel/admin/settings/queryStore.models.ts +++ b/src/viewmodel/admin/queryStore.models.ts @@ -1,4 +1,4 @@ -import { DynamicQueryStructure } from "../../../type/dynamicQueries"; +import { DynamicQueryStructure } from "../../type/dynamicQueries"; export interface QueryStoreViewModel { id: number; diff --git a/src/viewmodel/admin/user/role.models.ts b/src/viewmodel/admin/role.models.ts similarity index 60% rename from src/viewmodel/admin/user/role.models.ts rename to src/viewmodel/admin/role.models.ts index ba0e76a..c810ca2 100644 --- a/src/viewmodel/admin/user/role.models.ts +++ b/src/viewmodel/admin/role.models.ts @@ -1,4 +1,4 @@ -import { PermissionObject } from "../../../type/permissionTypes"; +import { PermissionObject } from "../../type/permissionTypes"; export interface RoleViewModel { id: number; diff --git a/src/viewmodel/admin/settings/template.models.ts b/src/viewmodel/admin/template.models.ts similarity index 100% rename from src/viewmodel/admin/settings/template.models.ts rename to src/viewmodel/admin/template.models.ts diff --git a/src/viewmodel/admin/settings/templateUsage.models.ts b/src/viewmodel/admin/templateUsage.models.ts similarity index 66% rename from src/viewmodel/admin/settings/templateUsage.models.ts rename to src/viewmodel/admin/templateUsage.models.ts index d5f6e0f..8783eac 100644 --- a/src/viewmodel/admin/settings/templateUsage.models.ts +++ b/src/viewmodel/admin/templateUsage.models.ts @@ -1,7 +1,7 @@ -import { PermissionModule } from "../../../type/permissionTypes"; +import { PermissionModule } from "../../type/permissionTypes"; export interface TemplateUsageViewModel { - scope: `${PermissionModule}`|`${PermissionModule}.${string}`; + scope: PermissionModule; header: { id: number; template: string } | null; body: { id: number; template: string } | null; footer: { id: number; template: string } | null; diff --git a/src/viewmodel/admin/user/user.models.ts b/src/viewmodel/admin/user.models.ts similarity index 81% rename from src/viewmodel/admin/user/user.models.ts rename to src/viewmodel/admin/user.models.ts index 8bc495b..df6eaa3 100644 --- a/src/viewmodel/admin/user/user.models.ts +++ b/src/viewmodel/admin/user.models.ts @@ -1,4 +1,4 @@ -import { PermissionObject } from "../../../type/permissionTypes"; +import { PermissionObject } from "../../type/permissionTypes"; import { RoleViewModel } from "./role.models"; export interface UserViewModel { diff --git a/src/views/memberExecutivePositionView.ts b/src/views/memberExecutivePositionView.ts index 23722cb..ffc859e 100644 --- a/src/views/memberExecutivePositionView.ts +++ b/src/views/memberExecutivePositionView.ts @@ -1,5 +1,5 @@ import { DataSource, ViewColumn, ViewEntity } from "typeorm"; -import { memberExecutivePositions } from "../entity/club/member/memberExecutivePositions"; +import { memberExecutivePositions } from "../entity/memberExecutivePositions"; import { Salutation } from "../enums/salutation"; @ViewEntity({ diff --git a/src/views/memberQualificationsView.ts b/src/views/memberQualificationsView.ts index 4ae436d..9cd8bd6 100644 --- a/src/views/memberQualificationsView.ts +++ b/src/views/memberQualificationsView.ts @@ -1,5 +1,5 @@ import { DataSource, ViewColumn, ViewEntity } from "typeorm"; -import { memberQualifications } from "../entity/club/member/memberQualifications"; +import { memberQualifications } from "../entity/memberQualifications"; import { Salutation } from "../enums/salutation"; @ViewEntity({ diff --git a/src/views/memberView.ts b/src/views/memberView.ts index 1743ed4..08f147c 100644 --- a/src/views/memberView.ts +++ b/src/views/memberView.ts @@ -1,5 +1,5 @@ import { DataSource, ViewColumn, ViewEntity } from "typeorm"; -import { member } from "../entity/club/member/member"; +import { member } from "../entity/member"; import { Salutation } from "../enums/salutation"; @ViewEntity({ @@ -14,8 +14,7 @@ import { Salutation } from "../enums/salutation"; .addSelect("member.nameaffix", "nameaffix") .addSelect("member.birthdate", "birthdate") .addSelect("TIMESTAMPDIFF(YEAR, member.birthdate, CURDATE())", "todayAge") - .addSelect("YEAR(CURDATE()) - YEAR(member.birthdate)", "ageThisYear") - .addSelect("CONCAT('_', FROM_DAYS(TIMESTAMPDIFF(DAY, member.birthdate, CURDATE())))", "exactAge"), + .addSelect("YEAR(CURDATE()) - YEAR(member.birthdate)", "ageThisYear"), }) export class memberView { @ViewColumn() @@ -41,7 +40,4 @@ export class memberView { @ViewColumn() ageThisYear: number; - - @ViewColumn() - exactAge: Date; } diff --git a/src/views/membershipsView.ts b/src/views/membershipsView.ts index 2beb33f..6d72bcc 100644 --- a/src/views/membershipsView.ts +++ b/src/views/membershipsView.ts @@ -1,5 +1,5 @@ import { DataSource, ViewColumn, ViewEntity } from "typeorm"; -import { membership } from "../entity/club/member/membership"; +import { membership } from "../entity/membership"; import { Salutation } from "../enums/salutation"; @ViewEntity({ @@ -16,10 +16,6 @@ import { Salutation } from "../enums/salutation"; .addSelect("member.nameaffix", "memberNameaffix") .addSelect("member.birthdate", "memberBirthdate") .addSelect("SUM(TIMESTAMPDIFF(DAY, membership.start, COALESCE(membership.end, CURRENT_DATE)))", "durationInDays") - .addSelect( - "CONCAT('_', FROM_DAYS(SUM(TIMESTAMPDIFF(DAY, membership.start, COALESCE(membership.end, CURRENT_DATE)))))", - "durationInYears" - ) .leftJoin("membership.status", "status") .leftJoin("membership.member", "member") .groupBy("status.id"), @@ -28,9 +24,6 @@ export class membershipView { @ViewColumn() durationInDays: number; - @ViewColumn() - durationInYears: Date; - @ViewColumn() status: string;