sync and create change
This commit is contained in:
parent
5f434c943e
commit
e1ad491e68
16 changed files with 285 additions and 39 deletions
|
@ -21,6 +21,7 @@ import { SynchronizeProtocolPresenceCommand } from "../../command/protocolPresen
|
|||
import { SynchronizeProtocolDecisionCommand } from "../../command/protocolDecisionCommand";
|
||||
import { SynchronizeProtocolVotingCommand } from "../../command/protocolVotingCommand";
|
||||
import { ProtocolVotingViewModel } from "../../viewmodel/admin/protocolVoting.models";
|
||||
import ProtocolVotingCommandHandler from "../../command/protocolVotingCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all protocols
|
||||
|
@ -129,6 +130,48 @@ export async function createProtocol(req: Request, res: Response): Promise<any>
|
|||
res.send(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create protocol agenda by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createProtocolAgendaById(req: Request, res: Response): Promise<any> {
|
||||
let protocolId = parseInt(req.params.protocolId);
|
||||
|
||||
let agenda = await ProtocolAgendaCommandHandler.create(protocolId);
|
||||
|
||||
res.send(agenda);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create protocol decisions by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createProtocolDecisonsById(req: Request, res: Response): Promise<any> {
|
||||
let protocolId = parseInt(req.params.protocolId);
|
||||
|
||||
let decision = await ProtocolDecisionCommandHandler.create(protocolId);
|
||||
|
||||
res.send(decision);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create protocol votings by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createProtocolVotingsById(req: Request, res: Response): Promise<any> {
|
||||
let protocolId = parseInt(req.params.protocolId);
|
||||
|
||||
let voting = await ProtocolVotingCommandHandler.create(protocolId);
|
||||
|
||||
res.send(voting);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description synchronize protocol by id
|
||||
* @param req {Request} Express req object
|
||||
|
@ -202,25 +245,6 @@ export async function synchronizeProtocolDecisonsById(req: Request, res: Respons
|
|||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description synchronize protocol precense by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function synchronizeProtocolPrecenseById(req: Request, res: Response): Promise<any> {
|
||||
let protocolId = parseInt(req.params.protocolId);
|
||||
let presence = req.body.precense as Array<number>;
|
||||
|
||||
let syncPresence: SynchronizeProtocolPresenceCommand = {
|
||||
memberIds: presence,
|
||||
protocolId,
|
||||
};
|
||||
await ProtocolPresenceCommandHandler.sync(syncPresence);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description synchronize protocol votings by id
|
||||
* @param req {Request} Express req object
|
||||
|
@ -242,7 +266,26 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
|
|||
protocolId,
|
||||
})
|
||||
);
|
||||
await ProtocolDecisionCommandHandler.sync(syncDecision);
|
||||
await ProtocolVotingCommandHandler.sync(syncDecision);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description synchronize protocol precense by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function synchronizeProtocolPrecenseById(req: Request, res: Response): Promise<any> {
|
||||
let protocolId = parseInt(req.params.protocolId);
|
||||
let presence = req.body.presence as Array<number>;
|
||||
|
||||
let syncPresence: SynchronizeProtocolPresenceCommand = {
|
||||
memberIds: presence,
|
||||
protocolId,
|
||||
};
|
||||
await ProtocolPresenceCommandHandler.sync(syncPresence);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue