mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 21:29:43 +02:00
39 lines
647 B
JavaScript
39 lines
647 B
JavaScript
|
module.exports = {
|
||
|
inputs: {
|
||
|
values: {
|
||
|
type: 'json',
|
||
|
required: true,
|
||
|
},
|
||
|
user: {
|
||
|
type: 'ref',
|
||
|
required: true,
|
||
|
},
|
||
|
request: {
|
||
|
type: 'ref',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
async fn(inputs) {
|
||
|
const project = await Project.create(inputs.values).fetch();
|
||
|
|
||
|
const projectManager = await ProjectManager.create({
|
||
|
projectId: project.id,
|
||
|
userId: inputs.user.id,
|
||
|
}).fetch();
|
||
|
|
||
|
sails.sockets.broadcast(
|
||
|
`user:${projectManager.userId}`,
|
||
|
'projectCreate',
|
||
|
{
|
||
|
item: project,
|
||
|
},
|
||
|
inputs.request,
|
||
|
);
|
||
|
|
||
|
return {
|
||
|
project,
|
||
|
projectManager,
|
||
|
};
|
||
|
},
|
||
|
};
|