24 lines
843 B
TypeScript
24 lines
843 B
TypeScript
import { dataSource } from "../data-source";
|
|
import { protocolPresence } from "../entity/protocolPresence";
|
|
import InternalException from "../exceptions/internalException";
|
|
|
|
export default abstract class ProtocolPresenceService {
|
|
/**
|
|
* @description get all protocolPresences
|
|
* @returns {Promise<Array<protocolPresence>>}
|
|
*/
|
|
static async getAll(protocolId: number): Promise<Array<protocolPresence>> {
|
|
return await dataSource
|
|
.getRepository(protocolPresence)
|
|
.createQueryBuilder("protocolPresence")
|
|
.leftJoinAndSelect("protocolPresence.member", "member")
|
|
.where("protocolPresence.protocolId = :protocolId", { protocolId })
|
|
.getMany()
|
|
.then((res) => {
|
|
return res;
|
|
})
|
|
.catch((err) => {
|
|
throw new InternalException("protocolPresence not found", err);
|
|
});
|
|
}
|
|
}
|