add sorting to protocol agenda, decision and votings

This commit is contained in:
Julian Krauser 2025-03-21 09:46:29 +01:00
parent 4b6f0b34df
commit 2e5b345daa
22 changed files with 138 additions and 16 deletions

View file

@ -39,4 +39,22 @@ export default abstract class ProtocolAgendaService {
throw new DatabaseActionException("SELECT", "protocolAgenda", err);
});
}
/**
* @description get count of exisiting protocolAgenda by protocolId
* @returns {Promise<number>}
*/
static async getInstanceCount(protocolId: number): Promise<number> {
return await dataSource
.getRepository(protocolAgenda)
.createQueryBuilder("protocolAgenda")
.where({ protocolId })
.getCount()
.then((res) => {
return res;
})
.catch((err) => {
throw new DatabaseActionException("COUNT", "protocolAgenda", err);
});
}
}

View file

@ -39,4 +39,22 @@ export default abstract class ProtocolDecisionService {
throw new DatabaseActionException("SELECT", "protocolDecision", err);
});
}
/**
* @description get count of exisiting protocolDecision by protocolId
* @returns {Promise<number>}
*/
static async getInstanceCount(protocolId: number): Promise<number> {
return await dataSource
.getRepository(protocolDecision)
.createQueryBuilder("protocolDecisions")
.where({ protocolId })
.getCount()
.then((res) => {
return res;
})
.catch((err) => {
throw new DatabaseActionException("COUNT", "protocolDecision", err);
});
}
}

View file

@ -39,4 +39,22 @@ export default abstract class ProtocolVotingService {
throw new DatabaseActionException("SELECT", "protocolVoting", err);
});
}
/**
* @description get count of exisiting protocolVoting by protocolId
* @returns {Promise<number>}
*/
static async getInstanceCount(protocolId: number): Promise<number> {
return await dataSource
.getRepository(protocolVoting)
.createQueryBuilder("protocolVotings")
.where({ protocolId })
.getCount()
.then((res) => {
return res;
})
.catch((err) => {
throw new DatabaseActionException("COUNT", "protocolVoting", err);
});
}
}