change folder structure
This commit is contained in:
parent
a332e4d779
commit
a09c75a998
167 changed files with 262 additions and 246 deletions
43
src/service/configuration/awardService.ts
Normal file
43
src/service/configuration/awardService.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { award } from "../../entity/configuration/award";
|
||||
import { member } from "../../entity/club/member/member";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class AwardService {
|
||||
/**
|
||||
* @description get all awards
|
||||
* @returns {Promise<Array<award>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<award>> {
|
||||
return await dataSource
|
||||
.getRepository(award)
|
||||
.createQueryBuilder("award")
|
||||
.orderBy("award", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "award", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get award by id
|
||||
* @returns {Promise<award>}
|
||||
*/
|
||||
static async getById(id: number): Promise<award> {
|
||||
return await dataSource
|
||||
.getRepository(award)
|
||||
.createQueryBuilder("award")
|
||||
.where("award.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "award", err);
|
||||
});
|
||||
}
|
||||
}
|
60
src/service/configuration/calendarTypeService.ts
Normal file
60
src/service/configuration/calendarTypeService.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { calendarType } from "../../entity/configuration/calendarType";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class CalendarTypeService {
|
||||
/**
|
||||
* @description get all calendar types
|
||||
* @returns {Promise<Array<calendarType>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<calendarType>> {
|
||||
return await dataSource
|
||||
.getRepository(calendarType)
|
||||
.createQueryBuilder("calendarType")
|
||||
.orderBy("type", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get calendar type by id
|
||||
* @returns {Promise<calendarType>}
|
||||
*/
|
||||
static async getById(id: number): Promise<calendarType> {
|
||||
return await dataSource
|
||||
.getRepository(calendarType)
|
||||
.createQueryBuilder("calendarType")
|
||||
.where("calendarType.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get calendar by names
|
||||
* @returns {Promise<Array<calendarType>>}
|
||||
*/
|
||||
static async getByTypes(names: Array<string>): Promise<Array<calendarType>> {
|
||||
return await dataSource
|
||||
.getRepository(calendarType)
|
||||
.createQueryBuilder("calendarType")
|
||||
.where("calendarType.type IN (:...names)", { names: names })
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "calendarType", err);
|
||||
});
|
||||
}
|
||||
}
|
42
src/service/configuration/communicationTypeService.ts
Normal file
42
src/service/configuration/communicationTypeService.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { communicationType } from "../../entity/configuration/communicationType";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class CommunicationTypeService {
|
||||
/**
|
||||
* @description get all communicationTypes
|
||||
* @returns {Promise<Array<communicationType>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<communicationType>> {
|
||||
return await dataSource
|
||||
.getRepository(communicationType)
|
||||
.createQueryBuilder("communicationType")
|
||||
.orderBy("type", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "communicationType", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get communicationType by id
|
||||
* @returns {Promise<communicationType>}
|
||||
*/
|
||||
static async getById(id: number): Promise<communicationType> {
|
||||
return await dataSource
|
||||
.getRepository(communicationType)
|
||||
.createQueryBuilder("communicationType")
|
||||
.where("communicationType.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "communicationType", err);
|
||||
});
|
||||
}
|
||||
}
|
43
src/service/configuration/executivePositionService.ts
Normal file
43
src/service/configuration/executivePositionService.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { executivePosition } from "../../entity/configuration/executivePosition";
|
||||
import { memberExecutivePositions } from "../../entity/club/member/memberExecutivePositions";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class ExecutivePositionService {
|
||||
/**
|
||||
* @description get all executivePositions
|
||||
* @returns {Promise<Array<executivePosition>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<executivePosition>> {
|
||||
return await dataSource
|
||||
.getRepository(executivePosition)
|
||||
.createQueryBuilder("executivePosition")
|
||||
.orderBy("position", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "executivePosition", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get executivePosition by id
|
||||
* @returns {Promise<executivePosition>}
|
||||
*/
|
||||
static async getById(id: number): Promise<executivePosition> {
|
||||
return await dataSource
|
||||
.getRepository(executivePosition)
|
||||
.createQueryBuilder("executivePosition")
|
||||
.where("executivePosition.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "executivePosition", err);
|
||||
});
|
||||
}
|
||||
}
|
43
src/service/configuration/membershipStatusService.ts
Normal file
43
src/service/configuration/membershipStatusService.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { membershipStatus } from "../../entity/configuration/membershipStatus";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
import { membership } from "../../entity/club/member/membership";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class MembershipStatusService {
|
||||
/**
|
||||
* @description get all membershipStatuss
|
||||
* @returns {Promise<Array<membershipStatus>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<membershipStatus>> {
|
||||
return await dataSource
|
||||
.getRepository(membershipStatus)
|
||||
.createQueryBuilder("membershipStatus")
|
||||
.orderBy("status", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "membershipStatus", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get membershipStatus by id
|
||||
* @returns {Promise<membershipStatus>}
|
||||
*/
|
||||
static async getById(id: number): Promise<membershipStatus> {
|
||||
return await dataSource
|
||||
.getRepository(membershipStatus)
|
||||
.createQueryBuilder("membershipStatus")
|
||||
.where("membershipStatus.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "membershipStatus", err);
|
||||
});
|
||||
}
|
||||
}
|
45
src/service/configuration/newsletterConfigService.ts
Normal file
45
src/service/configuration/newsletterConfigService.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { newsletterConfig } from "../../entity/configuration/newsletterConfig";
|
||||
import { member } from "../../entity/club/member/member";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class NewsletterConfigService {
|
||||
/**
|
||||
* @description get all newsletterConfigs
|
||||
* @returns {Promise<Array<newsletterConfig>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<newsletterConfig>> {
|
||||
return await dataSource
|
||||
.getRepository(newsletterConfig)
|
||||
.createQueryBuilder("newsletterConfig")
|
||||
.leftJoinAndSelect("newsletterConfig.comType", "comType")
|
||||
.orderBy("comType.type", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get newsletterConfig by id
|
||||
* @returns {Promise<newsletterConfig>}
|
||||
*/
|
||||
static async getByComId(comId: number): Promise<newsletterConfig> {
|
||||
return await dataSource
|
||||
.getRepository(newsletterConfig)
|
||||
.createQueryBuilder("newsletterConfig")
|
||||
.leftJoinAndSelect("newsletterConfig.comType", "comType")
|
||||
.where("newsletterConfig.comTypId = :comTypId", { icomTypId: comId })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
}
|
44
src/service/configuration/qualification.ts
Normal file
44
src/service/configuration/qualification.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { memberQualifications } from "../../entity/club/member/memberQualifications";
|
||||
import { qualification } from "../../entity/configuration/qualification";
|
||||
import { user } from "../../entity/management/user";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class QualificationService {
|
||||
/**
|
||||
* @description get all qualifications
|
||||
* @returns {Promise<Array<qualification>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<qualification>> {
|
||||
return await dataSource
|
||||
.getRepository(qualification)
|
||||
.createQueryBuilder("qualification")
|
||||
.orderBy("qualification", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "qualification", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get qualification by id
|
||||
* @returns {Promise<qualification>}
|
||||
*/
|
||||
static async getById(id: number): Promise<qualification> {
|
||||
return await dataSource
|
||||
.getRepository(qualification)
|
||||
.createQueryBuilder("qualification")
|
||||
.where("qualification.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "qualification", err);
|
||||
});
|
||||
}
|
||||
}
|
42
src/service/configuration/queryStoreService.ts
Normal file
42
src/service/configuration/queryStoreService.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { query } from "../../entity/configuration/query";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class QueryStoreService {
|
||||
/**
|
||||
* @description get all queryStores
|
||||
* @returns {Promise<Array<query>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<query>> {
|
||||
return await dataSource
|
||||
.getRepository(query)
|
||||
.createQueryBuilder("queryStore")
|
||||
.orderBy("title", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "queryStore", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get queryStore by id
|
||||
* @returns {Promise<query>}
|
||||
*/
|
||||
static async getById(id: number): Promise<query> {
|
||||
return await dataSource
|
||||
.getRepository(query)
|
||||
.createQueryBuilder("queryStore")
|
||||
.where("queryStore.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "queryStore", err);
|
||||
});
|
||||
}
|
||||
}
|
42
src/service/configuration/salutationService.ts
Normal file
42
src/service/configuration/salutationService.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { salutation } from "../../entity/configuration/salutation";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class SalutationService {
|
||||
/**
|
||||
* @description get all salutations
|
||||
* @returns {Promise<Array<salutation>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<salutation>> {
|
||||
return await dataSource
|
||||
.getRepository(salutation)
|
||||
.createQueryBuilder("salutation")
|
||||
.orderBy("salutation", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "salutation", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get salutation by id
|
||||
* @returns {Promise<salutation>}
|
||||
*/
|
||||
static async getById(id: number): Promise<salutation> {
|
||||
return await dataSource
|
||||
.getRepository(salutation)
|
||||
.createQueryBuilder("salutation")
|
||||
.where("salutation.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "salutation", err);
|
||||
});
|
||||
}
|
||||
}
|
43
src/service/configuration/templateService.ts
Normal file
43
src/service/configuration/templateService.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { template } from "../../entity/configuration/template";
|
||||
import { member } from "../../entity/club/member/member";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class TemplateService {
|
||||
/**
|
||||
* @description get all templates
|
||||
* @returns {Promise<Array<template>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<template>> {
|
||||
return await dataSource
|
||||
.getRepository(template)
|
||||
.createQueryBuilder("template")
|
||||
.orderBy("template", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "template", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get template by id
|
||||
* @returns {Promise<template>}
|
||||
*/
|
||||
static async getById(id: number): Promise<template> {
|
||||
return await dataSource
|
||||
.getRepository(template)
|
||||
.createQueryBuilder("template")
|
||||
.where("template.id = :id", { id: id })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "template", err);
|
||||
});
|
||||
}
|
||||
}
|
48
src/service/configuration/templateUsageService.ts
Normal file
48
src/service/configuration/templateUsageService.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { templateUsage } from "../../entity/configuration/templateUsage";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class TemplateUsageService {
|
||||
/**
|
||||
* @description get all templateUsages
|
||||
* @returns {Promise<Array<templateUsage>>}
|
||||
*/
|
||||
static async getAll(): Promise<Array<templateUsage>> {
|
||||
return await dataSource
|
||||
.getRepository(templateUsage)
|
||||
.createQueryBuilder("templateUsage")
|
||||
.leftJoinAndSelect("templateUsage.header", "headerTemplate")
|
||||
.leftJoinAndSelect("templateUsage.body", "bodyTemplate")
|
||||
.leftJoinAndSelect("templateUsage.footer", "footerTemplate")
|
||||
.orderBy("scope", "ASC")
|
||||
.getMany()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "templateUsage", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get template by scope
|
||||
* @returns {Promise<templateUsage>}
|
||||
*/
|
||||
static async getByScope(scope: string): Promise<templateUsage | null> {
|
||||
return await dataSource
|
||||
.getRepository(templateUsage)
|
||||
.createQueryBuilder("templateUsage")
|
||||
.leftJoinAndSelect("templateUsage.header", "headerTemplate")
|
||||
.leftJoinAndSelect("templateUsage.body", "bodyTemplate")
|
||||
.leftJoinAndSelect("templateUsage.footer", "footerTemplate")
|
||||
.where("templateUsage.scope = :scope", { scope: scope })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err): null => {
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue