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