mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Add draft routine defaults and run-time overrides
This commit is contained in:
parent
b4a58ba8a6
commit
5d021583be
18 changed files with 592 additions and 113 deletions
|
|
@ -34,7 +34,7 @@ export function routineRoutes(db: Db) {
|
|||
assertCompanyAccess(req, companyId);
|
||||
if (req.actor.type === "board") return;
|
||||
if (req.actor.type !== "agent" || !req.actor.agentId) throw unauthorized();
|
||||
if (assigneeAgentId && assigneeAgentId !== req.actor.agentId) {
|
||||
if (assigneeAgentId !== req.actor.agentId) {
|
||||
throw forbidden("Agents can only manage routines assigned to themselves");
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,11 @@ export function routineRoutes(db: Db) {
|
|||
if (statusWillActivate) {
|
||||
await assertBoardCanAssignTasks(req, routine.companyId);
|
||||
}
|
||||
if (req.actor.type === "agent" && req.body.assigneeAgentId && req.body.assigneeAgentId !== req.actor.agentId) {
|
||||
if (
|
||||
req.actor.type === "agent" &&
|
||||
req.body.assigneeAgentId !== undefined &&
|
||||
req.body.assigneeAgentId !== req.actor.agentId
|
||||
) {
|
||||
throw forbidden("Agents can only assign routines to themselves");
|
||||
}
|
||||
const updated = await svc.update(routine.id, req.body, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue