Skip to content

Commit

Permalink
send response on update
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed Dec 9, 2023
1 parent 0d8bb22 commit 6c576ed
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/controllers/log-template/LogTemplateAdminController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ async function getByID(request: Request, response: Response, next: NextFunction)

_LogTemplateAdminValidator.validateGetByID(params);

const trainingLog = await TrainingLogTemplate.findOne({
const trainingLogTemplate = await TrainingLogTemplate.findOne({
where: {
id: params.id,
},
});

if (trainingLog == null) {
if (trainingLogTemplate == null) {
response.sendStatus(HttpStatusCode.NotFound);
return;
}

response.send(trainingLog);
response.send(trainingLogTemplate);
} catch (e) {
next(e);
}
Expand Down Expand Up @@ -80,7 +80,7 @@ async function create(request: Request, response: Response) {
content: data.content,
});

response.sendStatus(HttpStatusCode.Created).send({ id: logTemplate.id });
response.sendStatus(HttpStatusCode.Created).send(logTemplate);
}

/**
Expand Down Expand Up @@ -108,7 +108,13 @@ async function update(request: Request, response: Response, next: NextFunction)
}
);

response.sendStatus(HttpStatusCode.Ok);
const trainingLogTemplate = await TrainingLogTemplate.findOne({
where: {
id: params.id,
},
});

response.send(trainingLogTemplate);
} catch (e) {
next(e);
}
Expand Down

0 comments on commit 6c576ed

Please sign in to comment.