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

Code formatting with prettier, change eslint config for the server

This commit is contained in:
Maksim Eltyshev 2019-11-05 18:01:42 +05:00
parent bc87c1d883
commit 7a3805e64c
191 changed files with 4321 additions and 2880 deletions

View file

@ -1,13 +1,13 @@
const Errors = {
CARD_NOT_FOUND: {
notFound: 'Card is not found'
notFound: 'Card is not found',
},
USER_NOT_FOUND: {
notFound: 'User is not found'
notFound: 'User is not found',
},
CARD_MEMBERSHIP_EXIST: {
conflict: 'Card membership is already exist'
}
conflict: 'Card membership is already exist',
},
};
module.exports = {
@ -15,25 +15,25 @@ module.exports = {
cardId: {
type: 'string',
regex: /^[0-9]+$/,
required: true
required: true,
},
userId: {
type: 'string',
regex: /^[0-9]+$/,
required: true
}
required: true,
},
},
exits: {
notFound: {
responseType: 'notFound'
responseType: 'notFound',
},
conflict: {
responseType: 'conflict'
}
responseType: 'conflict',
},
},
fn: async function(inputs, exits) {
async fn(inputs, exits) {
const { currentUser } = this.req;
const { card, project } = await sails.helpers
@ -42,17 +42,14 @@ module.exports = {
let isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
currentUser.id
currentUser.id,
);
if (!isUserMemberForProject) {
throw Errors.CARD_NOT_FOUND; // Forbidden
}
isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
inputs.userId
);
isUserMemberForProject = await sails.helpers.isUserMemberForProject(project.id, inputs.userId);
if (!isUserMemberForProject) {
throw Errors.USER_NOT_FOUND;
@ -63,7 +60,7 @@ module.exports = {
.intercept('conflict', () => Errors.CARD_MEMBERSHIP_EXIST);
return exits.success({
item: cardMembership
item: cardMembership,
});
}
},
};

View file

@ -1,10 +1,10 @@
const Errors = {
CARD_NOT_FOUND: {
notFound: 'Card is not found'
notFound: 'Card is not found',
},
CARD_MEMBERSHIP_NOT_FOUND: {
notFound: 'Card membership is not found'
}
notFound: 'Card membership is not found',
},
};
module.exports = {
@ -12,22 +12,22 @@ module.exports = {
cardId: {
type: 'string',
regex: /^[0-9]+$/,
required: true
required: true,
},
userId: {
type: 'string',
regex: /^[0-9]+$/,
required: true
}
required: true,
},
},
exits: {
notFound: {
responseType: 'notFound'
}
responseType: 'notFound',
},
},
fn: async function(inputs, exits) {
async fn(inputs, exits) {
const { currentUser } = this.req;
const { board, project } = await sails.helpers
@ -36,7 +36,7 @@ module.exports = {
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
currentUser.id
currentUser.id,
);
if (!isUserMemberForProject) {
@ -45,25 +45,21 @@ module.exports = {
let cardMembership = await CardMembership.findOne({
cardId: inputs.cardId,
userId: inputs.userId
userId: inputs.userId,
});
if (!cardMembership) {
throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
}
cardMembership = await sails.helpers.deleteCardMembership(
cardMembership,
board,
this.req
);
cardMembership = await sails.helpers.deleteCardMembership(cardMembership, board, this.req);
if (!cardMembership) {
throw Errors.CARD_MEMBERSHIP_NOT_FOUND;
}
return exits.success({
item: cardMembership
item: cardMembership,
});
}
},
};