feat(api): add create template endpoint

This commit is contained in:
Ali BARIN
2025-04-25 11:35:37 +00:00
parent 56100ac197
commit fdded19c30
5 changed files with 176 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
import { renderObject } from '../../../../helpers/renderer.js';
import Template from '../../../../models/template.ee.js';
export default async (request, response) => {
const template = await Template.create(templateParams(request));
renderObject(response, template, {
serializer: 'PublicTemplate',
status: 201,
});
};
const templateParams = (request) => {
const { name, flowId } = request.body;
return {
name,
flowId,
};
};