1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 13:49:43 +02:00

Project managers, board members, auto-update after reconnection, refactoring

This commit is contained in:
Maksim Eltyshev 2021-06-24 01:05:22 +05:00
parent d6cb1f6683
commit b39119ace4
478 changed files with 21226 additions and 19495 deletions

View file

@ -23,15 +23,23 @@ module.exports = {
},
async fn(inputs, exits) {
const { currentUser } = this.req;
let project = await Project.findOne(inputs.id);
if (!project) {
throw Errors.PROJECT_NOT_FOUND;
}
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
if (!isProjectManager) {
throw Errors.PROJECT_NOT_FOUND; // Forbidden
}
this.req
.file('file')
.upload(sails.helpers.createProjectBackgroundImageReceiver(), async (error, files) => {
.upload(sails.helpers.utils.createProjectBackgroundImageReceiver(), async (error, files) => {
if (error) {
return exits.uploadError(error.message);
}
@ -40,7 +48,7 @@ module.exports = {
return exits.uploadError('No file was uploaded');
}
project = await sails.helpers.updateProject(
project = await sails.helpers.projects.updateOne(
project,
{
backgroundImageDirname: files[0].extra.dirname,