change folder structure
This commit is contained in:
parent
a332e4d779
commit
a09c75a998
167 changed files with 262 additions and 246 deletions
|
@ -1,48 +0,0 @@
|
|||
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 {
|
||||
/**
|
||||
* @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