update database error messages

This commit is contained in:
Julian Krauser 2025-01-29 09:42:22 +01:00
parent f89483f878
commit f245ff74a8
72 changed files with 325 additions and 441 deletions

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../../data-source";
import { calendar } from "../../../entity/club/calendar";
import { calendarType } from "../../../entity/settings/calendarType";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand";
@ -33,7 +34,7 @@ export default abstract class CalendarCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting calendar", err);
throw new DatabaseActionException("DELETE", "calendar", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { communication } from "../../../entity/club/member/communication";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateCommunicationCommand,
@ -54,7 +55,7 @@ export default abstract class CommunicationCommandHandler {
return insertId;
})
.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(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting communication", err);
throw new DatabaseActionException("DELETE", "communication", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberAwards } from "../../../entity/club/member/memberAwards";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand";
@ -26,7 +27,7 @@ export default abstract class MemberAwardCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting memberAward", err);
throw new DatabaseActionException("DELETE", "memberAward", err);
});
}
}

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../../data-source";
import { communication } from "../../../entity/club/member/communication";
import { member } from "../../../entity/club/member/member";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand";
@ -28,10 +29,7 @@ export default abstract class MemberCommandHandler {
return result.identifiers[0].id;
})
.catch((err) => {
throw new InternalException(
`Failed creating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
throw new DatabaseActionException("CREATE", "member", err);
});
}
@ -56,10 +54,7 @@ export default abstract class MemberCommandHandler {
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed updating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
throw new DatabaseActionException("UPDATE", "member", err);
});
}
@ -77,7 +72,7 @@ export default abstract class MemberCommandHandler {
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting member", err);
throw new DatabaseActionException("DELETE", "member", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateMemberExecutivePositionCommand,
@ -30,7 +31,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting memberExecutivePosition", err);
throw new DatabaseActionException("DELETE", "memberExecutivePosition", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateMemberQualificationCommand,
@ -29,7 +30,7 @@ export default abstract class MemberQualificationCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting memberQualification", err);
throw new DatabaseActionException("DELETE", "memberQualification", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { membership } from "../../../entity/club/member/membership";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand";
@ -43,7 +44,7 @@ export default abstract class MembershipCommandHandler {
return insertId;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting membership", err);
throw new DatabaseActionException("DELETE", "membership", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { newsletter } from "../../../entity/club/newsletter/newsletter";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand";
@ -22,7 +23,7 @@ export default abstract class NewsletterCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed setting newsletter send state", err);
throw new DatabaseActionException("SET SEND STATE", "newsletter", err);
});
}
}

View file

@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService";
import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand";
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterDatesCommandHandler {
/**
@ -42,7 +43,7 @@ export default abstract class NewsletterDatesCommandHandler {
})
.then(() => {})
.catch((err) => {
throw new InternalException("Failed syncing newsletter dates", err);
throw new DatabaseActionException("SYNC", "newsletterDates", err);
});
}

View file

@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService";
import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand";
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterRecipientsCommandHandler {
/**
@ -35,7 +36,7 @@ export default abstract class NewsletterRecipientsCommandHandler {
})
.then(() => {})
.catch((err) => {
throw new InternalException("Failed syncing newsletter recipients", err);
throw new DatabaseActionException("SYNC", "newsletterRecipients", err);
});
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
@ -24,7 +25,7 @@ export default abstract class ProtocolAgendaCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed creating protocol", err);
throw new DatabaseActionException("SYNC", "protocolAgenda", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocol } from "../../../entity/club/protocol/protocol";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand";
@ -23,7 +24,7 @@ export default abstract class ProtocolCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed creating protocol", err);
throw new DatabaseActionException("SYNC", "protocol", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
@ -24,7 +25,7 @@ export default abstract class ProtocolDecisionCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed creating protocol", err);
throw new DatabaseActionException("SYNC", "protocolDecision", err);
});
}
}

View file

@ -4,6 +4,7 @@ import { protocolPresence } from "../../../entity/club/protocol/protocolPresence
import InternalException from "../../../exceptions/internalException";
import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService";
import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class ProtocolPresenceCommandHandler {
/**
@ -42,7 +43,7 @@ export default abstract class ProtocolPresenceCommandHandler {
})
.then(() => {})
.catch((err) => {
throw new InternalException("Failed saving protocol presence", err);
throw new DatabaseActionException("SYNC", "protocolSresence", err);
});
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand";
@ -25,7 +26,7 @@ export default abstract class ProtocolPrintoutCommandHandler {
return result.identifiers[0].id;
})
.catch((err) => {
throw new InternalException("Failed creating protocol", err);
throw new DatabaseActionException("CREATE", "protocolPrintout", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
@ -24,7 +25,7 @@ export default abstract class ProtocolVotingCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed creating protocol", err);
throw new DatabaseActionException("SYNC", "protocolVoting", err);
});
}
}

View file

@ -1,6 +1,7 @@
import { dataSource } from "../data-source";
import { refresh } from "../entity/refresh";
import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults";
import DatabaseActionException from "../exceptions/databaseActionException";
import InternalException from "../exceptions/internalException";
import { StringHelper } from "../helpers/stringHelper";
import UserService from "../service/user/userService";
@ -32,7 +33,7 @@ export default abstract class RefreshCommandHandler {
return refreshToken;
})
.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()
.then((res) => {})
.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()
.then((res) => {})
.catch((err) => {
throw new InternalException("failed expired refresh removal", err);
throw new DatabaseActionException("DELETE", "refresh", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../data-source";
import { reset } from "../entity/reset";
import DatabaseActionException from "../exceptions/databaseActionException";
import InternalException from "../exceptions/internalException";
import { StringHelper } from "../helpers/stringHelper";
import { CreateResetCommand, DeleteResetCommand } from "./resetCommand";
@ -29,7 +30,7 @@ export default abstract class ResetCommandHandler {
return token;
})
.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()
.then((res) => {})
.catch((err) => {
throw new InternalException("failed reset removal", err);
throw new DatabaseActionException("DELETE", "reset", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { award } from "../../../entity/settings/award";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
@ -22,7 +23,7 @@ export default abstract class AwardCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting award ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "award", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { calendarType } from "../../../entity/settings/calendarType";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand";
@ -25,7 +26,7 @@ export default abstract class CalendarTypeCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting calendarType${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "calendarType", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { communicationType } from "../../../entity/settings/communicationType";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateCommunicationTypeCommand,
@ -27,7 +28,7 @@ export default abstract class CommunicationTypeCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting communicationType${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
throw new DatabaseActionException("DELETE", "communicationType", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { executivePosition } from "../../../entity/settings/executivePosition";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateExecutivePositionCommand,
@ -26,7 +27,7 @@ export default abstract class ExecutivePositionCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting executivePosition${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
throw new DatabaseActionException("DELETE", "executivePosition", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { membershipStatus } from "../../../entity/settings/membershipStatus";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateMembershipStatusCommand,
@ -26,7 +27,7 @@ export default abstract class MembershipStatusCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting membershipStatus${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
throw new DatabaseActionException("DELETE", "membershipStatus", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { newsletterConfig } from "../../../entity/settings/newsletterConfig";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { SetNewsletterConfigCommand } from "./newsletterConfigCommand";
@ -24,7 +25,7 @@ export default abstract class NewsletterConfigCommandHandler {
return result.identifiers[0].id;
})
.catch((err) => {
throw new InternalException("Failed setting newsletterConfig", err);
throw new DatabaseActionException("SET", "newsletterConfig", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { qualification } from "../../../entity/settings/qualification";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateQualificationCommand,
@ -27,7 +28,7 @@ export default abstract class QualificationCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting qualification${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "qualification", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { query } from "../../../entity/settings/query";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand";
@ -24,7 +25,7 @@ export default abstract class QueryStoreCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting queryStore${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "queryStore", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { salutation } from "../../../entity/settings/salutation";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand";
@ -22,7 +23,7 @@ export default abstract class SalutationCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting salutation ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "salutation", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { template } from "../../../entity/settings/template";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand";
@ -23,7 +24,7 @@ export default abstract class TemplateCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed deleting template${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
throw new DatabaseActionException("DELETE", "template", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { templateUsage } from "../../../entity/settings/templateUsage";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
@ -24,7 +25,7 @@ export default abstract class TemplateUsageCommandHandler {
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed updating templateUsage", err);
throw new DatabaseActionException("SET", "templateUsage", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { role } from "../../../entity/user/role";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand";
@ -22,7 +23,7 @@ export default abstract class RoleCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting role", err);
throw new DatabaseActionException("DELETE", "role", err);
});
}
}

View file

@ -11,6 +11,7 @@ import {
import PermissionHelper from "../../../helpers/permissionHelper";
import RolePermissionService from "../../../service/user/rolePermissionService";
import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class RolePermissionCommandHandler {
/**
@ -35,7 +36,7 @@ export default abstract class RolePermissionCommandHandler {
})
.then(() => {})
.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 })
.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);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { invite } from "../../../entity/user/invite";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { StringHelper } from "../../../helpers/stringHelper";
import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand";
@ -31,7 +32,7 @@ export default abstract class InviteCommandHandler {
return token;
})
.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()
.then((res) => {})
.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()
.then((res) => {})
.catch((err) => {
throw new InternalException("failed invite removal", err);
throw new DatabaseActionException("DELETE", "invite", err);
});
}
}

View file

@ -11,6 +11,7 @@ import {
UpdateUserSecretCommand,
} from "./userCommand";
import UserService from "../../../service/user/userService";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class UserCommandHandler {
/**
@ -36,7 +37,7 @@ export default abstract class UserCommandHandler {
return result.identifiers[0].id;
})
.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()
.then(() => {})
.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()
.then(() => {})
.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(() => {})
.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(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting user", err);
throw new DatabaseActionException("DELETE", "user", err);
});
}
}

View file

@ -11,6 +11,7 @@ import {
import UserPermissionService from "../../../service/user/userPermissionService";
import PermissionHelper from "../../../helpers/permissionHelper";
import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class UserPermissionCommandHandler {
/**
@ -36,7 +37,7 @@ export default abstract class UserPermissionCommandHandler {
})
.then(() => {})
.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 })
.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);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { webapi } from "../../../entity/user/webapi";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import {
CreateWebapiCommand,
@ -29,10 +30,7 @@ export default abstract class WebapiCommandHandler {
return result.identifiers[0].token;
})
.catch((err) => {
throw new InternalException(
`Failed creating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
throw new DatabaseActionException("CREATE", "webapi", err);
});
}
@ -53,10 +51,7 @@ export default abstract class WebapiCommandHandler {
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException(
`Failed updating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
throw new DatabaseActionException("UPDATE", "webapi", err);
});
}
@ -76,7 +71,7 @@ export default abstract class WebapiCommandHandler {
.execute()
.then(() => {})
.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()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed deleting api", err);
throw new DatabaseActionException("DELETE", "webapi", err);
});
}
}

View file

@ -11,6 +11,7 @@ import {
import PermissionHelper from "../../../helpers/permissionHelper";
import WebapiPermissionService from "../../../service/user/webapiPermissionService";
import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class WebapiPermissionCommandHandler {
/**
@ -38,7 +39,7 @@ export default abstract class WebapiPermissionCommandHandler {
})
.then(() => {})
.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 })
.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);
});
}
}

View 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);
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { calendar } from "../../entity/club/calendar";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class CalendarService {
@ -18,7 +19,7 @@ export default abstract class CalendarService {
return res;
})
.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;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("calendars not found by type nscdr", err);
throw new DatabaseActionException("SELECT", "calendar", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { communication } from "../../../entity/club/member/communication";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class CommunicationService {
@ -21,7 +22,7 @@ export default abstract class CommunicationService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("member communication not found by id", err);
throw new DatabaseActionException("SELECT", "memberCommunication", err);
});
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberAwards } from "../../../entity/club/member/memberAwards";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class MemberAwardService {
@ -20,7 +21,7 @@ export default abstract class MemberAwardService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("member award not found by id", err);
throw new DatabaseActionException("SELECT", "memberAwards", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class MemberExecutivePositionService {
@ -21,7 +22,7 @@ export default abstract class MemberExecutivePositionService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("member executivePosition not found by id", err);
throw new DatabaseActionException("SELECT", "memberExecutivePositions", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class MemberQualificationService {
@ -20,7 +21,7 @@ export default abstract class MemberQualificationService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("member qualification not found by id", err);
throw new DatabaseActionException("SELECT", "memberQualifications", err);
});
}
}

View file

@ -1,6 +1,8 @@
import { SelectQueryBuilder } from "typeorm";
import { dataSource } from "../../../data-source";
import { member } from "../../../entity/club/member/member";
import { membership } from "../../../entity/club/member/membership";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { memberView } from "../../../views/memberView";
@ -22,40 +24,7 @@ export default abstract class MemberService {
noLimit?: boolean;
ids?: Array<string>;
}): Promise<[Array<member>, number]> {
let query = dataSource
.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");
let query = this.applyMemberBaseJoins();
if (search != "") {
search.split(" ").forEach((term, index) => {
@ -90,7 +59,7 @@ export default abstract class MemberService {
return res;
})
.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>}
*/
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
.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)
.createQueryBuilder("member")
.leftJoinAndMapOne(
@ -133,80 +184,6 @@ export default abstract class MemberService {
.leftJoinAndSelect("sendNewsletter.type", "communicationtype")
.leftJoinAndMapMany("member.smsAlarming", "member.communications", "smsAlarming", "smsAlarming.isSMSAlarming = 1")
.leftJoinAndSelect("smsAlarming.type", "communicationtype_smsAlarming")
.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);
});
.leftJoinAndSelect("member.salutation", "salutation");
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { membership } from "../../../entity/club/member/membership";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
import { membershipView } from "../../../views/membershipsView";
@ -21,7 +22,7 @@ export default abstract class MembershipService {
return res;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("membershipView not found by id", err);
throw new DatabaseActionException("SELECT", "membershipView", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
import { member } from "../../../entity/club/member/member";
import InternalException from "../../../exceptions/internalException";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterDatesService {
/**
@ -21,7 +22,7 @@ export default abstract class NewsletterDatesService {
return res;
})
.catch((err) => {
throw new InternalException("newsletterDatess not found", err);
throw new DatabaseActionException("SELECT", "newsletterDates", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
import { member } from "../../../entity/club/member/member";
import InternalException from "../../../exceptions/internalException";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterRecipientsService {
/**
@ -22,7 +23,7 @@ export default abstract class NewsletterRecipientsService {
return res;
})
.catch((err) => {
throw new InternalException("newsletterRecipients not found", err);
throw new DatabaseActionException("SELECT", "newsletterRecipient", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { newsletter } from "../../../entity/club/newsletter/newsletter";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class NewsletterService {
@ -18,7 +19,7 @@ export default abstract class NewsletterService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("newsletter not found by id", err);
throw new DatabaseActionException("SELECT", "newsletter", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolAgendaService {
@ -17,7 +18,7 @@ export default abstract class ProtocolAgendaService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("protocolAgenda not found by id", err);
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolDecisionService {
@ -17,7 +18,7 @@ export default abstract class ProtocolDecisionService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("protocolDecision not found by id", err);
throw new DatabaseActionException("SELECT", "protocolDecision", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolPresence } from "../../../entity/club/protocol/protocolPresence";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolPresenceService {
@ -18,7 +19,7 @@ export default abstract class ProtocolPresenceService {
return res;
})
.catch((err) => {
throw new InternalException("protocolPresence not found", err);
throw new DatabaseActionException("SELECT", "protocolPresence", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolPrintoutService {
@ -17,7 +18,7 @@ export default abstract class ProtocolPrintoutService {
return res;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("protocolPrintout not found by id", err);
throw new DatabaseActionException("SELECT", "protocolPrintout", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocol } from "../../../entity/club/protocol/protocol";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolService {
@ -19,7 +20,7 @@ export default abstract class ProtocolService {
return res;
})
.catch((err) => {
throw new InternalException("protocols not found", err);
throw new DatabaseActionException("SELECT", "protocol", err);
});
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source";
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException";
export default abstract class ProtocolVotingService {
@ -17,7 +18,7 @@ export default abstract class ProtocolVotingService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("protocolVoting not found by id", err);
throw new DatabaseActionException("SELECT", "protocolVoting", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../data-source";
import { reset } from "../entity/reset";
import DatabaseActionException from "../exceptions/databaseActionException";
import InternalException from "../exceptions/internalException";
export default abstract class ResetService {
@ -20,7 +21,7 @@ export default abstract class ResetService {
return res;
})
.catch((err) => {
throw new InternalException("reset not found by mail and token", err);
throw new DatabaseActionException("SELECT", "reset", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { award } from "../../entity/settings/award";
import { member } from "../../entity/club/member/member";
import InternalException from "../../exceptions/internalException";
import DatabaseActionException from "../../exceptions/databaseActionException";
export default abstract class AwardService {
/**
@ -18,7 +19,7 @@ export default abstract class AwardService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("award not found by id", err);
throw new DatabaseActionException("SELECT", "award", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { calendarType } from "../../entity/settings/calendarType";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class CalendarTypeService {
@ -17,7 +18,7 @@ export default abstract class CalendarTypeService {
return res;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("calendarTypes not found by names", err);
throw new DatabaseActionException("SELECT", "calendarType", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { communicationType } from "../../entity/settings/communicationType";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class CommunicationTypeService {
@ -17,7 +18,7 @@ export default abstract class CommunicationTypeService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("communicationType not found by id", err);
throw new DatabaseActionException("SELECT", "communicationType", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { executivePosition } from "../../entity/settings/executivePosition";
import { memberExecutivePositions } from "../../entity/club/member/memberExecutivePositions";
import InternalException from "../../exceptions/internalException";
import DatabaseActionException from "../../exceptions/databaseActionException";
export default abstract class ExecutivePositionService {
/**
@ -18,7 +19,7 @@ export default abstract class ExecutivePositionService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("executivePosition not found by id", err);
throw new DatabaseActionException("SELECT", "executivePosition", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { membershipStatus } from "../../entity/settings/membershipStatus";
import InternalException from "../../exceptions/internalException";
import { membership } from "../../entity/club/member/membership";
import DatabaseActionException from "../../exceptions/databaseActionException";
export default abstract class MembershipStatusService {
/**
@ -18,7 +19,7 @@ export default abstract class MembershipStatusService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("membershipStatus not found by id", err);
throw new DatabaseActionException("SELECT", "membershipStatus", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { newsletterConfig } from "../../entity/settings/newsletterConfig";
import { member } from "../../entity/club/member/member";
import InternalException from "../../exceptions/internalException";
import DatabaseActionException from "../../exceptions/databaseActionException";
export default abstract class NewsletterConfigService {
/**
@ -19,7 +20,7 @@ export default abstract class NewsletterConfigService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("newsletterConfig not found by cmId", err);
throw new DatabaseActionException("SELECT", "newsletterConfig", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { memberQualifications } from "../../entity/club/member/memberQualifications";
import { qualification } from "../../entity/settings/qualification";
import { user } from "../../entity/user/user";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class QualificationService {
@ -19,7 +20,7 @@ export default abstract class QualificationService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("qualification not found by id", err);
throw new DatabaseActionException("SELECT", "qualification", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { query } from "../../entity/settings/query";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class QueryStoreService {
@ -17,7 +18,7 @@ export default abstract class QueryStoreService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("queryStore not found by id", err);
throw new DatabaseActionException("SELECT", "queryStore", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { salutation } from "../../entity/settings/salutation";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class SalutationService {
@ -17,7 +18,7 @@ export default abstract class SalutationService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("salutation not found by id", err);
throw new DatabaseActionException("SELECT", "salutation", err);
});
}
}

View file

@ -2,6 +2,7 @@ import { dataSource } from "../../data-source";
import { template } from "../../entity/settings/template";
import { member } from "../../entity/club/member/member";
import InternalException from "../../exceptions/internalException";
import DatabaseActionException from "../../exceptions/databaseActionException";
export default abstract class TemplateService {
/**
@ -18,7 +19,7 @@ export default abstract class TemplateService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("template not found by id", err);
throw new DatabaseActionException("SELECT", "template", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { templateUsage } from "../../entity/settings/templateUsage";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class TemplateUsageService {
@ -20,7 +21,7 @@ export default abstract class TemplateUsageService {
return res;
})
.catch((err) => {
throw new InternalException("templates not found", err);
throw new DatabaseActionException("SELECT", "templateUsage", err);
});
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { invite } from "../../entity/user/invite";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class InviteService {
@ -16,7 +17,7 @@ export default abstract class InviteService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("invite not found by mail and token", err);
throw new DatabaseActionException("SELECT", "invite", err);
});
}
}

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../data-source";
import { rolePermission } from "../../entity/user/role_permission";
import { userPermission } from "../../entity/user/user_permission";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class RolePermissionService {
@ -19,7 +20,7 @@ export default abstract class RolePermissionService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("permissions not found by roles", err);
throw new DatabaseActionException("SELECT", "rolePermission", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { role } from "../../entity/user/role";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class RoleService {
@ -18,7 +19,7 @@ export default abstract class RoleService {
return res;
})
.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;
})
.catch((err) => {
throw new InternalException("role not found by id", err);
throw new DatabaseActionException("SELECT", "role", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { userPermission } from "../../entity/user/user_permission";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class UserPermissionService {
@ -18,7 +19,7 @@ export default abstract class UserPermissionService {
return res;
})
.catch((err) => {
throw new InternalException("permission not found by user", err);
throw new DatabaseActionException("SELECT", "userPermission", err);
});
}
}

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../data-source";
import { role } from "../../entity/user/role";
import { user } from "../../entity/user/user";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class UserService {
@ -22,7 +23,7 @@ export default abstract class UserService {
return res;
})
.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;
})
.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;
})
.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;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("could not get roles for user", err);
throw new DatabaseActionException("SELECT", "userRoles", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { webapiPermission } from "../../entity/user/webapi_permission";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class WebapiPermissionService {
@ -18,7 +19,7 @@ export default abstract class WebapiPermissionService {
return res;
})
.catch((err) => {
throw new InternalException("webapi permissions not found by api", err);
throw new DatabaseActionException("SELECT", "webapiPermission", err);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../data-source";
import { webapi } from "../../entity/user/webapi";
import DatabaseActionException from "../../exceptions/databaseActionException";
import InternalException from "../../exceptions/internalException";
export default abstract class WebapiService {
@ -17,7 +18,7 @@ export default abstract class WebapiService {
return res;
})
.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;
})
.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;
})
.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;
})
.catch((err) => {
throw new InternalException("webapi token not found by id", err);
throw new DatabaseActionException("SELECT", "webapi", err);
});
}
}