feat: add ready status to request data
This commit is contained in:
parent
55e23de0c0
commit
e6ec573997
2 changed files with 17 additions and 1 deletions
|
|
@ -1406,6 +1406,7 @@ model Payment {
|
||||||
|
|
||||||
enum RequestDataStatus {
|
enum RequestDataStatus {
|
||||||
Pending
|
Pending
|
||||||
|
Ready
|
||||||
InProgress
|
InProgress
|
||||||
Completed
|
Completed
|
||||||
Canceled
|
Canceled
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,11 @@ export class RequestListController extends Controller {
|
||||||
return await prisma.$transaction(async (tx) => {
|
return await prisma.$transaction(async (tx) => {
|
||||||
const record = await tx.requestWorkStepStatus.upsert({
|
const record = await tx.requestWorkStepStatus.upsert({
|
||||||
include: {
|
include: {
|
||||||
requestWork: true,
|
requestWork: {
|
||||||
|
include: {
|
||||||
|
request: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
step_requestWorkId: {
|
step_requestWorkId: {
|
||||||
|
|
@ -537,6 +541,17 @@ export class RequestListController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (payload.workStatus) {
|
switch (payload.workStatus) {
|
||||||
|
case "Ready":
|
||||||
|
if (record.requestWork.request.requestDataStatus === "Pending") {
|
||||||
|
await tx.requestData.updateMany({
|
||||||
|
where: {
|
||||||
|
id: record.requestWork.requestDataId,
|
||||||
|
requestDataStatus: "Pending",
|
||||||
|
},
|
||||||
|
data: { requestDataStatus: "Ready" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "InProgress":
|
case "InProgress":
|
||||||
case "Waiting":
|
case "Waiting":
|
||||||
case "Validate":
|
case "Validate":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue