Add option to get the full execution data from the server. (#1101)

This commit is contained in:
AxelRueweler 2020-10-26 21:19:44 +01:00 committed by GitHub
parent c38a2f4210
commit 7aeafc9f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,6 +41,7 @@ import {
IExecutionDeleteFilter,
IExecutionFlatted,
IExecutionFlattedDb,
IExecutionResponse,
IExecutionFlattedResponse,
IExecutionPushResponse,
IExecutionsListResponse,
@ -1472,16 +1473,23 @@ class App {
// Returns a specific execution
this.app.get(`/${this.restEndpoint}/executions/:id`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IExecutionFlattedResponse | undefined> => {
this.app.get(`/${this.restEndpoint}/executions/:id`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IExecutionResponse | IExecutionFlattedResponse | undefined> => {
const result = await Db.collections.Execution!.findOne(req.params.id);
if (result === undefined) {
return undefined;
}
// Convert to response format in which the id is a string
(result as IExecutionFlatted as IExecutionFlattedResponse).id = result.id.toString();
return result as IExecutionFlatted as IExecutionFlattedResponse;
if (req.query.unflattedResponse) {
const fullExecutionData = ResponseHelper.unflattenExecutionData(result);
return fullExecutionData as IExecutionResponse;
} else {
// Convert to response format in which the id is a string
(result as IExecutionFlatted as IExecutionFlattedResponse).id = result.id.toString();
return result as IExecutionFlatted as IExecutionFlattedResponse;
}
return undefined;
}));