change folder structure
This commit is contained in:
parent
a332e4d779
commit
a09c75a998
167 changed files with 262 additions and 246 deletions
|
@ -1,43 +0,0 @@
|
|||
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 {
|
||||
/**
|
||||
* @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);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue