2024-10-11 12:44:09 +00:00
|
|
|
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")
|
2024-10-15 14:25:42 +00:00
|
|
|
.leftJoinAndSelect("protocolPresence.member", "member")
|
2024-10-13 13:48:01 +00:00
|
|
|
.where("protocolPresence.protocolId = :protocolId", { protocolId })
|
2024-10-11 12:44:09 +00:00
|
|
|
.getMany()
|
|
|
|
.then((res) => {
|
|
|
|
return res;
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
throw new InternalException("protocolPresence not found", err);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|