1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-24 15:49:46 +02:00

Prepare for collection board type, refactoring, update dependencies

This commit is contained in:
Maksim Eltyshev 2020-08-04 01:32:46 +05:00
parent 2d92ade8dc
commit c6ee7d54bb
190 changed files with 2144 additions and 1817 deletions

View file

@ -43,7 +43,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name']);
attachment = await sails.helpers.updateAttachment(attachment, values, board, this.req);
if (!attachment) {

View file

@ -11,6 +11,11 @@ module.exports = {
regex: /^[0-9]+$/,
required: true,
},
type: {
type: 'string',
isIn: Board.TYPES,
required: true,
},
position: {
type: 'number',
required: true,
@ -39,8 +44,7 @@ module.exports = {
throw Errors.PROJECT_NOT_FOUND;
}
const values = _.pick(inputs, ['position', 'name']);
const values = _.pick(inputs, ['type', 'position', 'name']);
const board = await sails.helpers.createBoard(project, values, this.req);
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed

View file

@ -40,10 +40,10 @@ module.exports = {
throw Errors.BOARD_NOT_FOUND; // Forbidden
}
const lists = await sails.helpers.getListsForBoard(board.id);
const labels = await sails.helpers.getLabelsForBoard(board.id);
const lists = await sails.helpers.getListsForBoard(board.id);
const cards = await sails.helpers.getCardsForBoard(board.id);
const cards = await sails.helpers.getCardsForBoard(board);
const cardIds = sails.helpers.mapRecords(cards);
const cardSubscriptions = await sails.helpers.getSubscriptionsByUserForCard(
@ -75,8 +75,8 @@ module.exports = {
return exits.success({
item: board,
included: {
lists,
labels,
lists,
cards,
cardMemberships,
cardLabels,

View file

@ -34,7 +34,6 @@ module.exports = {
}
const values = _.pick(inputs, ['position', 'name']);
board = await sails.helpers.updateBoard(board, values, this.req);
if (!board) {

View file

@ -1,21 +1,33 @@
const moment = require('moment');
const Errors = {
BOARD_NOT_FOUND: {
boardNotFound: 'Board not found',
},
LIST_NOT_FOUND: {
listNotFound: 'List not found',
},
LIST_MUST_BE_PRESENT: {
listMustBePresent: 'List must be present',
},
POSITION_MUST_BE_PRESENT: {
positionMustBePresent: 'Position must be present',
},
};
module.exports = {
inputs: {
listId: {
boardId: {
type: 'string',
regex: /^[0-9]+$/,
required: true,
},
listId: {
type: 'string',
regex: /^[0-9]+$/,
},
position: {
type: 'number',
required: true,
},
name: {
type: 'string',
@ -32,26 +44,49 @@ module.exports = {
},
timer: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) &&
_.size(value) === 2 &&
(_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
_.isFinite(value.total),
custom: (value) => {
if (!_.isPlainObject(value) || _.size(value) !== 2) {
return false;
}
if (
!_.isNull(value.startedAt) &&
_.isString(value.startedAt) &&
!moment(value.startedAt, moment.ISO_8601, true).isValid()
) {
return false;
}
if (!_.isFinite(value.total)) {
return false;
}
return true;
},
},
},
exits: {
boardNotFound: {
responseType: 'notFound',
},
listNotFound: {
responseType: 'notFound',
},
listMustBePresent: {
responseType: 'unprocessableEntity',
},
positionMustBePresent: {
responseType: 'unprocessableEntity',
},
},
async fn(inputs, exits) {
const { currentUser } = this.req;
const { list, project } = await sails.helpers
.getListToProjectPath(inputs.listId)
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
const { board, project } = await sails.helpers
.getBoardToProjectPath(inputs.boardId)
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
@ -62,9 +97,24 @@ module.exports = {
throw Errors.LIST_NOT_FOUND; // Forbidden
}
let list;
if (!_.isUndefined(inputs.listId)) {
list = await List.findOne({
id: inputs.listId,
boardId: board.id,
});
if (!list) {
throw Errors.LIST_NOT_FOUND;
}
}
const values = _.pick(inputs, ['position', 'name', 'description', 'dueDate', 'timer']);
const card = await sails.helpers.createCard(list, values, currentUser, this.req);
const card = await sails.helpers
.createCard(board, list, values, currentUser, this.req)
.intercept('listMustBePresent', () => Errors.LIST_MUST_BE_PRESENT)
.intercept('positionMustBeInValues', () => Errors.POSITION_MUST_BE_PRESENT);
return exits.success({
item: card,

View file

@ -0,0 +1,79 @@
const Errors = {
BOARD_NOT_FOUND: {
boardNotFound: 'Board not found',
},
};
module.exports = {
inputs: {
boardId: {
type: 'string',
regex: /^[0-9]+$/,
required: true,
},
beforeId: {
type: 'string',
regex: /^[0-9]+$/,
},
},
exits: {
boardNotFound: {
responseType: 'notFound',
},
},
async fn(inputs, exits) {
const { currentUser } = this.req;
const { board, project } = await sails.helpers
.getBoardToProjectPath(inputs.boardId)
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
currentUser.id,
);
if (!isUserMemberForProject) {
throw Errors.BOARD_NOT_FOUND; // Forbidden
}
const cards = await sails.helpers.getCardsForBoard(board, inputs.beforeId);
const cardIds = sails.helpers.mapRecords(cards);
const cardSubscriptions = await sails.helpers.getSubscriptionsByUserForCard(
cardIds,
currentUser.id,
);
const cardMemberships = await sails.helpers.getMembershipsForCard(cardIds);
const cardLabels = await sails.helpers.getCardLabelsForCard(cardIds);
const tasks = await sails.helpers.getTasksForCard(cardIds);
const attachments = await sails.helpers.getAttachmentsForCard(cardIds);
const isSubscribedByCardId = cardSubscriptions.reduce(
(result, cardSubscription) => ({
...result,
[cardSubscription.cardId]: true,
}),
{},
);
cards.map((card) => ({
...card,
isSubscribed: isSubscribedByCardId[card.id] || false,
}));
return exits.success({
items: cards,
included: {
cardMemberships,
cardLabels,
tasks,
attachments,
},
});
},
};

View file

@ -4,9 +4,18 @@ const Errors = {
CARD_NOT_FOUND: {
cardNotFound: 'Card not found',
},
BOARD_NOT_FOUND: {
boardNotFound: 'Board not found',
},
LIST_NOT_FOUND: {
listNotFound: 'List not found',
},
LIST_MUST_BE_PRESENT: {
listMustBePresent: 'List must be present',
},
POSITION_MUST_BE_PRESENT: {
positionMustBePresent: 'Position must be present',
},
};
module.exports = {
@ -16,11 +25,11 @@ module.exports = {
regex: /^[0-9]+$/,
required: true,
},
listId: {
boardId: {
type: 'string',
regex: /^[0-9]+$/,
},
boardId: {
listId: {
type: 'string',
regex: /^[0-9]+$/,
},
@ -48,11 +57,25 @@ module.exports = {
},
timer: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) &&
_.size(value) === 2 &&
(_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
_.isFinite(value.total),
custom: (value) => {
if (!_.isPlainObject(value) || _.size(value) !== 2) {
return false;
}
if (
!_.isNull(value.startedAt) &&
_.isString(value.startedAt) &&
!moment(value.startedAt, moment.ISO_8601, true).isValid()
) {
return false;
}
if (!_.isFinite(value.total)) {
return false;
}
return true;
},
},
isSubscribed: {
type: 'boolean',
@ -63,9 +86,18 @@ module.exports = {
cardNotFound: {
responseType: 'notFound',
},
boardNotFound: {
responseType: 'notFound',
},
listNotFound: {
responseType: 'notFound',
},
listMustBePresent: {
responseType: 'unprocessableEntity',
},
positionMustBePresent: {
responseType: 'unprocessableEntity',
},
},
async fn(inputs, exits) {
@ -87,22 +119,11 @@ module.exports = {
throw Errors.CARD_NOT_FOUND; // Forbidden
}
let toList;
let toBoard;
if (!_.isUndefined(inputs.listId) && inputs.listId !== list.id) {
toList = await List.findOne({
id: inputs.listId,
boardId: inputs.boardId || card.boardId,
});
if (!toList) {
throw Errors.LIST_NOT_FOUND;
}
if (!_.isUndefined(inputs.boardId)) {
({ board: toBoard, project } = await sails.helpers
.getListToProjectPath(toList.id)
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND));
.getBoardToProjectPath(inputs.boardId)
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND));
isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
@ -110,6 +131,18 @@ module.exports = {
);
if (!isUserMemberForProject) {
throw Errors.BOARD_NOT_FOUND; // Forbidden
}
}
let toList;
if (!_.isUndefined(inputs.listId)) {
toList = await List.findOne({
id: inputs.listId,
boardId: (toBoard || board).id,
});
if (!toList) {
throw Errors.LIST_NOT_FOUND; // Forbidden
}
}
@ -124,16 +157,10 @@ module.exports = {
'isSubscribed',
]);
card = await sails.helpers.updateCard(
card,
values,
toList,
toBoard,
list,
board,
currentUser,
this.req,
);
card = await sails.helpers
.updateCard(card, toBoard, toList, values, board, list, currentUser, this.req)
.intercept('toListMustBePresent', () => Errors.LIST_MUST_BE_PRESENT)
.intercept('positionMustBeInValues', () => Errors.POSITION_MUST_BE_PRESENT);
if (!card) {
throw Errors.CARD_NOT_FOUND;

View file

@ -46,7 +46,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name', 'color']);
const label = await sails.helpers.createLabel(board, values, this.req);
return exits.success({

View file

@ -49,7 +49,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name', 'color']);
label = await sails.helpers.updateLabel(label, values, this.req);
return exits.success({

View file

@ -44,7 +44,6 @@ module.exports = {
}
const values = _.pick(inputs, ['position', 'name']);
const list = await sails.helpers.createList(board, values, this.req);
return exits.success({

View file

@ -46,7 +46,6 @@ module.exports = {
}
const values = _.pick(inputs, ['position', 'name']);
list = await sails.helpers.updateList(list, values, this.req);
if (!list) {

View file

@ -12,8 +12,8 @@ module.exports = {
const values = _.pick(inputs, ['name']);
const { project, projectMembership } = await sails.helpers.createProject(
values,
currentUser,
values,
this.req,
true,
);

View file

@ -3,7 +3,6 @@ module.exports = {
const { currentUser } = this.req;
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(currentUser.id);
const projects = await sails.helpers.getProjects(projectIds);
const { userIds, projectMemberships } = await sails.helpers.getMembershipUserIdsForProject(
@ -12,7 +11,6 @@ module.exports = {
);
const users = await sails.helpers.getUsers(userIds);
const boards = await sails.helpers.getBoardsForProject(projectIds);
return exits.success({

View file

@ -65,7 +65,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name', 'background', 'backgroundImage']);
project = await sails.helpers.updateProject(project, values, this.req);
if (!project) {

View file

@ -43,7 +43,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name', 'isCompleted']);
const task = await sails.helpers.createTask(card, values, this.req);
return exits.success({

View file

@ -46,7 +46,6 @@ module.exports = {
}
const values = _.pick(inputs, ['name', 'isCompleted']);
task = await sails.helpers.updateTask(task, values, board, this.req);
if (!task) {

View file

@ -60,7 +60,6 @@ module.exports = {
}
const values = _.pick(inputs, ['password']);
user = await sails.helpers.updateUser(user, values, this.req);
if (!user) {

View file

@ -6,7 +6,7 @@ module.exports = {
},
userOrUserId: {
type: 'ref',
custom: (value) => _.isPlainObject(value) || _.isString(value),
custom: (value) => _.isObjectLike(value) || _.isString(value),
required: true,
},
request: {

View file

@ -1,12 +1,25 @@
module.exports = {
inputs: {
list: {
board: {
type: 'ref',
required: true,
},
list: {
type: 'ref',
},
values: {
type: 'json',
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
return false;
}
return true;
},
required: true,
},
user: {
@ -18,36 +31,61 @@ module.exports = {
},
},
exits: {
listMustBePresent: {},
listMustBelongToBoard: {},
positionMustBeInValues: {},
},
async fn(inputs, exits) {
const cards = await sails.helpers.getCardsForList(inputs.list.id);
const { values } = inputs;
const { position, repositions } = sails.helpers.insertToPositionables(
inputs.values.position,
cards,
);
values.boardId = inputs.board.id;
repositions.forEach(async ({ id, position: nextPosition }) => {
await Card.update({
id,
listId: inputs.list.id,
}).set({
position: nextPosition,
});
if (inputs.board.type === 'kanban') {
if (!inputs.list) {
throw 'listMustBePresent';
}
sails.sockets.broadcast(`board:${list.boardId}`, 'cardUpdate', {
item: {
if (inputs.list.boardId !== inputs.board.id) {
throw 'listMustBelongToBoard';
}
values.listId = inputs.list.id;
if (_.isUndefined(values.position)) {
throw 'positionMustBeInValues';
}
const cards = await sails.helpers.getCardsForList(inputs.list.id);
const { position, repositions } = sails.helpers.insertToPositionables(
inputs.values.position,
cards,
);
repositions.forEach(async ({ id, position: nextPosition }) => {
await Card.update({
id,
listId: inputs.list.id,
}).set({
position: nextPosition,
},
});
});
});
const card = await Card.create({
...inputs.values,
position,
listId: inputs.list.id,
boardId: inputs.list.boardId,
}).fetch();
sails.sockets.broadcast(`board:${inputs.board.id}`, 'cardUpdate', {
item: {
id,
position: nextPosition,
},
});
});
values.position = position;
} else if (inputs.board.type === 'collection') {
delete values.position;
}
const card = await Card.create(values).fetch();
if (inputs.user.subscribeToOwnCards) {
await CardSubscription.create({
@ -60,6 +98,7 @@ module.exports = {
card.isSubscribed = false;
}
// FIXME: broadcast subscription separately
sails.sockets.broadcast(
`board:${card.boardId}`,
'cardCreate',
@ -75,14 +114,12 @@ module.exports = {
inputs.request,
);
const values = {
await sails.helpers.createAction(card, inputs.user, {
type: 'createCard',
data: {
list: _.pick(inputs.list, ['id', 'name']),
},
};
await sails.helpers.createAction(card, inputs.user, values);
});
return exits.success(card);
},

View file

@ -47,7 +47,6 @@ module.exports = {
});
const users = await sails.helpers.getUsers(userIds);
const boards = await sails.helpers.getBoardsForProject(projectMembership.projectId);
sails.sockets.broadcast(`user:${projectMembership.userId}`, 'projectCreate', {

View file

@ -1,13 +1,13 @@
module.exports = {
inputs: {
values: {
type: 'json',
required: true,
},
user: {
type: 'ref',
required: true,
},
values: {
type: 'json',
required: true,
},
request: {
type: 'ref',
},

View file

@ -4,11 +4,25 @@ module.exports = {
inputs: {
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) &&
_.isString(value.email) &&
_.isString(value.password) &&
(!value.username || _.isString(value.username)),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isString(value.email)) {
return false;
}
if (!_.isString(value.password)) {
return false;
}
if (value.username && !_.isString(value.username)) {
return false;
}
return true;
},
required: true,
},
request: {

View file

@ -11,7 +11,6 @@ module.exports = {
async fn(inputs, exits) {
const boards = await sails.helpers.getBoardsForProject(inputs.record.projectId);
const boardIds = sails.helpers.mapRecords(boards);
const cards = await sails.helpers.getCardsForBoard(boardIds);

View file

@ -31,11 +31,8 @@ module.exports = {
if (user) {
const adminUserIds = await sails.helpers.getAdminUserIds();
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(user.id);
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(projectIds);
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
userIds.forEach((userId) => {

View file

@ -17,14 +17,26 @@ module.exports = {
throw 'pathNotFound';
}
const path = await sails.helpers
.getListToProjectPath(card.listId)
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
card,
...nodes,
},
}));
let path;
if (card.listId) {
path = await sails.helpers
.getListToProjectPath(card.listId)
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
card,
...nodes,
},
}));
} else {
path = await sails.helpers
.getBoardToProjectPath(card.boardId)
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
card,
...nodes,
},
}));
}
return exits.success({
card,

View file

@ -1,16 +1,42 @@
const LIMIT = 10;
module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
recordOrId: {
type: 'ref',
custom: (value) => _.isObjectLike(value) || _.isString(value) || _.every(value, _.isString),
required: true,
},
beforeId: {
type: 'string',
},
},
async fn(inputs, exits) {
const cards = await sails.helpers.getCards({
boardId: inputs.id,
});
const criteria = {};
let sort;
let limit;
if (_.isObjectLike(inputs.recordOrId)) {
criteria.boardId = inputs.recordOrId.id;
if (inputs.recordOrId.type === 'kanban') {
sort = 'position';
} else if (inputs.recordOrId.type === 'collection') {
if (inputs.beforeId) {
criteria.id = {
'<': inputs.beforeId,
};
}
limit = LIMIT;
}
} else {
criteria.boardId = inputs.recordOrId;
}
const cards = await sails.helpers.getCards(criteria, sort, limit);
return exits.success(cards);
},

View file

@ -4,10 +4,17 @@ module.exports = {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
},
sort: {
type: 'json',
defaultsTo: 'id DESC',
},
limit: {
type: 'number',
},
},
async fn(inputs, exits) {
const cards = await Card.find(inputs.criteria).sort('position');
const cards = await Card.find(inputs.criteria).sort(inputs.sort).limit(inputs.limit);
return exits.success(cards);
},

View file

@ -9,7 +9,6 @@ module.exports = {
async fn(inputs, exits) {
const cardLabels = await sails.helpers.getCardLabelsForCard(inputs.id);
const labelIds = sails.helpers.mapRecords(cardLabels, 'labelId', _.isArray(inputs.id));
return exits.success(labelIds);

View file

@ -9,7 +9,6 @@ module.exports = {
async fn(inputs, exits) {
const labelIds = await sails.helpers.getLabelIdsForCard(inputs.id);
const labels = await sails.helpers.getLabels(labelIds);
return exits.success(labels);

View file

@ -13,7 +13,6 @@ module.exports = {
async fn(inputs, exits) {
const projectMemberships = await sails.helpers.getMembershipsForProject(inputs.id);
const userIds = sails.helpers.mapRecords(projectMemberships, 'userId', _.isArray(inputs.id));
return exits.success(

View file

@ -6,8 +6,17 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
return false;
}
return true;
},
required: true,
},
request: {

View file

@ -4,24 +4,33 @@ module.exports = {
type: 'ref',
required: true,
},
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
required: true,
toBoard: {
type: 'ref',
},
toList: {
type: 'ref',
},
toBoard: {
values: {
type: 'json',
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
return false;
}
return true;
},
required: true,
},
board: {
type: 'ref',
},
list: {
type: 'ref',
},
board: {
type: 'ref',
},
user: {
type: 'ref',
},
@ -31,41 +40,72 @@ module.exports = {
},
exits: {
invalidParams: {},
boardMustBePresent: {},
listMustBePresent: {},
toListMustBelongToBoard: {},
toListMustBePresent: {},
positionMustBeInValues: {},
userMustBePresent: {},
},
async fn(inputs, exits) {
const { isSubscribed, ...values } = inputs.values;
if (inputs.toList) {
if (!inputs.list || !inputs.user) {
throw 'invalidParams';
if (inputs.toBoard || inputs.toList || !_.isUndefined(values.position)) {
if (!inputs.board) {
throw 'boardMustBePresent';
}
if (inputs.toList.id === inputs.list.id) {
delete inputs.toList; // eslint-disable-line no-param-reassign
} else {
values.listId = inputs.toList.id;
if (inputs.toBoard) {
if (inputs.toBoard.id === inputs.board.id) {
delete inputs.toBoard; // eslint-disable-line no-param-reassign
} else {
values.boardId = inputs.toBoard.id;
}
}
if (inputs.toBoard) {
if (!inputs.board) {
throw 'invalidParams';
}
const board = inputs.toBoard || inputs.board;
if (inputs.toBoard.id === inputs.board.id) {
delete inputs.toBoard; // eslint-disable-line no-param-reassign
} else {
values.boardId = inputs.toBoard.id;
}
if (inputs.toList) {
if (inputs.board.type === 'kanban' && !inputs.list) {
throw 'listMustBePresent';
}
if (inputs.toList.boardId !== board.id) {
throw 'toListMustBelongToBoard';
}
if (
board.type === 'collection' ||
(inputs.board.type === 'kanban' && inputs.toList.id === inputs.list.id)
) {
delete inputs.toList; // eslint-disable-line no-param-reassign
} else {
values.listId = inputs.toList.id;
}
}
if (inputs.toList) {
if (_.isUndefined(values.position)) {
throw 'positionMustBeInValues';
}
} else if (inputs.toBoard) {
if (inputs.toBoard.type === 'kanban') {
throw 'toListMustBePresent';
}
if (inputs.board.type === 'kanban') {
values.listId = null;
values.position = null;
}
}
}
if (!_.isUndefined(isSubscribed) && !inputs.user) {
throw 'invalidParams';
if ((!_.isUndefined(isSubscribed) || inputs.toBoard || inputs.toList) && !inputs.user) {
throw 'userMustBePresent';
}
if (!_.isUndefined(values.position)) {
if (!_.isNil(values.position)) {
const cards = await sails.helpers.getCardsForList(
values.listId || inputs.record.listId,
inputs.record.id,
@ -73,8 +113,6 @@ module.exports = {
const { position, repositions } = sails.helpers.insertToPositionables(values.position, cards);
values.position = position;
repositions.forEach(async ({ id, position: nextPosition }) => {
await Card.update({
id,
@ -83,19 +121,21 @@ module.exports = {
position: nextPosition,
});
sails.sockets.broadcast(`board:${inputs.record.boardId}`, 'cardUpdate', {
sails.sockets.broadcast(`board:${values.boardId || inputs.record.boardId}`, 'cardUpdate', {
item: {
id,
position: nextPosition,
},
});
});
values.position = position;
}
let card;
if (!_.isEmpty(values)) {
let prevLabels;
if (inputs.toList && inputs.toBoard) {
if (inputs.toBoard) {
if (inputs.toBoard.projectId !== inputs.board.projectId) {
const userIds = await sails.helpers.getMembershipUserIdsForProject(
inputs.toBoard.projectId,
@ -129,7 +169,7 @@ module.exports = {
return exits.success(card);
}
if (inputs.toList && inputs.toBoard) {
if (inputs.toBoard) {
sails.sockets.broadcast(
`board:${inputs.board.id}`,
'cardDelete',
@ -204,7 +244,7 @@ module.exports = {
);
}
if (inputs.toList) {
if (!inputs.toBoard && inputs.toList) {
// TODO: add transfer action
await sails.helpers.createAction(card, inputs.user, {
type: 'moveCard',

View file

@ -6,8 +6,17 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
return false;
}
return true;
},
required: true,
},
request: {

View file

@ -9,12 +9,25 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) &&
(_.isUndefined(value.background) ||
_.isNull(value.background) ||
_.isPlainObject(value.background)) &&
(_.isUndefined(value.backgroundImage) || _.isNull(value.backgroundImage)),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (
!_.isUndefined(value.background) &&
!_.isNull(value.background) &&
!_.isPlainObject(value.background)
) {
return false;
}
if (!_.isUndefined(value.backgroundImage) && !_.isNull(value.backgroundImage)) {
return false;
}
return true;
},
required: true,
},
request: {
@ -23,7 +36,7 @@ module.exports = {
},
exits: {
invalidParams: {},
backgroundImageDirnameMustBeNotNullInValues: {},
},
async fn(inputs, exits) {
@ -50,7 +63,7 @@ module.exports = {
let project;
if (inputs.values.background && inputs.values.background.type === 'image') {
if (_.isNull(inputs.values.backgroundImageDirname)) {
throw 'invalidParams';
throw 'backgroundImageDirnameMustBeNotNullInValues';
}
if (_.isUndefined(inputs.values.backgroundImageDirname)) {

View file

@ -10,12 +10,29 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) =>
_.isPlainObject(value) &&
(_.isUndefined(value.email) || _.isString(value.email)) &&
(_.isUndefined(value.password) || _.isString(value.password)) &&
(!value.username || _.isString(value.username)) &&
(_.isUndefined(value.avatarUrl) || _.isNull(value.avatarUrl)),
custom: (value) => {
if (!_.isPlainObject(value)) {
return false;
}
if (!_.isUndefined(value.email) && !_.isString(value.email)) {
return false;
}
if (!_.isUndefined(value.password) && !_.isString(value.password)) {
return false;
}
if (value.username && !_.isString(value.username)) {
return false;
}
if (!_.isUndefined(value.avatarUrl) && !_.isNull(value.avatarUrl)) {
return false;
}
return true;
},
required: true,
},
request: {
@ -88,11 +105,8 @@ module.exports = {
if (!isOnlyPasswordChange) {
const adminUserIds = await sails.helpers.getAdminUserIds();
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(user.id);
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(projectIds);
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
userIds.forEach((userId) => {

View file

@ -5,12 +5,21 @@
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const TYPES = ['kanban', 'collection'];
module.exports = {
TYPES,
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
type: {
type: 'string',
isIn: TYPES,
required: true,
},
position: {
type: 'number',
required: true,

View file

@ -13,7 +13,7 @@ module.exports = {
position: {
type: 'number',
required: true,
allowNull: true,
},
name: {
type: 'string',
@ -40,16 +40,15 @@ module.exports = {
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
listId: {
model: 'List',
required: true,
columnName: 'list_id',
},
boardId: {
model: 'Board',
required: true,
columnName: 'board_id',
},
listId: {
model: 'List',
columnName: 'list_id',
},
coverAttachmentId: {
model: 'Attachment',
columnName: 'cover_attachment_id',

View file

@ -35,15 +35,16 @@ module.exports.routes = {
'PATCH /api/boards/:id': 'boards/update',
'DELETE /api/boards/:id': 'boards/delete',
'POST /api/boards/:boardId/lists': 'lists/create',
'PATCH /api/lists/:id': 'lists/update',
'DELETE /api/lists/:id': 'lists/delete',
'POST /api/boards/:boardId/labels': 'labels/create',
'PATCH /api/labels/:id': 'labels/update',
'DELETE /api/labels/:id': 'labels/delete',
'POST /api/lists/:listId/cards': 'cards/create',
'POST /api/boards/:boardId/lists': 'lists/create',
'PATCH /api/lists/:id': 'lists/update',
'DELETE /api/lists/:id': 'lists/delete',
'GET /api/boards/:boardId/cards': 'cards/index',
'POST /api/boards/:boardId/cards': 'cards/create',
'GET /api/cards/:id': 'cards/show',
'PATCH /api/cards/:id': 'cards/update',
'DELETE /api/cards/:id': 'cards/delete',

View file

@ -6,6 +6,7 @@ module.exports.up = (knex) =>
table.bigInteger('project_id').notNullable();
table.text('type').notNullable();
table.specificType('position', 'double precision').notNullable();
table.text('name').notNullable();

View file

@ -4,11 +4,11 @@ module.exports.up = (knex) =>
table.bigInteger('id').primary().defaultTo(knex.raw('next_id()'));
table.bigInteger('list_id').notNullable();
table.bigInteger('board_id').notNullable();
table.bigInteger('list_id');
table.bigInteger('cover_attachment_id');
table.specificType('position', 'double precision').notNullable();
table.specificType('position', 'double precision');
table.text('name').notNullable();
table.text('description');
table.timestamp('dueDate', true);
@ -20,6 +20,7 @@ module.exports.up = (knex) =>
/* Indexes */
table.index('list_id');
table.index('board_id');
table.index('position');
});

264
server/package-lock.json generated
View file

@ -4,27 +4,27 @@
"lockfileVersion": 1,
"dependencies": {
"@babel/code-frame": {
"version": "7.10.1",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.1.tgz",
"integrity": "sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==",
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
"dev": true,
"requires": {
"@babel/highlight": "^7.10.1"
"@babel/highlight": "^7.10.4"
}
},
"@babel/helper-validator-identifier": {
"version": "7.10.1",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz",
"integrity": "sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw==",
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
"integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
"dev": true
},
"@babel/highlight": {
"version": "7.10.1",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.1.tgz",
"integrity": "sha512-8rMof+gVP8mxYZApLF/JgNDAkdKa+aJt3ZYxF8z6+j/hpeXL7iMsKCPHa2jNMHu/qqBwzQF4OHNoYi8dMA/rYg==",
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
"integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.10.1",
"@babel/helper-validator-identifier": "^7.10.4",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
}
@ -76,9 +76,9 @@
}
},
"acorn": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz",
"integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==",
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
"dev": true
},
"acorn-jsx": {
@ -93,9 +93,9 @@
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
},
"ajv": {
"version": "6.12.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
"integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
"version": "6.12.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
"integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@ -455,9 +455,9 @@
}
},
"binary-extensions": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
"integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
"dev": true
},
"binary-search-tree": {
@ -858,9 +858,9 @@
"dev": true
},
"chokidar": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz",
"integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz",
"integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==",
"dev": true,
"requires": {
"anymatch": "~3.1.1",
@ -971,9 +971,9 @@
}
},
"cli-width": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz",
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
"integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==",
"dev": true
},
"clone-response": {
@ -1039,9 +1039,9 @@
}
},
"colorette": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.1.0.tgz",
"integrity": "sha512-6S062WDQUXi6hOfkO/sBPVwE5ASXY4G2+b4atvhJfSsuUUhIaUKlkjLe9692Ipyt5/a+IPF5aVTu3V5gvXq5cg=="
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz",
"integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw=="
},
"colors": {
"version": "0.6.2",
@ -1443,9 +1443,9 @@
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
},
"dotenv-cli": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-3.1.0.tgz",
"integrity": "sha512-sT16Zg7m71IVP/MX2ZBm6JBu6fy8aEgN9kJPywaYhBZnmq7MSQbpvCEhuiGPI08X8G+CQ1Gj/oZZUH1lGvGmqA==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-3.2.0.tgz",
"integrity": "sha512-zg/dfXISo7ntL3JKC+oj7eXEMg8LbOsARWTeypfVsmYtazDYOptmKLqA9u3LTee9x/sIPiLqmI6wskRP+89ohQ==",
"requires": {
"cross-spawn": "^7.0.1",
"dotenv": "^8.1.0",
@ -1610,21 +1610,21 @@
}
},
"es-abstract": {
"version": "1.17.5",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz",
"integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==",
"version": "1.17.6",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
"integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.1.5",
"is-regex": "^1.0.5",
"is-callable": "^1.2.0",
"is-regex": "^1.1.0",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
"string.prototype.trimleft": "^2.1.1",
"string.prototype.trimright": "^2.1.1"
"string.prototype.trimend": "^1.0.1",
"string.prototype.trimstart": "^1.0.1"
}
},
"es-get-iterator": {
@ -1801,9 +1801,9 @@
}
},
"strip-json-comments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz",
"integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true
},
"which": {
@ -1818,14 +1818,14 @@
}
},
"eslint-config-airbnb-base": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.1.0.tgz",
"integrity": "sha512-+XCcfGyCnbzOnktDVhwsCAx+9DmrzEmuwxyHUJpw+kqBVT744OUBrB09khgFKlK1lshVww6qXGsYPZpavoNjJw==",
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.0.tgz",
"integrity": "sha512-Snswd5oC6nJaevs3nZoLSTvGJBvzTfnBqOIArkf3cbyTyq9UD79wOk8s+RiL6bhca0p/eRO6veczhf6A/7Jy8Q==",
"dev": true,
"requires": {
"confusing-browser-globals": "^1.0.9",
"object.assign": "^4.1.0",
"object.entries": "^1.1.1"
"object.entries": "^1.1.2"
}
},
"eslint-config-prettier": {
@ -1838,9 +1838,9 @@
}
},
"eslint-import-resolver-node": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz",
"integrity": "sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg==",
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz",
"integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==",
"dev": true,
"requires": {
"debug": "^2.6.9",
@ -1892,9 +1892,9 @@
}
},
"eslint-plugin-import": {
"version": "2.21.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.21.1.tgz",
"integrity": "sha512-qYOOsgUv63vHof7BqbzuD+Ud34bXHxFJxntuAC1ZappFZXYbRIek3aJ7jc9i2dHDGDyZ/0zlO0cpioES265Lsw==",
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz",
"integrity": "sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg==",
"dev": true,
"requires": {
"array-includes": "^3.1.1",
@ -1940,9 +1940,9 @@
}
},
"eslint-plugin-prettier": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz",
"integrity": "sha512-+HG5jmu/dN3ZV3T6eCD7a4BlAySdN7mLIbJYo0z1cFQuI+r2DiTJEFeF68ots93PsnrMxbzIZ2S/ieX+mkrBeQ==",
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz",
"integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==",
"dev": true,
"requires": {
"prettier-linter-helpers": "^1.0.0"
@ -1968,9 +1968,9 @@
}
},
"eslint-visitor-keys": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz",
"integrity": "sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true
},
"esm": {
@ -3092,21 +3092,21 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
},
"inquirer": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz",
"integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==",
"version": "7.3.3",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz",
"integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==",
"dev": true,
"requires": {
"ansi-escapes": "^4.2.1",
"chalk": "^3.0.0",
"chalk": "^4.1.0",
"cli-cursor": "^3.1.0",
"cli-width": "^2.0.0",
"cli-width": "^3.0.0",
"external-editor": "^3.0.3",
"figures": "^3.0.0",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"mute-stream": "0.0.8",
"run-async": "^2.4.0",
"rxjs": "^6.5.3",
"rxjs": "^6.6.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0",
"through": "^2.3.6"
@ -3129,9 +3129,9 @@
}
},
"chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
@ -3654,25 +3654,25 @@
}
},
"knex": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/knex/-/knex-0.21.1.tgz",
"integrity": "sha512-uWszXC2DPaLn/YznGT9wFTWUG9+kqbL4DMz+hCH789GLcLuYzq8werHPDKBJxtKvxrW/S1XIXgrTWdMypiVvsw==",
"version": "0.21.2",
"resolved": "https://registry.npmjs.org/knex/-/knex-0.21.2.tgz",
"integrity": "sha512-hNp9f3yXCHtMrhV2pVsuCNYmPlgXhyqviMQGLBd9zdF03ZqCO9MPng0oYhNMgIs+vDr55VC6tjEbF1OQ1La7Kg==",
"requires": {
"colorette": "1.1.0",
"colorette": "1.2.1",
"commander": "^5.1.0",
"debug": "4.1.1",
"esm": "^3.2.25",
"getopts": "2.2.5",
"inherits": "~2.0.4",
"interpret": "^2.0.0",
"interpret": "^2.2.0",
"liftoff": "3.1.0",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"mkdirp": "^1.0.4",
"pg-connection-string": "2.2.0",
"pg-connection-string": "2.3.0",
"tarn": "^3.0.0",
"tildify": "2.0.0",
"uuid": "^7.0.3",
"v8flags": "^3.1.3"
"v8flags": "^3.2.0"
},
"dependencies": {
"debug": {
@ -3750,9 +3750,9 @@
}
},
"localforage": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.7.4.tgz",
"integrity": "sha512-3EmVZatmNVeCo/t6Te7P06h2alGwbq8wXlSkcSXMvDE2/edPmsVqTPlzGnZaqwZZDBs6v+kxWpqjVsqsNJT8jA==",
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.9.0.tgz",
"integrity": "sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g==",
"requires": {
"lie": "3.1.1"
}
@ -3768,9 +3768,9 @@
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"lodash.includes": {
"version": "4.3.0",
@ -4130,9 +4130,9 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"moment": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.26.0.tgz",
"integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw=="
"version": "2.27.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz",
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ=="
},
"ms": {
"version": "2.1.2",
@ -4419,9 +4419,9 @@
}
},
"object-inspect": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw=="
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
"integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA=="
},
"object-is": {
"version": "1.1.2",
@ -4548,9 +4548,9 @@
}
},
"onetime": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",
"integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.1.tgz",
"integrity": "sha512-ZpZpjcJeugQfWsfyQlshVoowIIQ1qBGSVll4rfDq6JJVO//fesjoX808hXWfBjY+ROZgpKDI5TRSRBSoJiZ8eg==",
"dev": true,
"requires": {
"mimic-fn": "^2.1.0"
@ -4843,9 +4843,9 @@
}
},
"pg-connection-string": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.2.0.tgz",
"integrity": "sha512-xB/+wxcpFipUZOQcSzcgkjcNOosGhEoPSjz06jC89lv1dj7mc9bZv6wLVy8M2fVjP0a/xN0N988YDq1L0FhK3A=="
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.3.0.tgz",
"integrity": "sha512-ukMTJXLI7/hZIwTW7hGMZJ0Lj0S2XQBCJ4Shv4y1zgQ/vqVea+FLhzywvPj0ujSuofu+yA4MYHGZPTsgjBgJ+w=="
},
"pg-int8": {
"version": "1.0.1",
@ -4948,9 +4948,9 @@
}
},
"prebuild-install": {
"version": "5.3.4",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.4.tgz",
"integrity": "sha512-AkKN+pf4fSEihjapLEEj8n85YIw/tN6BQqkhzbDc0RvEZGdkpJBGMUYx66AAMcPG2KzmPQS7Cm16an4HVBRRMA==",
"version": "5.3.5",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.5.tgz",
"integrity": "sha512-YmMO7dph9CYKi5IR/BzjOJlRzpxGGVo1EsLSUZ0mt/Mq0HWZIHOKHHcHdT69yG54C9m6i45GpItwRHpk0Py7Uw==",
"requires": {
"detect-libc": "^1.0.3",
"expand-template": "^2.0.3",
@ -5238,9 +5238,9 @@
}
},
"redis-commands": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.5.0.tgz",
"integrity": "sha512-6KxamqpZ468MeQC3bkWmCB1fp56XL64D4Kf0zJSwDZbVLLm7KFkoIcHrgRvQ+sk8dnhySs7+yBg94yIkAK7aJg=="
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.6.0.tgz",
"integrity": "sha512-2jnZ0IkjZxvguITjFTrGiLyzQZcTvaw8DAaCXxZq/dsHXz7KfMQ3OUJy7Tz9vnRtZRVz6VRCPDvruvU8Ts44wQ=="
},
"redis-parser": {
"version": "2.6.0",
@ -5285,9 +5285,9 @@
"dev": true
},
"registry-auth-token": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz",
"integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==",
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz",
"integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==",
"dev": true,
"requires": {
"rc": "^1.2.8"
@ -5455,9 +5455,9 @@
"dev": true
},
"rxjs": {
"version": "6.5.5",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz",
"integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==",
"version": "6.6.2",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz",
"integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
@ -5913,15 +5913,15 @@
"integrity": "sha1-gaVSFB7BBLiOic44MQOtXGZWTQg="
},
"sharp": {
"version": "0.25.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.25.3.tgz",
"integrity": "sha512-qV3n30NaBEhAjBhFo+d8h5N4X3DHteFdwxXoWUiubk72G0VKT5fX50nlcawGYjPqfFV4Z2e/G9gDPeSGAdn/gg==",
"version": "0.25.4",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.25.4.tgz",
"integrity": "sha512-umSzJJ1oBwIOfwFFt/fJ7JgCva9FvrEU2cbbm7u/3hSDZhXvkME8WE5qpaJqLIe2Har5msF5UG4CzYlEg5o3BQ==",
"requires": {
"color": "^3.1.2",
"detect-libc": "^1.0.3",
"node-addon-api": "^3.0.0",
"npmlog": "^4.1.2",
"prebuild-install": "^5.3.3",
"prebuild-install": "^5.3.4",
"semver": "^7.3.2",
"simple-get": "^4.0.0",
"tar": "^6.0.2",
@ -6016,9 +6016,9 @@
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
},
"simple-concat": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz",
"integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="
},
"simple-get": {
"version": "4.0.0",
@ -6518,26 +6518,6 @@
"es-abstract": "^1.17.5"
}
},
"string.prototype.trimleft": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz",
"integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==",
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.5",
"string.prototype.trimstart": "^1.0.0"
}
},
"string.prototype.trimright": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz",
"integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==",
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.5",
"string.prototype.trimend": "^1.0.0"
}
},
"string.prototype.trimstart": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
@ -6673,9 +6653,9 @@
}
},
"tar-stream": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz",
"integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz",
"integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==",
"requires": {
"bl": "^4.0.1",
"end-of-stream": "^1.4.1",
@ -7133,9 +7113,9 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"uuid": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.1.0.tgz",
"integrity": "sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg=="
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ=="
},
"v8-compile-cache": {
"version": "2.1.1",
@ -7162,9 +7142,9 @@
}
},
"validator": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-13.0.0.tgz",
"integrity": "sha512-anYx5fURbgF04lQV18nEQWZ/3wHGnxiKdG4aL8J+jEDsm98n/sU/bey+tYk6tnGJzm7ioh5FoqrAiQ6m03IgaA=="
"version": "13.1.1",
"resolved": "https://registry.npmjs.org/validator/-/validator-13.1.1.tgz",
"integrity": "sha512-8GfPiwzzRoWTg7OV1zva1KvrSemuMkv07MA9TTl91hfhe+wKrsrgVN4H2QSFd/U/FhiU3iWPYVgvbsOGwhyFWw=="
},
"vary": {
"version": "1.1.2",

View file

@ -41,28 +41,28 @@
"dependencies": {
"bcrypt": "^5.0.0",
"dotenv": "^8.2.0",
"dotenv-cli": "^3.1.0",
"dotenv-cli": "^3.2.0",
"filenamify": "^4.1.0",
"jsonwebtoken": "^8.5.1",
"knex": "^0.21.1",
"lodash": "^4.17.15",
"moment": "^2.26.0",
"knex": "^0.21.2",
"lodash": "^4.17.19",
"moment": "^2.27.0",
"rimraf": "^3.0.2",
"sails": "^1.2.4",
"sails-hook-orm": "^3.0.1",
"sails-hook-sockets": "^2.0.0",
"sails-postgresql": "^1.0.2",
"sharp": "^0.25.3",
"sharp": "^0.25.4",
"stream-to-array": "^2.3.0",
"uuid": "^8.1.0",
"validator": "^13.0.0"
"uuid": "^8.3.0",
"validator": "^13.1.1"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.1",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"nodemon": "^2.0.4",
"prettier": "2.0.5"
},