Merge branch 'add-request-data-messenger' into develop
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s
This commit is contained in:
commit
afca10983d
3 changed files with 53 additions and 0 deletions
|
|
@ -230,6 +230,35 @@ export class RequestDataController extends Controller {
|
|||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Post("updata-messenger")
|
||||
@Security("keycloak")
|
||||
async updateRequestData(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
boby: {
|
||||
defaultMessengerId: string;
|
||||
requestDataId: string[];
|
||||
},
|
||||
) {
|
||||
const record = await prisma.requestData.updateManyAndReturn({
|
||||
where: {
|
||||
id: { in: boby.requestDataId },
|
||||
quotation: {
|
||||
registeredBranch: {
|
||||
OR: permissionCond(req.user),
|
||||
},
|
||||
},
|
||||
},
|
||||
data: {
|
||||
defaultMessengerId: boby.defaultMessengerId,
|
||||
},
|
||||
});
|
||||
|
||||
if (record.length <= 0) throw notFoundError("Request Data");
|
||||
|
||||
return record[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Route("/api/v1/request-data/{requestDataId}")
|
||||
|
|
@ -887,6 +916,21 @@ export class RequestListController extends Controller {
|
|||
update: payload,
|
||||
});
|
||||
|
||||
if (record.responsibleUserId === null) {
|
||||
await prisma.requestWorkStepStatus.update({
|
||||
where: {
|
||||
step_requestWorkId: {
|
||||
step: step,
|
||||
requestWorkId,
|
||||
},
|
||||
responsibleUserId: null,
|
||||
},
|
||||
data: {
|
||||
responsibleUserId: record.requestWork?.request.defaultMessengerId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
switch (payload.workStatus) {
|
||||
case "Ready":
|
||||
if (record.requestWork.request.requestDataStatus === "Pending") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue