1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

feat: Webhooks configuration, all events support, refactoring

This commit is contained in:
Maksim Eltyshev 2024-06-12 00:51:36 +02:00
parent 193daf6cfb
commit 87683fe523
96 changed files with 1280 additions and 509 deletions

View file

@ -103,7 +103,7 @@ module.exports = {
project,
},
import: boardImport,
user: currentUser,
actorUser: currentUser,
requestId: inputs.requestId,
request: this.req,
});

View file

@ -22,25 +22,27 @@ module.exports = {
async fn(inputs) {
const { currentUser } = this.req;
let { board } = await sails.helpers.boards
const path = await sails.helpers.boards
.getProjectPath(inputs.id)
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
let { board } = path;
const { project } = path;
if (!board) {
throw Errors.BOARD_NOT_FOUND;
}
const isProjectManager = await sails.helpers.users.isProjectManager(
currentUser.id,
board.projectId,
);
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
if (!isProjectManager) {
throw Errors.BOARD_NOT_FOUND; // Forbidden
}
board = await sails.helpers.boards.deleteOne.with({
project,
record: board,
actorUser: currentUser,
request: this.req,
});

View file

@ -29,18 +29,18 @@ module.exports = {
async fn(inputs) {
const { currentUser } = this.req;
let { board } = await sails.helpers.boards
const path = await sails.helpers.boards
.getProjectPath(inputs.id)
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
let { board } = path;
const { project } = path;
if (!board) {
throw Errors.BOARD_NOT_FOUND;
}
const isProjectManager = await sails.helpers.users.isProjectManager(
currentUser.id,
board.projectId,
);
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
if (!isProjectManager) {
throw Errors.BOARD_NOT_FOUND; // Forbidden
@ -50,7 +50,9 @@ module.exports = {
board = await sails.helpers.boards.updateOne.with({
values,
project,
record: board,
actorUser: currentUser,
request: this.req,
});