fix: 🐛 fix missing paths

pull/771/head
HannesOberreiter 2 years ago
parent 4ad14ed414
commit d9890181b7

@ -44,7 +44,7 @@ module.exports = {
async fn(inputs, exits) { async fn(inputs, exits) {
const { currentUser } = this.req; const { currentUser } = this.req;
const { card } = await sails.helpers.cards const { card, board } = await sails.helpers.cards
.getProjectPath(inputs.cardId) .getProjectPath(inputs.cardId)
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND); .intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
@ -88,6 +88,7 @@ module.exports = {
card, card,
creatorUser: currentUser, creatorUser: currentUser,
}, },
board,
requestId: inputs.requestId, requestId: inputs.requestId,
request: this.req, request: this.req,
}); });

@ -36,7 +36,7 @@ module.exports = {
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND); .intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
let { action } = path; let { action } = path;
const { board, project } = path; const { board, project, card } = path;
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id); const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
@ -61,6 +61,7 @@ module.exports = {
action = await sails.helpers.actions.deleteOne.with({ action = await sails.helpers.actions.deleteOne.with({
board, board,
card,
record: action, record: action,
request: this.req, request: this.req,
}); });

@ -40,7 +40,7 @@ module.exports = {
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND); .intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
let { action } = path; let { action } = path;
const { board, project } = path; const { board, project, card } = path;
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id); const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
@ -69,6 +69,7 @@ module.exports = {
action = await sails.helpers.actions.updateOne.with({ action = await sails.helpers.actions.updateOne.with({
values, values,
card,
board, board,
record: action, record: action,
request: this.req, request: this.req,

@ -28,7 +28,8 @@ module.exports = {
async fn(inputs) { async fn(inputs) {
const { currentUser } = this.req; const { currentUser } = this.req;
let { list } = await sails.helpers.lists // eslint-disable-next-line prefer-const
let { list, board } = await sails.helpers.lists
.getProjectPath(inputs.id) .getProjectPath(inputs.id)
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND); .intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
@ -47,6 +48,7 @@ module.exports = {
list = await sails.helpers.lists.deleteOne.with({ list = await sails.helpers.lists.deleteOne.with({
record: list, record: list,
board,
request: this.req, request: this.req,
}); });

@ -62,8 +62,8 @@ module.exports = {
values: { values: {
...values, ...values,
card, card,
board,
}, },
board,
request: this.req, request: this.req,
}); });

@ -4,6 +4,10 @@ module.exports = {
type: 'ref', type: 'ref',
required: true, required: true,
}, },
card: {
type: 'ref',
required: true,
},
board: { board: {
type: 'ref', type: 'ref',
required: true, required: true,
@ -31,6 +35,7 @@ module.exports = {
data: action, data: action,
projectId: inputs.board.projectId, projectId: inputs.board.projectId,
user: inputs.request.currentUser, user: inputs.request.currentUser,
card: inputs.card,
board: inputs.board, board: inputs.board,
}); });
} }

@ -8,6 +8,10 @@ module.exports = {
type: 'json', type: 'json',
required: true, required: true,
}, },
card: {
type: 'ref',
required: true,
},
board: { board: {
type: 'ref', type: 'ref',
required: true, required: true,
@ -37,6 +41,7 @@ module.exports = {
data: action, data: action,
projectId: inputs.board.projectId, projectId: inputs.board.projectId,
user: inputs.request.currentUser, user: inputs.request.currentUser,
card: inputs.card,
board: inputs.board, board: inputs.board,
}); });
} }

@ -21,6 +21,10 @@ module.exports = {
custom: valuesValidator, custom: valuesValidator,
required: true, required: true,
}, },
board: {
type: 'ref',
required: true,
},
requestId: { requestId: {
type: 'string', type: 'string',
isNotEmptyString: true, isNotEmptyString: true,
@ -31,7 +35,7 @@ module.exports = {
}, },
async fn(inputs) { async fn(inputs) {
const { values } = inputs; const { values, board } = inputs;
const attachment = await Attachment.create({ const attachment = await Attachment.create({
...values, ...values,
@ -55,16 +59,18 @@ module.exports = {
values: { values: {
coverAttachmentId: attachment.id, coverAttachmentId: attachment.id,
}, },
board,
request: inputs.request,
}); });
} }
await sails.helpers.utils.sendWebhook.with({ await sails.helpers.utils.sendWebhook.with({
event: 'ATTACHMENT_CREATE', event: 'ATTACHMENT_CREATE',
data: attachment, data: attachment,
projectId: values.card.board.projectId, projectId: board.projectId,
user: inputs.request.currentUser, user: inputs.request.currentUser,
card: values.card, card: values.card,
board: values.card.board, board,
}); });
return attachment; return attachment;

@ -4,6 +4,10 @@ module.exports = {
type: 'ref', type: 'ref',
required: true, required: true,
}, },
board: {
type: 'ref',
required: true,
},
request: { request: {
type: 'ref', type: 'ref',
}, },
@ -25,9 +29,9 @@ module.exports = {
await sails.helpers.utils.sendWebhook.with({ await sails.helpers.utils.sendWebhook.with({
event: 'LIST_DELETE', event: 'LIST_DELETE',
data: list, data: list,
projectId: list.board.projectId, projectId: inputs.board.projectId,
user: inputs.request.currentUser, user: inputs.request.currentUser,
board: list.board, board: inputs.board,
}); });
} }

Loading…
Cancel
Save