update database error messages
This commit is contained in:
parent
f89483f878
commit
f245ff74a8
72 changed files with 325 additions and 441 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { calendar } from "../../../entity/club/calendar";
|
import { calendar } from "../../../entity/club/calendar";
|
||||||
import { calendarType } from "../../../entity/settings/calendarType";
|
import { calendarType } from "../../../entity/settings/calendarType";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand";
|
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand";
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ export default abstract class CalendarCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating calendar", err);
|
throw new DatabaseActionException("CREATE", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ export default abstract class CalendarCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating award", err);
|
throw new DatabaseActionException("UPDATE", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ export default abstract class CalendarCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting calendar", err);
|
throw new DatabaseActionException("DELETE", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { communication } from "../../../entity/club/member/communication";
|
import { communication } from "../../../entity/club/member/communication";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateCommunicationCommand,
|
CreateCommunicationCommand,
|
||||||
|
@ -54,7 +55,7 @@ export default abstract class CommunicationCommandHandler {
|
||||||
return insertId;
|
return insertId;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating communication", err);
|
throw new DatabaseActionException("CREATE", "communication", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ export default abstract class CommunicationCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating communication", err);
|
throw new DatabaseActionException("UPDATE", "communication", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ export default abstract class CommunicationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting communication", err);
|
throw new DatabaseActionException("DELETE", "communication", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberAwards } from "../../../entity/club/member/memberAwards";
|
import { memberAwards } from "../../../entity/club/member/memberAwards";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand";
|
import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand";
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ export default abstract class MemberAwardCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating memberAward", err);
|
throw new DatabaseActionException("CREATE", "memberAward", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ export default abstract class MemberAwardCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating memberAward", err);
|
throw new DatabaseActionException("UPDATE", "memberAward", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ export default abstract class MemberAwardCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting memberAward", err);
|
throw new DatabaseActionException("DELETE", "memberAward", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { communication } from "../../../entity/club/member/communication";
|
import { communication } from "../../../entity/club/member/communication";
|
||||||
import { member } from "../../../entity/club/member/member";
|
import { member } from "../../../entity/club/member/member";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand";
|
import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand";
|
||||||
|
|
||||||
|
@ -28,10 +29,7 @@ export default abstract class MemberCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("CREATE", "member", err);
|
||||||
`Failed creating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +54,7 @@ export default abstract class MemberCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("UPDATE", "member", err);
|
||||||
`Failed updating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +72,7 @@ export default abstract class MemberCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting member", err);
|
throw new DatabaseActionException("DELETE", "member", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
|
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateMemberExecutivePositionCommand,
|
CreateMemberExecutivePositionCommand,
|
||||||
|
@ -30,7 +31,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating memberExecutivePosition", err);
|
throw new DatabaseActionException("CREATE", "memberExecutivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating memberExecutivePosition", err);
|
throw new DatabaseActionException("UPDATE", "memberExecutivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting memberExecutivePosition", err);
|
throw new DatabaseActionException("DELETE", "memberExecutivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
|
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateMemberQualificationCommand,
|
CreateMemberQualificationCommand,
|
||||||
|
@ -29,7 +30,7 @@ export default abstract class MemberQualificationCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating memberQualification", err);
|
throw new DatabaseActionException("CREATE", "memberQualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ export default abstract class MemberQualificationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating memberQualification", err);
|
throw new DatabaseActionException("UPDATE", "memberQualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ export default abstract class MemberQualificationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting memberQualification", err);
|
throw new DatabaseActionException("DELETE", "memberQualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { membership } from "../../../entity/club/member/membership";
|
import { membership } from "../../../entity/club/member/membership";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand";
|
import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand";
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ export default abstract class MembershipCommandHandler {
|
||||||
return insertId;
|
return insertId;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating membership", err);
|
throw new DatabaseActionException("CREATE", "membership", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ export default abstract class MembershipCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating membership", err);
|
throw new DatabaseActionException("UPDATE", "membership", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ export default abstract class MembershipCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting membership", err);
|
throw new DatabaseActionException("DELETE", "membership", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { newsletter } from "../../../entity/club/newsletter/newsletter";
|
import { newsletter } from "../../../entity/club/newsletter/newsletter";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand";
|
import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand";
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class NewsletterCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating newsletter", err);
|
throw new DatabaseActionException("CREATE", "newsletter", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ export default abstract class NewsletterCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed synching newsletter", err);
|
throw new DatabaseActionException("SYNC", "newsletter", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ export default abstract class NewsletterCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed setting newsletter send state", err);
|
throw new DatabaseActionException("SET SEND STATE", "newsletter", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
|
||||||
import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService";
|
import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService";
|
||||||
import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand";
|
import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand";
|
||||||
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
|
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class NewsletterDatesCommandHandler {
|
export default abstract class NewsletterDatesCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class NewsletterDatesCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed syncing newsletter dates", err);
|
throw new DatabaseActionException("SYNC", "newsletterDates", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
|
||||||
import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService";
|
import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService";
|
||||||
import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand";
|
import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand";
|
||||||
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
|
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class NewsletterRecipientsCommandHandler {
|
export default abstract class NewsletterRecipientsCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class NewsletterRecipientsCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed syncing newsletter recipients", err);
|
throw new DatabaseActionException("SYNC", "newsletterRecipients", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("CREATE", "protocolAgenda", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("SYNC", "protocolAgenda", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocol } from "../../../entity/club/protocol/protocol";
|
import { protocol } from "../../../entity/club/protocol/protocol";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand";
|
import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand";
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ export default abstract class ProtocolCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("CREATE", "protocol", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ export default abstract class ProtocolCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("SYNC", "protocol", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("CREATE", "protocolDecision", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("SYNC", "protocolDecision", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { protocolPresence } from "../../../entity/club/protocol/protocolPresence
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService";
|
import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService";
|
||||||
import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand";
|
import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class ProtocolPresenceCommandHandler {
|
export default abstract class ProtocolPresenceCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolPresenceCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving protocol presence", err);
|
throw new DatabaseActionException("SYNC", "protocolSresence", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
|
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand";
|
import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand";
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ export default abstract class ProtocolPrintoutCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("CREATE", "protocolPrintout", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("CREATE", "protocolVoting", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating protocol", err);
|
throw new DatabaseActionException("SYNC", "protocolVoting", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { dataSource } from "../data-source";
|
import { dataSource } from "../data-source";
|
||||||
import { refresh } from "../entity/refresh";
|
import { refresh } from "../entity/refresh";
|
||||||
import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults";
|
import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults";
|
||||||
|
import DatabaseActionException from "../exceptions/databaseActionException";
|
||||||
import InternalException from "../exceptions/internalException";
|
import InternalException from "../exceptions/internalException";
|
||||||
import { StringHelper } from "../helpers/stringHelper";
|
import { StringHelper } from "../helpers/stringHelper";
|
||||||
import UserService from "../service/user/userService";
|
import UserService from "../service/user/userService";
|
||||||
|
@ -32,7 +33,7 @@ export default abstract class RefreshCommandHandler {
|
||||||
return refreshToken;
|
return refreshToken;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving refresh token", err);
|
throw new DatabaseActionException("CREATE", "refresh", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ export default abstract class RefreshCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then((res) => {})
|
.then((res) => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("failed refresh removal", err);
|
throw new DatabaseActionException("DELETE", "refresh", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ export default abstract class RefreshCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then((res) => {})
|
.then((res) => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("failed expired refresh removal", err);
|
throw new DatabaseActionException("DELETE", "refresh", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../data-source";
|
import { dataSource } from "../data-source";
|
||||||
import { reset } from "../entity/reset";
|
import { reset } from "../entity/reset";
|
||||||
|
import DatabaseActionException from "../exceptions/databaseActionException";
|
||||||
import InternalException from "../exceptions/internalException";
|
import InternalException from "../exceptions/internalException";
|
||||||
import { StringHelper } from "../helpers/stringHelper";
|
import { StringHelper } from "../helpers/stringHelper";
|
||||||
import { CreateResetCommand, DeleteResetCommand } from "./resetCommand";
|
import { CreateResetCommand, DeleteResetCommand } from "./resetCommand";
|
||||||
|
@ -29,7 +30,7 @@ export default abstract class ResetCommandHandler {
|
||||||
return token;
|
return token;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving reset", err);
|
throw new DatabaseActionException("CREATE", "reset", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ export default abstract class ResetCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then((res) => {})
|
.then((res) => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("failed reset removal", err);
|
throw new DatabaseActionException("DELETE", "reset", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { award } from "../../../entity/settings/award";
|
import { award } from "../../../entity/settings/award";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
|
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class AwardCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating award", err);
|
throw new DatabaseActionException("CREATE", "award", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class AwardCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating award", err);
|
throw new DatabaseActionException("UPDATE", "award", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +61,7 @@ export default abstract class AwardCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "award", err);
|
||||||
`Failed deleting award ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { calendarType } from "../../../entity/settings/calendarType";
|
import { calendarType } from "../../../entity/settings/calendarType";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand";
|
import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand";
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ export default abstract class CalendarTypeCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating calendarType", err);
|
throw new DatabaseActionException("CREATE", "calendarType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ export default abstract class CalendarTypeCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating award", err);
|
throw new DatabaseActionException("UPDATE", "calenarType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +67,7 @@ export default abstract class CalendarTypeCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "calendarType", err);
|
||||||
`Failed deleting calendarType${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { communicationType } from "../../../entity/settings/communicationType";
|
import { communicationType } from "../../../entity/settings/communicationType";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateCommunicationTypeCommand,
|
CreateCommunicationTypeCommand,
|
||||||
|
@ -27,7 +28,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating communicationType", err);
|
throw new DatabaseActionException("CREATE", "communicationType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating communicationType", err);
|
throw new DatabaseActionException("UPDATE", "communicationType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,12 +67,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "communicationType", err);
|
||||||
`Failed deleting communicationType${
|
|
||||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
|
||||||
}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { executivePosition } from "../../../entity/settings/executivePosition";
|
import { executivePosition } from "../../../entity/settings/executivePosition";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateExecutivePositionCommand,
|
CreateExecutivePositionCommand,
|
||||||
|
@ -26,7 +27,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating executivePosition", err);
|
throw new DatabaseActionException("DELETE", "executivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating executivePosition", err);
|
throw new DatabaseActionException("UPDATE", "executivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,12 +65,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "executivePosition", err);
|
||||||
`Failed deleting executivePosition${
|
|
||||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
|
||||||
}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { membershipStatus } from "../../../entity/settings/membershipStatus";
|
import { membershipStatus } from "../../../entity/settings/membershipStatus";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateMembershipStatusCommand,
|
CreateMembershipStatusCommand,
|
||||||
|
@ -26,7 +27,7 @@ export default abstract class MembershipStatusCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating membershipStatus", err);
|
throw new DatabaseActionException("CREATING", "membershipStatus", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ export default abstract class MembershipStatusCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating membershipStatus", err);
|
throw new DatabaseActionException("UPDATE", "membershipStatus", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,12 +65,7 @@ export default abstract class MembershipStatusCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "membershipStatus", err);
|
||||||
`Failed deleting membershipStatus${
|
|
||||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
|
||||||
}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { newsletterConfig } from "../../../entity/settings/newsletterConfig";
|
import { newsletterConfig } from "../../../entity/settings/newsletterConfig";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { SetNewsletterConfigCommand } from "./newsletterConfigCommand";
|
import { SetNewsletterConfigCommand } from "./newsletterConfigCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class NewsletterConfigCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed setting newsletterConfig", err);
|
throw new DatabaseActionException("SET", "newsletterConfig", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { qualification } from "../../../entity/settings/qualification";
|
import { qualification } from "../../../entity/settings/qualification";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateQualificationCommand,
|
CreateQualificationCommand,
|
||||||
|
@ -27,7 +28,7 @@ export default abstract class QualificationCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating qualification", err);
|
throw new DatabaseActionException("CREATE", "qualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ export default abstract class QualificationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating qualification", err);
|
throw new DatabaseActionException("UPDATE", "qualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +67,7 @@ export default abstract class QualificationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "qualification", err);
|
||||||
`Failed deleting qualification${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { query } from "../../../entity/settings/query";
|
import { query } from "../../../entity/settings/query";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand";
|
import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class QueryStoreCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating queryStore", err);
|
throw new DatabaseActionException("CREATE", "queryStore", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export default abstract class QueryStoreCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating queryStore", err);
|
throw new DatabaseActionException("UPDATE", "queryStore", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,10 +64,7 @@ export default abstract class QueryStoreCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "queryStore", err);
|
||||||
`Failed deleting queryStore${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { salutation } from "../../../entity/settings/salutation";
|
import { salutation } from "../../../entity/settings/salutation";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand";
|
import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand";
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class SalutationCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating salutation", err);
|
throw new DatabaseActionException("CREATE", "salutation", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class SalutationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating salutation", err);
|
throw new DatabaseActionException("UPDATE", "salutation", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +61,7 @@ export default abstract class SalutationCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "salutation", err);
|
||||||
`Failed deleting salutation ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { template } from "../../../entity/settings/template";
|
import { template } from "../../../entity/settings/template";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand";
|
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand";
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ export default abstract class TemplateCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating template", err);
|
throw new DatabaseActionException("CREATE", "template", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ export default abstract class TemplateCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating template", err);
|
throw new DatabaseActionException("UPDATE", "template", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,10 +65,7 @@ export default abstract class TemplateCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("DELETE", "template", err);
|
||||||
`Failed deleting template${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { templateUsage } from "../../../entity/settings/templateUsage";
|
import { templateUsage } from "../../../entity/settings/templateUsage";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
|
import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default abstract class TemplateUsageCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating templateUsage", err);
|
throw new DatabaseActionException("SET", "templateUsage", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { role } from "../../../entity/user/role";
|
import { role } from "../../../entity/user/role";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand";
|
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand";
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class RoleCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed creating role", err);
|
throw new DatabaseActionException("CREATE", "role", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class RoleCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating role", err);
|
throw new DatabaseActionException("UPDATE", "role", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ export default abstract class RoleCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting role", err);
|
throw new DatabaseActionException("DELETE", "role", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||||
import RolePermissionService from "../../../service/user/rolePermissionService";
|
import RolePermissionService from "../../../service/user/rolePermissionService";
|
||||||
import { PermissionString } from "../../../type/permissionTypes";
|
import { PermissionString } from "../../../type/permissionTypes";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class RolePermissionCommandHandler {
|
export default abstract class RolePermissionCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class RolePermissionCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving role permissions", err);
|
throw new DatabaseActionException("UPDATE", "rolePermissions", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,46 +72,4 @@ export default abstract class RolePermissionCommandHandler {
|
||||||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description grant permission to user
|
|
||||||
* @param {CreateRolePermissionCommand} createPermission
|
|
||||||
* @returns {Promise<number>}
|
|
||||||
*/
|
|
||||||
static async create(createPermission: CreateRolePermissionCommand): Promise<number> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(rolePermission)
|
|
||||||
.values({
|
|
||||||
permission: createPermission.permission,
|
|
||||||
role: await RoleService.getById(createPermission.roleId),
|
|
||||||
})
|
|
||||||
.execute()
|
|
||||||
.then((result) => {
|
|
||||||
return result.identifiers[0].id;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("Failed saving role permission", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description remove permission from role
|
|
||||||
* @param {DeleteRolePermissionCommand} deletePermission
|
|
||||||
* @returns {Promise<any>}
|
|
||||||
*/
|
|
||||||
static async delete(deletePermission: DeleteRolePermissionCommand): Promise<any> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.delete()
|
|
||||||
.from(rolePermission)
|
|
||||||
.where("roleId = :id", { id: deletePermission.roleId })
|
|
||||||
.andWhere("permission = :permission", { permission: deletePermission.permission })
|
|
||||||
.execute()
|
|
||||||
.then(() => {})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("failed role permission removal", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { invite } from "../../../entity/user/invite";
|
import { invite } from "../../../entity/user/invite";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { StringHelper } from "../../../helpers/stringHelper";
|
import { StringHelper } from "../../../helpers/stringHelper";
|
||||||
import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand";
|
import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand";
|
||||||
|
@ -31,7 +32,7 @@ export default abstract class InviteCommandHandler {
|
||||||
return token;
|
return token;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving invite", err);
|
throw new DatabaseActionException("CREATE", "invite", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ export default abstract class InviteCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then((res) => {})
|
.then((res) => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("failed invite removal", err);
|
throw new DatabaseActionException("DELETE", "invite", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ export default abstract class InviteCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then((res) => {})
|
.then((res) => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("failed invite removal", err);
|
throw new DatabaseActionException("DELETE", "invite", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
UpdateUserSecretCommand,
|
UpdateUserSecretCommand,
|
||||||
} from "./userCommand";
|
} from "./userCommand";
|
||||||
import UserService from "../../../service/user/userService";
|
import UserService from "../../../service/user/userService";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class UserCommandHandler {
|
export default abstract class UserCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class UserCommandHandler {
|
||||||
return result.identifiers[0].id;
|
return result.identifiers[0].id;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving user", err);
|
throw new DatabaseActionException("CREATE", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ export default abstract class UserCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating user", err);
|
throw new DatabaseActionException("UPDATE", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ export default abstract class UserCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed updating user secret", err);
|
throw new DatabaseActionException("UPDATE", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ export default abstract class UserCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving user roles", err);
|
throw new DatabaseActionException("UPDATE", "userRoles", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ export default abstract class UserCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed transfering ownership", err);
|
throw new DatabaseActionException("ABORT", "transfer owner", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ export default abstract class UserCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting user", err);
|
throw new DatabaseActionException("DELETE", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
import UserPermissionService from "../../../service/user/userPermissionService";
|
import UserPermissionService from "../../../service/user/userPermissionService";
|
||||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||||
import { PermissionString } from "../../../type/permissionTypes";
|
import { PermissionString } from "../../../type/permissionTypes";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class UserPermissionCommandHandler {
|
export default abstract class UserPermissionCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class UserPermissionCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving user permissions", err);
|
throw new DatabaseActionException("UPDATE", "userPermissions", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,46 +73,4 @@ export default abstract class UserPermissionCommandHandler {
|
||||||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description grant permission to user
|
|
||||||
* @param {CreateUserPermissionCommand} createPermission
|
|
||||||
* @returns {Promise<number>}
|
|
||||||
*/
|
|
||||||
static async create(createPermission: CreateUserPermissionCommand): Promise<number> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(userPermission)
|
|
||||||
.values({
|
|
||||||
permission: createPermission.permission,
|
|
||||||
userId: createPermission.userId,
|
|
||||||
})
|
|
||||||
.execute()
|
|
||||||
.then((result) => {
|
|
||||||
return result.identifiers[0].id;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("Failed saving user permission", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description remove permission to user
|
|
||||||
* @param {DeleteUserPermissionCommand} deletePermission
|
|
||||||
* @returns {Promise<any>}
|
|
||||||
*/
|
|
||||||
static async delete(deletePermission: DeleteUserPermissionCommand): Promise<any> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.delete()
|
|
||||||
.from(userPermission)
|
|
||||||
.where("userId = :id", { id: deletePermission.userId })
|
|
||||||
.andWhere("permission = :permission", { permission: deletePermission.permission })
|
|
||||||
.execute()
|
|
||||||
.then((res) => {})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("failed user permission removal", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { webapi } from "../../../entity/user/webapi";
|
import { webapi } from "../../../entity/user/webapi";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import {
|
import {
|
||||||
CreateWebapiCommand,
|
CreateWebapiCommand,
|
||||||
|
@ -29,10 +30,7 @@ export default abstract class WebapiCommandHandler {
|
||||||
return result.identifiers[0].token;
|
return result.identifiers[0].token;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("CREATE", "webapi", err);
|
||||||
`Failed creating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +51,7 @@ export default abstract class WebapiCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(
|
throw new DatabaseActionException("UPDATE", "webapi", err);
|
||||||
`Failed updating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
|
|
||||||
err
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +71,7 @@ export default abstract class WebapiCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException(`Failed updating api last usage`, err);
|
throw new DatabaseActionException("UPDATE", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +89,7 @@ export default abstract class WebapiCommandHandler {
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed deleting api", err);
|
throw new DatabaseActionException("DELETE", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||||
import WebapiPermissionService from "../../../service/user/webapiPermissionService";
|
import WebapiPermissionService from "../../../service/user/webapiPermissionService";
|
||||||
import { PermissionString } from "../../../type/permissionTypes";
|
import { PermissionString } from "../../../type/permissionTypes";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class WebapiPermissionCommandHandler {
|
export default abstract class WebapiPermissionCommandHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +39,7 @@ export default abstract class WebapiPermissionCommandHandler {
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving api permissions", err);
|
throw new DatabaseActionException("UPDATE", "webapiPermission", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,46 +75,4 @@ export default abstract class WebapiPermissionCommandHandler {
|
||||||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description grant permission to user
|
|
||||||
* @param {CreateWebapiPermissionCommand} createPermission
|
|
||||||
* @returns {Promise<number>}
|
|
||||||
*/
|
|
||||||
static async create(createPermission: CreateWebapiPermissionCommand): Promise<number> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(webapiPermission)
|
|
||||||
.values({
|
|
||||||
permission: createPermission.permission,
|
|
||||||
webapiId: createPermission.webapiId,
|
|
||||||
})
|
|
||||||
.execute()
|
|
||||||
.then((result) => {
|
|
||||||
return result.identifiers[0].id;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("Failed saving api permission", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description remove permission from api
|
|
||||||
* @param {DeleteWebapiPermissionCommand} deletePermission
|
|
||||||
* @returns {Promise<any>}
|
|
||||||
*/
|
|
||||||
static async delete(deletePermission: DeleteWebapiPermissionCommand): Promise<any> {
|
|
||||||
return await dataSource
|
|
||||||
.createQueryBuilder()
|
|
||||||
.delete()
|
|
||||||
.from(webapiPermission)
|
|
||||||
.where("webapiId = :id", { id: deletePermission.webapiId })
|
|
||||||
.andWhere("permission = :permission", { permission: deletePermission.permission })
|
|
||||||
.execute()
|
|
||||||
.then(() => {})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("failed api permission removal", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
8
src/exceptions/databaseActionException.ts
Normal file
8
src/exceptions/databaseActionException.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import CustomRequestException from "./customRequestException";
|
||||||
|
|
||||||
|
export default class DatabaseActionException extends CustomRequestException {
|
||||||
|
constructor(action: string, table: string, err: any) {
|
||||||
|
let errstring = `${action} on ${table} with ${err?.code ?? "XX"} at ${err?.sqlMessage ?? "XX"}`;
|
||||||
|
super(500, errstring, err);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { calendar } from "../../entity/club/calendar";
|
import { calendar } from "../../entity/club/calendar";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class CalendarService {
|
export default abstract class CalendarService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class CalendarService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendars not found", err);
|
throw new DatabaseActionException("SELECT", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default abstract class CalendarService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendar not found by id", err);
|
throw new DatabaseActionException("SELECT", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ export default abstract class CalendarService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendars not found by types", err);
|
throw new DatabaseActionException("SELECT", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ export default abstract class CalendarService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendars not found by type nscdr", err);
|
throw new DatabaseActionException("SELECT", "calendar", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { communication } from "../../../entity/club/member/communication";
|
import { communication } from "../../../entity/club/member/communication";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class CommunicationService {
|
export default abstract class CommunicationService {
|
||||||
|
@ -21,7 +22,7 @@ export default abstract class CommunicationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member communications not found", err);
|
throw new DatabaseActionException("SELECT", "memberCommunications", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ export default abstract class CommunicationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member communication not found by id", err);
|
throw new DatabaseActionException("SELECT", "memberCommunication", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberAwards } from "../../../entity/club/member/memberAwards";
|
import { memberAwards } from "../../../entity/club/member/memberAwards";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class MemberAwardService {
|
export default abstract class MemberAwardService {
|
||||||
|
@ -20,7 +21,7 @@ export default abstract class MemberAwardService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member awards not found", err);
|
throw new DatabaseActionException("SELECT", "memberAwards", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class MemberAwardService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member award not found by id", err);
|
throw new DatabaseActionException("SELECT", "memberAwards", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
|
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class MemberExecutivePositionService {
|
export default abstract class MemberExecutivePositionService {
|
||||||
|
@ -21,7 +22,7 @@ export default abstract class MemberExecutivePositionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member executivePositions not found", err);
|
throw new DatabaseActionException("SELECT", "memberExecutivePositions", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export default abstract class MemberExecutivePositionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member executivePosition not found by id", err);
|
throw new DatabaseActionException("SELECT", "memberExecutivePositions", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
|
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class MemberQualificationService {
|
export default abstract class MemberQualificationService {
|
||||||
|
@ -20,7 +21,7 @@ export default abstract class MemberQualificationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member qualifications not found", err);
|
throw new DatabaseActionException("SELECT", "memberQualifications", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default abstract class MemberQualificationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member qualification not found by id", err);
|
throw new DatabaseActionException("SELECT", "memberQualifications", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import { SelectQueryBuilder } from "typeorm";
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { member } from "../../../entity/club/member/member";
|
import { member } from "../../../entity/club/member/member";
|
||||||
import { membership } from "../../../entity/club/member/membership";
|
import { membership } from "../../../entity/club/member/membership";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { memberView } from "../../../views/memberView";
|
import { memberView } from "../../../views/memberView";
|
||||||
|
|
||||||
|
@ -22,40 +24,7 @@ export default abstract class MemberService {
|
||||||
noLimit?: boolean;
|
noLimit?: boolean;
|
||||||
ids?: Array<string>;
|
ids?: Array<string>;
|
||||||
}): Promise<[Array<member>, number]> {
|
}): Promise<[Array<member>, number]> {
|
||||||
let query = dataSource
|
let query = this.applyMemberBaseJoins();
|
||||||
.getRepository(member)
|
|
||||||
.createQueryBuilder("member")
|
|
||||||
.leftJoinAndMapOne(
|
|
||||||
"member.firstMembershipEntry",
|
|
||||||
"member.memberships",
|
|
||||||
"membership_first",
|
|
||||||
"membership_first.memberId = member.id AND membership_first.start = (SELECT MIN(m.start) FROM membership m WHERE m.memberId = member.id)"
|
|
||||||
)
|
|
||||||
.leftJoinAndMapOne(
|
|
||||||
"member.lastMembershipEntry",
|
|
||||||
"member.memberships",
|
|
||||||
"membership_last",
|
|
||||||
"membership_last.memberId = member.id AND membership_last.start = (SELECT MAX(m.start) FROM membership m WHERE m.memberId = member.id)"
|
|
||||||
)
|
|
||||||
.leftJoinAndSelect("membership_first.status", "status_first")
|
|
||||||
.leftJoinAndSelect("membership_last.status", "status_last")
|
|
||||||
.leftJoinAndMapMany(
|
|
||||||
"member.preferredCommunication",
|
|
||||||
"member.communications",
|
|
||||||
"preferredCommunication",
|
|
||||||
"preferredCommunication.preferred = 1"
|
|
||||||
)
|
|
||||||
.leftJoinAndSelect("preferredCommunication.type", "communicationtype_preferred")
|
|
||||||
.leftJoinAndMapOne(
|
|
||||||
"member.sendNewsletter",
|
|
||||||
"member.communications",
|
|
||||||
"sendNewsletter",
|
|
||||||
"sendNewsletter.isSendNewsletter = 1"
|
|
||||||
)
|
|
||||||
.leftJoinAndSelect("sendNewsletter.type", "communicationtype")
|
|
||||||
.leftJoinAndMapMany("member.smsAlarming", "member.communications", "smsAlarming", "smsAlarming.isSMSAlarming = 1")
|
|
||||||
.leftJoinAndSelect("smsAlarming.type", "communicationtype_smsAlarming")
|
|
||||||
.leftJoinAndSelect("member.salutation", "salutation");
|
|
||||||
|
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
search.split(" ").forEach((term, index) => {
|
search.split(" ").forEach((term, index) => {
|
||||||
|
@ -90,7 +59,7 @@ export default abstract class MemberService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("members not found", err);
|
throw new DatabaseActionException("SELECT", "member", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +69,89 @@ export default abstract class MemberService {
|
||||||
* @returns {Promise<member>}
|
* @returns {Promise<member>}
|
||||||
*/
|
*/
|
||||||
static async getById(id: string): Promise<member> {
|
static async getById(id: string): Promise<member> {
|
||||||
|
return this.applyMemberBaseJoins()
|
||||||
|
.where("member.id = :id", { id: id })
|
||||||
|
.getOneOrFail()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("SELECT", "member", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get member statistics by id
|
||||||
|
* @param {string} id
|
||||||
|
* @returns {Promise<memberView>}
|
||||||
|
*/
|
||||||
|
static async getStatisticsById(id: string): Promise<memberView> {
|
||||||
return await dataSource
|
return await dataSource
|
||||||
|
.getRepository(memberView)
|
||||||
|
.createQueryBuilder("memberView")
|
||||||
|
.where("memberView.id = :id", { id: id })
|
||||||
|
.getOneOrFail()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("SELECT", "memberView", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get members where membership is setz
|
||||||
|
* @returns {Promise<member>}
|
||||||
|
*/
|
||||||
|
static async getByRunningMembership(): Promise<Array<member>> {
|
||||||
|
return await dataSource
|
||||||
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.leftJoinAndSelect("member.memberships", "membership")
|
||||||
|
.where("membership.end IS NULL")
|
||||||
|
.orderBy("member.lastname")
|
||||||
|
.addOrderBy("member.firstname")
|
||||||
|
.addOrderBy("member.nameaffix")
|
||||||
|
.getMany()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("SELECT", "member", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description get newsletter by member by id
|
||||||
|
* @param {string} id
|
||||||
|
* @returns {Promise<member>}
|
||||||
|
*/
|
||||||
|
static async getNewsletterById(id: string): Promise<member> {
|
||||||
|
return await dataSource
|
||||||
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.leftJoinAndMapOne(
|
||||||
|
"member.sendNewsletter",
|
||||||
|
"member.communications",
|
||||||
|
"sendNewsletter",
|
||||||
|
"sendNewsletter.isSendNewsletter = 1"
|
||||||
|
)
|
||||||
|
.where("member.id = :id", { id: id })
|
||||||
|
.getOneOrFail()
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new DatabaseActionException("SELECT", "member", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description apply member joins to query
|
||||||
|
* @returns {SelectQueryBuilder<member>}
|
||||||
|
*/
|
||||||
|
static applyMemberBaseJoins(): SelectQueryBuilder<member> {
|
||||||
|
return dataSource
|
||||||
.getRepository(member)
|
.getRepository(member)
|
||||||
.createQueryBuilder("member")
|
.createQueryBuilder("member")
|
||||||
.leftJoinAndMapOne(
|
.leftJoinAndMapOne(
|
||||||
|
@ -133,80 +184,6 @@ export default abstract class MemberService {
|
||||||
.leftJoinAndSelect("sendNewsletter.type", "communicationtype")
|
.leftJoinAndSelect("sendNewsletter.type", "communicationtype")
|
||||||
.leftJoinAndMapMany("member.smsAlarming", "member.communications", "smsAlarming", "smsAlarming.isSMSAlarming = 1")
|
.leftJoinAndMapMany("member.smsAlarming", "member.communications", "smsAlarming", "smsAlarming.isSMSAlarming = 1")
|
||||||
.leftJoinAndSelect("smsAlarming.type", "communicationtype_smsAlarming")
|
.leftJoinAndSelect("smsAlarming.type", "communicationtype_smsAlarming")
|
||||||
.leftJoinAndSelect("member.salutation", "salutation")
|
.leftJoinAndSelect("member.salutation", "salutation");
|
||||||
.where("member.id = :id", { id: id })
|
|
||||||
.getOneOrFail()
|
|
||||||
.then((res) => {
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("member not found by id", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description get member statistics by id
|
|
||||||
* @param {string} id
|
|
||||||
* @returns {Promise<memberView>}
|
|
||||||
*/
|
|
||||||
static async getStatisticsById(id: string): Promise<memberView> {
|
|
||||||
return await dataSource
|
|
||||||
.getRepository(memberView)
|
|
||||||
.createQueryBuilder("memberView")
|
|
||||||
.where("memberView.id = :id", { id: id })
|
|
||||||
.getOneOrFail()
|
|
||||||
.then((res) => {
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("memberView not found by id", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description get members where membership is setz
|
|
||||||
* @returns {Promise<member>}
|
|
||||||
*/
|
|
||||||
static async getByRunningMembership(): Promise<Array<member>> {
|
|
||||||
return await dataSource
|
|
||||||
.getRepository(member)
|
|
||||||
.createQueryBuilder("member")
|
|
||||||
.leftJoinAndSelect("member.memberships", "membership")
|
|
||||||
.where("membership.end IS NULL")
|
|
||||||
.orderBy("member.lastname")
|
|
||||||
.addOrderBy("member.firstname")
|
|
||||||
.addOrderBy("member.nameaffix")
|
|
||||||
.getMany()
|
|
||||||
.then((res) => {
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("member not found by id", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description get newsletter by member by id
|
|
||||||
* @param {string} id
|
|
||||||
* @returns {Promise<member>}
|
|
||||||
*/
|
|
||||||
static async getNewsletterById(id: string): Promise<member> {
|
|
||||||
return await dataSource
|
|
||||||
.getRepository(member)
|
|
||||||
.createQueryBuilder("member")
|
|
||||||
.leftJoinAndMapOne(
|
|
||||||
"member.sendNewsletter",
|
|
||||||
"member.communications",
|
|
||||||
"sendNewsletter",
|
|
||||||
"sendNewsletter.isSendNewsletter = 1"
|
|
||||||
)
|
|
||||||
.where("member.id = :id", { id: id })
|
|
||||||
.getOneOrFail()
|
|
||||||
.then((res) => {
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
throw new InternalException("member not found by id", err);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { membership } from "../../../entity/club/member/membership";
|
import { membership } from "../../../entity/club/member/membership";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
import { membershipView } from "../../../views/membershipsView";
|
import { membershipView } from "../../../views/membershipsView";
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ export default abstract class MembershipService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member memberships not found", err);
|
throw new DatabaseActionException("SELECT", "membershis", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ export default abstract class MembershipService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("member membership not found by id", err);
|
throw new DatabaseActionException("SELECT", "membership", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ export default abstract class MembershipService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("membershipView not found by id", err);
|
throw new DatabaseActionException("SELECT", "membershipView", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
||||||
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
|
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
|
||||||
import { member } from "../../../entity/club/member/member";
|
import { member } from "../../../entity/club/member/member";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class NewsletterDatesService {
|
export default abstract class NewsletterDatesService {
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +22,7 @@ export default abstract class NewsletterDatesService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletterDatess not found", err);
|
throw new DatabaseActionException("SELECT", "newsletterDates", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
||||||
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
|
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
|
||||||
import { member } from "../../../entity/club/member/member";
|
import { member } from "../../../entity/club/member/member";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class NewsletterRecipientsService {
|
export default abstract class NewsletterRecipientsService {
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class NewsletterRecipientsService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletterRecipients not found", err);
|
throw new DatabaseActionException("SELECT", "newsletterRecipient", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { newsletter } from "../../../entity/club/newsletter/newsletter";
|
import { newsletter } from "../../../entity/club/newsletter/newsletter";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class NewsletterService {
|
export default abstract class NewsletterService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class NewsletterService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletters not found", err);
|
throw new DatabaseActionException("SELECT", "newsletter", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default abstract class NewsletterService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletter not found by id", err);
|
throw new DatabaseActionException("SELECT", "newsletter", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolAgendaService {
|
export default abstract class ProtocolAgendaService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class ProtocolAgendaService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolAgendas not found", err);
|
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class ProtocolAgendaService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolAgenda not found by id", err);
|
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolDecisionService {
|
export default abstract class ProtocolDecisionService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class ProtocolDecisionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolDecisions not found", err);
|
throw new DatabaseActionException("SELECT", "protocolDecision", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class ProtocolDecisionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolDecision not found by id", err);
|
throw new DatabaseActionException("SELECT", "protocolDecision", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolPresence } from "../../../entity/club/protocol/protocolPresence";
|
import { protocolPresence } from "../../../entity/club/protocol/protocolPresence";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolPresenceService {
|
export default abstract class ProtocolPresenceService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class ProtocolPresenceService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolPresence not found", err);
|
throw new DatabaseActionException("SELECT", "protocolPresence", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
|
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolPrintoutService {
|
export default abstract class ProtocolPrintoutService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class ProtocolPrintoutService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolPrintouts not found", err);
|
throw new DatabaseActionException("SELECT", "protocolPrintout", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class ProtocolPrintoutService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolPrintout not found by id", err);
|
throw new DatabaseActionException("SELECT", "protocolPrintout", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ export default abstract class ProtocolPrintoutService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolPrintout not found by id", err);
|
throw new DatabaseActionException("SELECT", "protocolPrintout", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocol } from "../../../entity/club/protocol/protocol";
|
import { protocol } from "../../../entity/club/protocol/protocol";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolService {
|
export default abstract class ProtocolService {
|
||||||
|
@ -19,7 +20,7 @@ export default abstract class ProtocolService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocols not found", err);
|
throw new DatabaseActionException("SELECT", "protocol", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../../data-source";
|
import { dataSource } from "../../../data-source";
|
||||||
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
||||||
|
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../../exceptions/internalException";
|
import InternalException from "../../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ProtocolVotingService {
|
export default abstract class ProtocolVotingService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class ProtocolVotingService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolVotings not found", err);
|
throw new DatabaseActionException("SELECT", "protocolVoting", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class ProtocolVotingService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("protocolVoting not found by id", err);
|
throw new DatabaseActionException("SELECT", "protocolVoting", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../data-source";
|
import { dataSource } from "../data-source";
|
||||||
import { reset } from "../entity/reset";
|
import { reset } from "../entity/reset";
|
||||||
|
import DatabaseActionException from "../exceptions/databaseActionException";
|
||||||
import InternalException from "../exceptions/internalException";
|
import InternalException from "../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class ResetService {
|
export default abstract class ResetService {
|
||||||
|
@ -20,7 +21,7 @@ export default abstract class ResetService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("reset not found by mail and token", err);
|
throw new DatabaseActionException("SELECT", "reset", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { award } from "../../entity/settings/award";
|
import { award } from "../../entity/settings/award";
|
||||||
import { member } from "../../entity/club/member/member";
|
import { member } from "../../entity/club/member/member";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class AwardService {
|
export default abstract class AwardService {
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class AwardService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("awards not found", err);
|
throw new DatabaseActionException("SELECT", "award", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class AwardService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("award not found by id", err);
|
throw new DatabaseActionException("SELECT", "award", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { calendarType } from "../../entity/settings/calendarType";
|
import { calendarType } from "../../entity/settings/calendarType";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class CalendarTypeService {
|
export default abstract class CalendarTypeService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class CalendarTypeService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendarTypes not found", err);
|
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class CalendarTypeService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendarType not found by id", err);
|
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ export default abstract class CalendarTypeService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("calendarTypes not found by names", err);
|
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { communicationType } from "../../entity/settings/communicationType";
|
import { communicationType } from "../../entity/settings/communicationType";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class CommunicationTypeService {
|
export default abstract class CommunicationTypeService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class CommunicationTypeService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("communicationTypes not found", err);
|
throw new DatabaseActionException("SELECT", "communicationType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class CommunicationTypeService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("communicationType not found by id", err);
|
throw new DatabaseActionException("SELECT", "communicationType", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { executivePosition } from "../../entity/settings/executivePosition";
|
import { executivePosition } from "../../entity/settings/executivePosition";
|
||||||
import { memberExecutivePositions } from "../../entity/club/member/memberExecutivePositions";
|
import { memberExecutivePositions } from "../../entity/club/member/memberExecutivePositions";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class ExecutivePositionService {
|
export default abstract class ExecutivePositionService {
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class ExecutivePositionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("executivePositions not found", err);
|
throw new DatabaseActionException("SELECT", "executivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class ExecutivePositionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("executivePosition not found by id", err);
|
throw new DatabaseActionException("SELECT", "executivePosition", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { membershipStatus } from "../../entity/settings/membershipStatus";
|
import { membershipStatus } from "../../entity/settings/membershipStatus";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
import { membership } from "../../entity/club/member/membership";
|
import { membership } from "../../entity/club/member/membership";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class MembershipStatusService {
|
export default abstract class MembershipStatusService {
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class MembershipStatusService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("membershipStatuss not found", err);
|
throw new DatabaseActionException("SELECT", "membershipStatus", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class MembershipStatusService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("membershipStatus not found by id", err);
|
throw new DatabaseActionException("SELECT", "membershipStatus", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { newsletterConfig } from "../../entity/settings/newsletterConfig";
|
import { newsletterConfig } from "../../entity/settings/newsletterConfig";
|
||||||
import { member } from "../../entity/club/member/member";
|
import { member } from "../../entity/club/member/member";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class NewsletterConfigService {
|
export default abstract class NewsletterConfigService {
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +20,7 @@ export default abstract class NewsletterConfigService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletterConfigs not found", err);
|
throw new DatabaseActionException("SELECT", "newsletterConfig", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ export default abstract class NewsletterConfigService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("newsletterConfig not found by cmId", err);
|
throw new DatabaseActionException("SELECT", "newsletterConfig", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { memberQualifications } from "../../entity/club/member/memberQualifications";
|
import { memberQualifications } from "../../entity/club/member/memberQualifications";
|
||||||
import { qualification } from "../../entity/settings/qualification";
|
import { qualification } from "../../entity/settings/qualification";
|
||||||
import { user } from "../../entity/user/user";
|
import { user } from "../../entity/user/user";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class QualificationService {
|
export default abstract class QualificationService {
|
||||||
|
@ -19,7 +20,7 @@ export default abstract class QualificationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("qualifications not found", err);
|
throw new DatabaseActionException("SELECT", "qualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default abstract class QualificationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("qualification not found by id", err);
|
throw new DatabaseActionException("SELECT", "qualification", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { query } from "../../entity/settings/query";
|
import { query } from "../../entity/settings/query";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class QueryStoreService {
|
export default abstract class QueryStoreService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class QueryStoreService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("queryStores not found", err);
|
throw new DatabaseActionException("SELECT", "queryStore", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class QueryStoreService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("queryStore not found by id", err);
|
throw new DatabaseActionException("SELECT", "queryStore", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { salutation } from "../../entity/settings/salutation";
|
import { salutation } from "../../entity/settings/salutation";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class SalutationService {
|
export default abstract class SalutationService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class SalutationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("salutations not found", err);
|
throw new DatabaseActionException("SELECT", "salutation", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default abstract class SalutationService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("salutation not found by id", err);
|
throw new DatabaseActionException("SELECT", "salutation", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
|
||||||
import { template } from "../../entity/settings/template";
|
import { template } from "../../entity/settings/template";
|
||||||
import { member } from "../../entity/club/member/member";
|
import { member } from "../../entity/club/member/member";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
|
|
||||||
export default abstract class TemplateService {
|
export default abstract class TemplateService {
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class TemplateService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("templates not found", err);
|
throw new DatabaseActionException("SELECT", "template", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default abstract class TemplateService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("template not found by id", err);
|
throw new DatabaseActionException("SELECT", "template", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { templateUsage } from "../../entity/settings/templateUsage";
|
import { templateUsage } from "../../entity/settings/templateUsage";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class TemplateUsageService {
|
export default abstract class TemplateUsageService {
|
||||||
|
@ -20,7 +21,7 @@ export default abstract class TemplateUsageService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("templates not found", err);
|
throw new DatabaseActionException("SELECT", "templateUsage", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { invite } from "../../entity/user/invite";
|
import { invite } from "../../entity/user/invite";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class InviteService {
|
export default abstract class InviteService {
|
||||||
|
@ -16,7 +17,7 @@ export default abstract class InviteService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("invites not found", err);
|
throw new DatabaseActionException("SELECT", "invite", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default abstract class InviteService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("invite not found by mail and token", err);
|
throw new DatabaseActionException("SELECT", "invite", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { rolePermission } from "../../entity/user/role_permission";
|
import { rolePermission } from "../../entity/user/role_permission";
|
||||||
import { userPermission } from "../../entity/user/user_permission";
|
import { userPermission } from "../../entity/user/user_permission";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class RolePermissionService {
|
export default abstract class RolePermissionService {
|
||||||
|
@ -19,7 +20,7 @@ export default abstract class RolePermissionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("permissions not found by role", err);
|
throw new DatabaseActionException("SELECT", "rolePermission", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ export default abstract class RolePermissionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("permissions not found by roles", err);
|
throw new DatabaseActionException("SELECT", "rolePermission", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { role } from "../../entity/user/role";
|
import { role } from "../../entity/user/role";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class RoleService {
|
export default abstract class RoleService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class RoleService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("roles not found", err);
|
throw new DatabaseActionException("SELECT", "roles", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ export default abstract class RoleService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("role not found by id", err);
|
throw new DatabaseActionException("SELECT", "role", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { userPermission } from "../../entity/user/user_permission";
|
import { userPermission } from "../../entity/user/user_permission";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class UserPermissionService {
|
export default abstract class UserPermissionService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class UserPermissionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("permission not found by user", err);
|
throw new DatabaseActionException("SELECT", "userPermission", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { role } from "../../entity/user/role";
|
import { role } from "../../entity/user/role";
|
||||||
import { user } from "../../entity/user/user";
|
import { user } from "../../entity/user/user";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class UserService {
|
export default abstract class UserService {
|
||||||
|
@ -22,7 +23,7 @@ export default abstract class UserService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("users not found", err);
|
throw new DatabaseActionException("SELECT", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ export default abstract class UserService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("user not found by id", err);
|
throw new DatabaseActionException("SELECT", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ export default abstract class UserService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("user not found by username", err);
|
throw new DatabaseActionException("SELECT", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ export default abstract class UserService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("user not found by mail or username", err);
|
throw new DatabaseActionException("SELECT", "user", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ export default abstract class UserService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("could not count users", err);
|
throw new DatabaseActionException("COUNT", "users", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ export default abstract class UserService {
|
||||||
return res.roles;
|
return res.roles;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("could not get roles for user", err);
|
throw new DatabaseActionException("SELECT", "userRoles", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { webapiPermission } from "../../entity/user/webapi_permission";
|
import { webapiPermission } from "../../entity/user/webapi_permission";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class WebapiPermissionService {
|
export default abstract class WebapiPermissionService {
|
||||||
|
@ -18,7 +19,7 @@ export default abstract class WebapiPermissionService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("webapi permissions not found by api", err);
|
throw new DatabaseActionException("SELECT", "webapiPermission", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { dataSource } from "../../data-source";
|
import { dataSource } from "../../data-source";
|
||||||
import { webapi } from "../../entity/user/webapi";
|
import { webapi } from "../../entity/user/webapi";
|
||||||
|
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||||
import InternalException from "../../exceptions/internalException";
|
import InternalException from "../../exceptions/internalException";
|
||||||
|
|
||||||
export default abstract class WebapiService {
|
export default abstract class WebapiService {
|
||||||
|
@ -17,7 +18,7 @@ export default abstract class WebapiService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("webapis not found", err);
|
throw new DatabaseActionException("SELECT", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export default abstract class WebapiService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("webapi not found by id", err);
|
throw new DatabaseActionException("SELECT", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ export default abstract class WebapiService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("webapi not found by token", err);
|
throw new DatabaseActionException("SELECT", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ export default abstract class WebapiService {
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("webapi token not found by id", err);
|
throw new DatabaseActionException("SELECT", "webapi", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue