import { dataSource } from "../data-source"; import { membershipStatus } from "../entity/membershipStatus"; import InternalException from "../exceptions/internalException"; import { membership } from "../entity/membership"; export default abstract class MembershipStatusService { /** * @description get all membershipStatuss * @returns {Promise>} */ static async getAll(): Promise> { return await dataSource .getRepository(membershipStatus) .createQueryBuilder("membershipStatus") .getMany() .then((res) => { return res; }) .catch((err) => { throw new InternalException("membershipStatuss not found", err); }); } /** * @description get membershipStatus by id * @returns {Promise} */ static async getById(id: number): Promise { return await dataSource .getRepository(membershipStatus) .createQueryBuilder("membershipStatus") .where("membershipStatus.id = :id", { id: id }) .getOneOrFail() .then((res) => { return res; }) .catch((err) => { throw new InternalException("membershipStatus not found by id", err); }); } }