add sorting to protocol agenda, decision and votings
This commit is contained in:
parent
4b6f0b34df
commit
2e5b345daa
22 changed files with 138 additions and 16 deletions
|
@ -2,5 +2,6 @@ export interface SynchronizeProtocolAgendaCommand {
|
|||
id?: number;
|
||||
topic: string;
|
||||
context: string;
|
||||
sort?: number;
|
||||
protocolId: number;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
|||
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import ProtocolAgendaService from "../../../service/club/protocol/protocolAgendaService";
|
||||
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
||||
|
||||
export default abstract class ProtocolAgendaCommandHandler {
|
||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
|||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(protocolId: number): Promise<number> {
|
||||
let count = await ProtocolAgendaService.getInstanceCount(protocolId);
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
|||
.values({
|
||||
topic: "",
|
||||
context: "",
|
||||
sort: count,
|
||||
protocolId,
|
||||
})
|
||||
.execute()
|
||||
|
@ -40,7 +43,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
|||
.insert()
|
||||
.into(protocolAgenda)
|
||||
.values(syncProtocolAgenda)
|
||||
.orUpdate(["topic", "context"], ["id"])
|
||||
.orUpdate(["topic", "context", "sort"], ["id"])
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -2,5 +2,6 @@ export interface SynchronizeProtocolDecisionCommand {
|
|||
id?: number;
|
||||
topic: string;
|
||||
context: string;
|
||||
sort?: number;
|
||||
protocolId: number;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
|||
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import ProtocolDecisionService from "../../../service/club/protocol/protocolDecisionService";
|
||||
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
||||
|
||||
export default abstract class ProtocolDecisionCommandHandler {
|
||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
|||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(protocolId: number): Promise<number> {
|
||||
let count = await ProtocolDecisionService.getInstanceCount(protocolId);
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
|||
.values({
|
||||
topic: "",
|
||||
context: "",
|
||||
sort: count,
|
||||
protocolId,
|
||||
})
|
||||
.execute()
|
||||
|
@ -39,7 +42,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
|||
.insert()
|
||||
.into(protocolDecision)
|
||||
.values(syncProtocolDecisions)
|
||||
.orUpdate(["topic", "context"], ["id"])
|
||||
.orUpdate(["topic", "context", "sort"], ["id"])
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -5,5 +5,6 @@ export interface SynchronizeProtocolVotingCommand {
|
|||
favour: number;
|
||||
abstain: number;
|
||||
against: number;
|
||||
sort?: number;
|
||||
protocolId: number;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { dataSource } from "../../../data-source";
|
|||
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import ProtocolVotingService from "../../../service/club/protocol/protocolVotingService";
|
||||
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
||||
|
||||
export default abstract class ProtocolVotingCommandHandler {
|
||||
|
@ -11,6 +12,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
|||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(protocolId: number): Promise<number> {
|
||||
let count = await ProtocolVotingService.getInstanceCount(protocolId);
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
|
@ -18,6 +20,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
|||
.values({
|
||||
topic: "",
|
||||
context: "",
|
||||
sort: count,
|
||||
protocolId,
|
||||
})
|
||||
.execute()
|
||||
|
@ -39,7 +42,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
|||
.insert()
|
||||
.into(protocolVoting)
|
||||
.values(syncProtocolVotings)
|
||||
.orUpdate(["topic", "context", "favour", "abstain", "against"], ["id"])
|
||||
.orUpdate(["topic", "context", "favour", "abstain", "against", "sort"], ["id"])
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue