🎨 Rename helper function

This commit is contained in:
Iván Ovejero 2021-04-15 13:40:34 +02:00
parent baf28dd216
commit 2c8e70f25f
2 changed files with 4 additions and 4 deletions

View file

@ -514,7 +514,7 @@ class App {
where: { id: In(tagIds) },
});
result.tags = TagHelpers.stringifyId(found);
result.tags = TagHelpers.getTagsResponse(found);
}
// Convert to response format in which the id is a string
@ -566,7 +566,7 @@ class App {
const results = await Db.collections.Workflow!.find(findQuery);
results.forEach(workflow => {
if (workflow.tags) {
workflow.tags = TagHelpers.stringifyId(workflow.tags);
workflow.tags = TagHelpers.getTagsResponse(workflow.tags);
}
});
@ -682,7 +682,7 @@ class App {
where: { id: In(tagIds) },
});
responseData.tags = TagHelpers.stringifyId(found);
responseData.tags = TagHelpers.getTagsResponse(found);
}
// Convert to response format in which the id is a string

View file

@ -25,7 +25,7 @@ function isStringArray(tags: unknown[]): tags is string[] {
* Stringify the ID in every `ITagDb` in an array.
* Side effect: Remove `createdAt` and `updatedAt` for a slimmer response.
*/
export function stringifyId(tags: ITagDb[]) {
export function getTagsResponse(tags: ITagDb[]) {
return tags.map(({ id, name }) => ({ id: id.toString(), name }));
}