forked from Yara724/api
Merge pull request 'update the blame service' (#9) from s.hajizadeh/yara724api:main into main
Reviewed-on: Yara724/api#9
This commit is contained in:
@@ -269,8 +269,7 @@ export class RequestManagementService {
|
|||||||
const step = stepByNumber ?? stepByKey;
|
const step = stepByNumber ?? stepByKey;
|
||||||
if (!step) {
|
if (!step) {
|
||||||
throw new InternalServerErrorException(
|
throw new InternalServerErrorException(
|
||||||
`Workflow step not found (${stepNumber ? `stepNumber=${stepNumber}` : ""}${
|
`Workflow step not found (${stepNumber ? `stepNumber=${stepNumber}` : ""}${stepNumber && stepKey ? ", " : ""
|
||||||
stepNumber && stepKey ? ", " : ""
|
|
||||||
}${stepKey ? `stepKey=${stepKey}` : ""})`,
|
}${stepKey ? `stepKey=${stepKey}` : ""})`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -768,8 +767,7 @@ export class RequestManagementService {
|
|||||||
);
|
);
|
||||||
if (err?.response) {
|
if (err?.response) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
`[TEJARAT] block inquiry response for request=${req._id}: status=${
|
`[TEJARAT] block inquiry response for request=${req._id}: status=${err.response.status
|
||||||
err.response.status
|
|
||||||
}, data=${JSON.stringify(err.response.data)}`,
|
}, data=${JSON.stringify(err.response.data)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3777,6 +3775,25 @@ export class RequestManagementService {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getAllBlameRequestsV2(user: any): Promise<any> {
|
||||||
|
console.log(user)
|
||||||
|
try {
|
||||||
|
const requests = await this.blameRequestDbService.find({
|
||||||
|
parties: {
|
||||||
|
$elemMatch: {
|
||||||
|
'person.userId': new Types.ObjectId(user.sub)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { select: "requestNo type status blameStatus createdAt updatedAt" });
|
||||||
|
return requests;
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error("Error: ", err);
|
||||||
|
throw new InternalServerErrorException(
|
||||||
|
"Something Went Wrong",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V2: Get one blame request by id. Access allowed if current user is a party (by userId or phone)
|
* V2: Get one blame request by id. Access allowed if current user is a party (by userId or phone)
|
||||||
* or the initiating field expert. For expert-initiated LINK, party access by phone is sufficient.
|
* or the initiating field expert. For expert-initiated LINK, party access by phone is sufficient.
|
||||||
|
|||||||
@@ -65,6 +65,14 @@ export class RequestManagementV2Controller {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
@Roles(RoleEnum.USER, RoleEnum.FIELD_EXPERT)
|
||||||
|
async getAllBlameRequestsV2(
|
||||||
|
@CurrentUser() user: any,
|
||||||
|
) {
|
||||||
|
return this.requestManagementService.getAllBlameRequestsV2(user);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get one blame request by id. Allowed for the request owner (party) or the initiating field expert.
|
* Get one blame request by id. Allowed for the request owner (party) or the initiating field expert.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user