Merge branch 'dev' into staging
This commit is contained in:
commit
39e29319aa
@ -47,4 +47,40 @@ export default class DocumentsNotaryController extends ApiController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Get document by uid
|
||||||
|
* @returns IDocument document
|
||||||
|
*/
|
||||||
|
@Get("/api/v1/customer/documents_notary/:uid", [authHandler])
|
||||||
|
protected async getByUid(req: Request, response: Response) {
|
||||||
|
try {
|
||||||
|
const uid = req.params["uid"];
|
||||||
|
if (!uid) {
|
||||||
|
this.httpBadRequest(response, "uid is required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get query
|
||||||
|
let query;
|
||||||
|
if (req.query["q"]) {
|
||||||
|
query = JSON.parse(req.query["q"] as string);
|
||||||
|
}
|
||||||
|
|
||||||
|
const documentEntity = await this.documentsNotaryService.getByUid(uid, query);
|
||||||
|
|
||||||
|
if (!documentEntity) {
|
||||||
|
this.httpNotFoundRequest(response, "Document not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const document = DocumentNotary.hydrate<DocumentNotary>(documentEntity, { strategy: "excludeAll" });
|
||||||
|
|
||||||
|
//success
|
||||||
|
this.httpSuccess(response, document);
|
||||||
|
} catch (error) {
|
||||||
|
this.httpInternalError(response, error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user