1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/controllers/projects/create.js
Maksim Eltyshev 2ee1166747 feat: Version 2
Closes #627, closes #1047
2025-05-10 02:09:06 +02:00

44 lines
915 B
JavaScript
Executable file

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
module.exports = {
inputs: {
type: {
type: 'string',
isIn: Object.values(Project.Types),
required: true,
},
name: {
type: 'string',
maxLength: 128,
required: true,
},
description: {
type: 'string',
isNotEmptyString: true,
maxLength: 1024,
allowNull: true,
},
},
async fn(inputs) {
const { currentUser } = this.req;
const values = _.pick(inputs, ['type', 'name', 'description']);
const { project, projectManager } = await sails.helpers.projects.createOne.with({
values,
actorUser: currentUser,
request: this.req,
});
return {
item: project,
included: {
projectManagers: [projectManager],
},
};
},
};