sync and create change
This commit is contained in:
parent
5f434c943e
commit
e1ad491e68
16 changed files with 285 additions and 39 deletions
|
@ -4,6 +4,30 @@ import InternalException from "../exceptions/internalException";
|
||||||
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolAgendaCommandHandler {
|
export default abstract class ProtocolAgendaCommandHandler {
|
||||||
|
/**
|
||||||
|
* @description create protocolAgenda
|
||||||
|
* @param {number}
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(protocolAgenda)
|
||||||
|
.values({
|
||||||
|
topic: "",
|
||||||
|
context: "",
|
||||||
|
protocolId,
|
||||||
|
})
|
||||||
|
.execute()
|
||||||
|
.then((result) => {
|
||||||
|
return result.identifiers[0].id;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new InternalException("Failed creating protocol", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description sync protocolAgenda
|
* @description sync protocolAgenda
|
||||||
* @param {Array<SynchronizeProtocolAgendaCommand>}
|
* @param {Array<SynchronizeProtocolAgendaCommand>}
|
||||||
|
|
|
@ -4,6 +4,29 @@ import InternalException from "../exceptions/internalException";
|
||||||
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolDecisionCommandHandler {
|
export default abstract class ProtocolDecisionCommandHandler {
|
||||||
|
/**
|
||||||
|
* @description create protocolDecision
|
||||||
|
* @param {number}
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(protocolDecision)
|
||||||
|
.values({
|
||||||
|
topic: "",
|
||||||
|
context: "",
|
||||||
|
protocolId,
|
||||||
|
})
|
||||||
|
.execute()
|
||||||
|
.then((result) => {
|
||||||
|
return result.identifiers[0].id;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new InternalException("Failed creating protocol", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @description sync protocolDecision
|
* @description sync protocolDecision
|
||||||
* @param {Array<SynchronizeProtocolDecisionCommand>}
|
* @param {Array<SynchronizeProtocolDecisionCommand>}
|
||||||
|
|
|
@ -21,13 +21,17 @@ export default abstract class ProtocolPresenceCommandHandler {
|
||||||
let newMembers = syncProtocolPresences.memberIds.filter((r) => !currentPresence.includes(r));
|
let newMembers = syncProtocolPresences.memberIds.filter((r) => !currentPresence.includes(r));
|
||||||
let removeMembers = currentPresence.filter((r) => !syncProtocolPresences.memberIds.includes(r));
|
let removeMembers = currentPresence.filter((r) => !syncProtocolPresences.memberIds.includes(r));
|
||||||
|
|
||||||
await this.syncPresenceAdd(manager, syncProtocolPresences.protocolId, newMembers);
|
if (newMembers.length != 0) {
|
||||||
|
await this.syncPresenceAdd(manager, syncProtocolPresences.protocolId, newMembers);
|
||||||
|
}
|
||||||
|
|
||||||
await this.syncPresenceRemove(manager, syncProtocolPresences.protocolId, removeMembers);
|
if (removeMembers.length != 0) {
|
||||||
|
await this.syncPresenceRemove(manager, syncProtocolPresences.protocolId, removeMembers);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw new InternalException("Failed saving user roles", err);
|
throw new InternalException("Failed saving protocol presence", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +47,7 @@ export default abstract class ProtocolPresenceCommandHandler {
|
||||||
.values(
|
.values(
|
||||||
memberIds.map((m) => ({
|
memberIds.map((m) => ({
|
||||||
protocolId,
|
protocolId,
|
||||||
memberIds: m,
|
memberId: m,
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
.execute();
|
.execute();
|
||||||
|
@ -59,7 +63,7 @@ export default abstract class ProtocolPresenceCommandHandler {
|
||||||
.delete()
|
.delete()
|
||||||
.from(protocolPresence)
|
.from(protocolPresence)
|
||||||
.where("memberId IN (:...ids)", { ids: memberIds })
|
.where("memberId IN (:...ids)", { ids: memberIds })
|
||||||
.andWhere("protcolId = :protocolId", { protocolId })
|
.andWhere("protocolId = :protocolId", { protocolId })
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,29 @@ import InternalException from "../exceptions/internalException";
|
||||||
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
||||||
|
|
||||||
export default abstract class ProtocolVotingCommandHandler {
|
export default abstract class ProtocolVotingCommandHandler {
|
||||||
|
/**
|
||||||
|
* @description create protocolVoting
|
||||||
|
* @param {number}
|
||||||
|
* @returns {Promise<number>}
|
||||||
|
*/
|
||||||
|
static async create(protocolId: number): Promise<number> {
|
||||||
|
return await dataSource
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(protocolVoting)
|
||||||
|
.values({
|
||||||
|
topic: "",
|
||||||
|
context: "",
|
||||||
|
protocolId,
|
||||||
|
})
|
||||||
|
.execute()
|
||||||
|
.then((result) => {
|
||||||
|
return result.identifiers[0].id;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw new InternalException("Failed creating protocol", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @description sync protocolVoting
|
* @description sync protocolVoting
|
||||||
* @param {Array<SynchronizeProtocolVotingCommand>}
|
* @param {Array<SynchronizeProtocolVotingCommand>}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { SynchronizeProtocolPresenceCommand } from "../../command/protocolPresen
|
||||||
import { SynchronizeProtocolDecisionCommand } from "../../command/protocolDecisionCommand";
|
import { SynchronizeProtocolDecisionCommand } from "../../command/protocolDecisionCommand";
|
||||||
import { SynchronizeProtocolVotingCommand } from "../../command/protocolVotingCommand";
|
import { SynchronizeProtocolVotingCommand } from "../../command/protocolVotingCommand";
|
||||||
import { ProtocolVotingViewModel } from "../../viewmodel/admin/protocolVoting.models";
|
import { ProtocolVotingViewModel } from "../../viewmodel/admin/protocolVoting.models";
|
||||||
|
import ProtocolVotingCommandHandler from "../../command/protocolVotingCommandHandler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description get all protocols
|
* @description get all protocols
|
||||||
|
@ -129,6 +130,48 @@ export async function createProtocol(req: Request, res: Response): Promise<any>
|
||||||
res.send(id);
|
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
|
* @description synchronize protocol by id
|
||||||
* @param req {Request} Express req object
|
* @param req {Request} Express req object
|
||||||
|
@ -202,25 +245,6 @@ export async function synchronizeProtocolDecisonsById(req: Request, res: Respons
|
||||||
res.sendStatus(204);
|
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
|
* @description synchronize protocol votings by id
|
||||||
* @param req {Request} Express req object
|
* @param req {Request} Express req object
|
||||||
|
@ -242,7 +266,26 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
|
||||||
protocolId,
|
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);
|
res.sendStatus(204);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import { protocolPresence } from "./entity/protocolPresence";
|
||||||
import { protocolVoting } from "./entity/protocolVoting";
|
import { protocolVoting } from "./entity/protocolVoting";
|
||||||
import { ProtocolTables1728563204766 } from "./migrations/1728563204766-protocolTables";
|
import { ProtocolTables1728563204766 } from "./migrations/1728563204766-protocolTables";
|
||||||
import { ProtocolTableRename1728645611919 } from "./migrations/1728645611919-protocolTableRename";
|
import { ProtocolTableRename1728645611919 } from "./migrations/1728645611919-protocolTableRename";
|
||||||
|
import { ProtocolTableTypes1728999487170 } from "./migrations/1728999487170-protocolTableTypes";
|
||||||
|
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: DB_TYPE as any,
|
type: DB_TYPE as any,
|
||||||
|
@ -86,6 +87,7 @@ const dataSource = new DataSource({
|
||||||
ProtocolBase1728037129072,
|
ProtocolBase1728037129072,
|
||||||
ProtocolTables1728563204766,
|
ProtocolTables1728563204766,
|
||||||
ProtocolTableRename1728645611919,
|
ProtocolTableRename1728645611919,
|
||||||
|
ProtocolTableTypes1728999487170,
|
||||||
],
|
],
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrationsTransactionMode: "each",
|
migrationsTransactionMode: "each",
|
||||||
|
|
|
@ -9,9 +9,12 @@ export class protocolAgenda {
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
topic: string;
|
topic: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, default: "" })
|
@Column({ type: "text", default: "" })
|
||||||
context: string;
|
context: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
protocolId: number;
|
||||||
|
|
||||||
@ManyToOne(() => protocol, {
|
@ManyToOne(() => protocol, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
|
|
|
@ -9,9 +9,12 @@ export class protocolDecision {
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
topic: string;
|
topic: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, default: "" })
|
@Column({ type: "text", default: "" })
|
||||||
context: string;
|
context: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
protocolId: number;
|
||||||
|
|
||||||
@ManyToOne(() => protocol, {
|
@ManyToOne(() => protocol, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
|
|
|
@ -9,7 +9,7 @@ export class protocolVoting {
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
topic: string;
|
topic: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, default: "" })
|
@Column({ type: "text", default: "" })
|
||||||
context: string;
|
context: string;
|
||||||
|
|
||||||
@Column({ type: "int", default: 0 })
|
@Column({ type: "int", default: 0 })
|
||||||
|
@ -21,6 +21,9 @@ export class protocolVoting {
|
||||||
@Column({ type: "int", default: 0 })
|
@Column({ type: "int", default: 0 })
|
||||||
against: number;
|
against: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
protocolId: number;
|
||||||
|
|
||||||
@ManyToOne(() => protocol, {
|
@ManyToOne(() => protocol, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default abstract class ProtocolAgendaFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
topic: record.topic,
|
topic: record.topic,
|
||||||
context: record.context,
|
context: record.context,
|
||||||
protocolId: record.protocol.id,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default abstract class ProtocolDecisionFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
topic: record.topic,
|
topic: record.topic,
|
||||||
context: record.context,
|
context: record.context,
|
||||||
protocolId: record.protocol.id,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default abstract class ProtocolPresenceFactory {
|
||||||
return {
|
return {
|
||||||
memberId: record.member.id,
|
memberId: record.member.id,
|
||||||
member: MemberFactory.mapToSingle(record.member),
|
member: MemberFactory.mapToSingle(record.member),
|
||||||
protocolId: record.protocol.id,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ export default abstract class ProtocolVotingFactory {
|
||||||
favour: record.favour,
|
favour: record.favour,
|
||||||
abstain: record.abstain,
|
abstain: record.abstain,
|
||||||
against: record.against,
|
against: record.against,
|
||||||
protocolId: record.protocol.id,
|
protocolId: record.protocolId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
101
src/migrations/1728999487170-protocolTableTypes.ts
Normal file
101
src/migrations/1728999487170-protocolTableTypes.ts
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||||
|
|
||||||
|
export class ProtocolTableTypes1728999487170 implements MigrationInterface {
|
||||||
|
name = "ProtocolTableTypes1728999487170";
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol",
|
||||||
|
"summary",
|
||||||
|
new TableColumn({
|
||||||
|
name: "summary",
|
||||||
|
type: "text",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_agenda",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "text",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_decision",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "text",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_voting",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "text",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol",
|
||||||
|
"summary",
|
||||||
|
new TableColumn({
|
||||||
|
name: "summary",
|
||||||
|
type: "varchar",
|
||||||
|
length: "255",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_agenda",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "varchar",
|
||||||
|
length: "255",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_decision",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "varchar",
|
||||||
|
length: "255",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.changeColumn(
|
||||||
|
"protocol_voting",
|
||||||
|
"context",
|
||||||
|
new TableColumn({
|
||||||
|
name: "context",
|
||||||
|
type: "varchar",
|
||||||
|
length: "255",
|
||||||
|
default: "''",
|
||||||
|
isNullable: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
import express, { Request, Response } from "express";
|
import express, { Request, Response } from "express";
|
||||||
import {
|
import {
|
||||||
createProtocol,
|
createProtocol,
|
||||||
|
createProtocolAgendaById,
|
||||||
|
createProtocolDecisonsById,
|
||||||
|
createProtocolVotingsById,
|
||||||
getAllProtocols,
|
getAllProtocols,
|
||||||
getProtocolAgendaById,
|
getProtocolAgendaById,
|
||||||
getProtocolById,
|
getProtocolById,
|
||||||
|
@ -44,24 +47,36 @@ router.post("/", async (req: Request, res: Response) => {
|
||||||
await createProtocol(req, res);
|
await createProtocol(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put("/:id/synchronize", async (req: Request, res: Response) => {
|
router.post("/:protocolId/agenda", async (req: Request, res: Response) => {
|
||||||
|
await createProtocolAgendaById(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/:protocolId/decision", async (req: Request, res: Response) => {
|
||||||
|
await createProtocolDecisonsById(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/:protocolId/voting", async (req: Request, res: Response) => {
|
||||||
|
await createProtocolVotingsById(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.patch("/:id/synchronize", async (req: Request, res: Response) => {
|
||||||
await synchronizeProtocolById(req, res);
|
await synchronizeProtocolById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put("/:protocolId/synchronize/agenda", async (req: Request, res: Response) => {
|
router.patch("/:protocolId/synchronize/agenda", async (req: Request, res: Response) => {
|
||||||
await synchronizeProtocolAgendaById(req, res);
|
await synchronizeProtocolAgendaById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put("/:protocolId/synchronize/decisions", async (req: Request, res: Response) => {
|
router.patch("/:protocolId/synchronize/decisions", async (req: Request, res: Response) => {
|
||||||
await synchronizeProtocolDecisonsById(req, res);
|
await synchronizeProtocolDecisonsById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.patch("/:protocolId/synchronize/votings", async (req: Request, res: Response) => {
|
||||||
|
await synchronizeProtocolVotingsById(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
router.put("/:protocolId/synchronize/presence", async (req: Request, res: Response) => {
|
router.put("/:protocolId/synchronize/presence", async (req: Request, res: Response) => {
|
||||||
await synchronizeProtocolPrecenseById(req, res);
|
await synchronizeProtocolPrecenseById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put("/:protocolId/synchronize/votings", async (req: Request, res: Response) => {
|
|
||||||
await synchronizeProtocolVotingsById(req, res);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -11,6 +11,7 @@ export default abstract class ProtocolPresenceService {
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.getRepository(protocolPresence)
|
.getRepository(protocolPresence)
|
||||||
.createQueryBuilder("protocolPresence")
|
.createQueryBuilder("protocolPresence")
|
||||||
|
.leftJoinAndSelect("protocolPresence.member", "member")
|
||||||
.where("protocolPresence.protocolId = :protocolId", { protocolId })
|
.where("protocolPresence.protocolId = :protocolId", { protocolId })
|
||||||
.getMany()
|
.getMany()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -29,6 +30,7 @@ export default abstract class ProtocolPresenceService {
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.getRepository(protocolPresence)
|
.getRepository(protocolPresence)
|
||||||
.createQueryBuilder("protocolPresence")
|
.createQueryBuilder("protocolPresence")
|
||||||
|
.leftJoinAndSelect("protocolPresence.member", "member")
|
||||||
.where("protocolPresence.id = :id", { id: id })
|
.where("protocolPresence.id = :id", { id: id })
|
||||||
.getOneOrFail()
|
.getOneOrFail()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
Loading…
Reference in a new issue