2025-05-10 02:09:06 +02:00
|
|
|
/*!
|
|
|
|
* Copyright (c) 2024 PLANKA Software GmbH
|
|
|
|
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
|
|
|
*/
|
2024-06-14 16:38:06 +02:00
|
|
|
|
2019-08-31 04:07:25 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
2025-05-10 02:09:06 +02:00
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
isIn: Object.values(Project.Types),
|
|
|
|
required: true,
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
name: {
|
|
|
|
type: 'string',
|
2025-05-10 02:09:06 +02:00
|
|
|
maxLength: 128,
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
|
|
|
},
|
2025-05-10 02:09:06 +02:00
|
|
|
description: {
|
|
|
|
type: 'string',
|
|
|
|
isNotEmptyString: true,
|
|
|
|
maxLength: 1024,
|
|
|
|
allowNull: true,
|
2024-06-14 16:38:06 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
async fn(inputs) {
|
2019-08-31 04:07:25 +05:00
|
|
|
const { currentUser } = this.req;
|
|
|
|
|
2025-05-10 02:09:06 +02:00
|
|
|
const values = _.pick(inputs, ['type', 'name', 'description']);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
const { project, projectManager } = await sails.helpers.projects.createOne.with({
|
2020-08-04 01:32:46 +05:00
|
|
|
values,
|
2024-06-12 00:51:36 +02:00
|
|
|
actorUser: currentUser,
|
2022-12-26 21:10:50 +01:00
|
|
|
request: this.req,
|
|
|
|
});
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
return {
|
2019-08-31 04:07:25 +05:00
|
|
|
item: project,
|
|
|
|
included: {
|
2021-06-24 01:05:22 +05:00
|
|
|
projectManagers: [projectManager],
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2021-06-24 01:05:22 +05:00
|
|
|
};
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|