mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 08:09:44 +02:00
Move from prettier-eslint to eslint-plugin-prettier, update dependencies
This commit is contained in:
parent
f0e7fb8fd1
commit
9c7c96a780
254 changed files with 5539 additions and 5170 deletions
|
@ -64,9 +64,10 @@ module.exports = {
|
|||
{},
|
||||
);
|
||||
|
||||
cards.forEach((card) => {
|
||||
card.isSubscribed = isSubscribedByCardId[card.id] || false;
|
||||
});
|
||||
cards.map(card => ({
|
||||
...card,
|
||||
isSubscribed: isSubscribedByCardId[card.id] || false,
|
||||
}));
|
||||
|
||||
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed
|
||||
|
||||
|
|
|
@ -28,14 +28,15 @@ module.exports = {
|
|||
},
|
||||
dueDate: {
|
||||
type: 'string',
|
||||
custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
|
||||
custom: value => moment(value, moment.ISO_8601, true).isValid(),
|
||||
},
|
||||
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 =>
|
||||
_.isPlainObject(value) &&
|
||||
_.size(value) === 2 &&
|
||||
(_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
|
||||
_.isFinite(value.total),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -34,15 +34,16 @@ module.exports = {
|
|||
},
|
||||
dueDate: {
|
||||
type: 'string',
|
||||
custom: (value) => moment(value, moment.ISO_8601, true).isValid(),
|
||||
custom: value => moment(value, moment.ISO_8601, true).isValid(),
|
||||
allowNull: true,
|
||||
},
|
||||
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 =>
|
||||
_.isPlainObject(value) &&
|
||||
_.size(value) === 2 &&
|
||||
(_.isNull(value.startedAt) || moment(value.startedAt, moment.ISO_8601, true).isValid()) &&
|
||||
_.isFinite(value.total),
|
||||
},
|
||||
isSubscribed: {
|
||||
type: 'boolean',
|
||||
|
|
|
@ -60,8 +60,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (
|
||||
inputs.id === currentUser.id
|
||||
&& !bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
inputs.id === currentUser.id &&
|
||||
!bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
) {
|
||||
throw Errors.CURRENT_PASSWORD_NOT_VALID;
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (
|
||||
inputs.id === currentUser.id
|
||||
&& !bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
inputs.id === currentUser.id &&
|
||||
!bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
) {
|
||||
throw Errors.CURRENT_PASSWORD_NOT_VALID;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
},
|
||||
avatar: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isNull(value),
|
||||
custom: value => _.isNull(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
throw Errors.USER_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
delete inputs.isAdmin;
|
||||
delete inputs.isAdmin; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
let user = await sails.helpers.getUser(inputs.id);
|
||||
|
|
|
@ -45,7 +45,7 @@ const createReceiver = () => {
|
|||
try {
|
||||
await pipeline(file, resize, transform);
|
||||
|
||||
file.fd = `${uuid()}.jpg`;
|
||||
file.fd = `${uuid()}.jpg`; // eslint-disable-line no-param-reassign
|
||||
|
||||
await pipeline(
|
||||
transform,
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
|
||||
const userIds = await sails.helpers.getSubscriptionUserIdsForCard(action.cardId, action.userId);
|
||||
|
||||
userIds.forEach(async (userId) => {
|
||||
userIds.forEach(async userId => {
|
||||
const notification = await Notification.create({
|
||||
userId,
|
||||
actionId: action.id,
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -32,7 +32,7 @@ module.exports = {
|
|||
position: nextPosition,
|
||||
});
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
|
||||
item: {
|
||||
id,
|
||||
|
@ -48,7 +48,7 @@ module.exports = {
|
|||
projectId: inputs.project.id,
|
||||
}).fetch();
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'boardCreate',
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
},
|
||||
userOrUserId: {
|
||||
type: 'ref',
|
||||
custom: (value) => _.isPlainObject(value) || _.isString(value),
|
||||
custom: value => _.isPlainObject(value) || _.isString(value),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = {
|
|||
true,
|
||||
);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
if (userId !== projectMembership.userId) {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
|
|
|
@ -42,9 +42,9 @@ module.exports = {
|
|||
return exits.success(
|
||||
inputs.withProjectMembership
|
||||
? {
|
||||
project,
|
||||
projectMembership,
|
||||
}
|
||||
project,
|
||||
projectMembership,
|
||||
}
|
||||
: project,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -4,8 +4,8 @@ module.exports = {
|
|||
inputs: {
|
||||
values: {
|
||||
type: 'json',
|
||||
// eslint-disable-next-line max-len
|
||||
custom: (value) => _.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
|
||||
custom: value =>
|
||||
_.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
|
||||
const userIds = await sails.helpers.getAdminUserIds();
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userCreate',
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(board.projectId);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'boardDelete',
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
projectMembership.projectId,
|
||||
);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'projectMembershipDelete',
|
||||
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
|
||||
sails.sockets.removeRoomMembersFromRooms(
|
||||
`user:${projectMembership.userId}`,
|
||||
boardIds.map((boardId) => `board:${boardId}`),
|
||||
boardIds.map(boardId => `board:${boardId}`),
|
||||
);
|
||||
|
||||
const project = await Project.findOne(projectMembership.projectId);
|
||||
|
|
|
@ -20,9 +20,9 @@ module.exports = {
|
|||
const userIds = sails.helpers.mapRecords(projectMemberships, 'userId');
|
||||
|
||||
const boards = await sails.helpers.getBoardsForProject(project.id);
|
||||
const boardRooms = boards.map((board) => `board:${board.id}`);
|
||||
const boardRooms = boards.map(board => `board:${board.id}`);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.removeRoomMembersFromRooms(`user:${userId}`, boardRooms);
|
||||
|
||||
sails.sockets.broadcast(
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
|
||||
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userDelete',
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getCardToProjectPath(action.cardId)
|
||||
.intercept('notFound', (nodes) => ({
|
||||
.intercept('notFound', nodes => ({
|
||||
notFound: {
|
||||
action,
|
||||
...nodes,
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
beforeId: {
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptBoardId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getListToProjectPath(card.listId)
|
||||
.intercept('notFound', (nodes) => ({
|
||||
.intercept('notFound', nodes => ({
|
||||
notFound: {
|
||||
card,
|
||||
...nodes,
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptCardId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getBoardToProjectPath(label.boardId)
|
||||
.intercept('notFound', (nodes) => ({
|
||||
.intercept('notFound', nodes => ({
|
||||
notFound: {
|
||||
label,
|
||||
...nodes,
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getBoardToProjectPath(list.boardId)
|
||||
.intercept('notFound', (nodes) => ({
|
||||
.intercept('notFound', nodes => ({
|
||||
notFound: {
|
||||
list,
|
||||
...nodes,
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptListId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
withProjectMemberships: {
|
||||
|
@ -19,9 +19,9 @@ module.exports = {
|
|||
return exits.success(
|
||||
inputs.withProjectMemberships
|
||||
? {
|
||||
userIds,
|
||||
projectMemberships,
|
||||
}
|
||||
userIds,
|
||||
projectMemberships,
|
||||
}
|
||||
: userIds,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptUserId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptUserId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
withCardSubscriptions: {
|
||||
type: 'boolean',
|
||||
|
@ -26,9 +26,9 @@ module.exports = {
|
|||
return exits.success(
|
||||
inputs.withCardSubscriptions
|
||||
? {
|
||||
userIds,
|
||||
cardSubscriptions,
|
||||
}
|
||||
userIds,
|
||||
cardSubscriptions,
|
||||
}
|
||||
: userIds,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
userId: {
|
||||
|
|
|
@ -2,12 +2,12 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
exceptUserId: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
const path = await sails.helpers
|
||||
.getCardToProjectPath(task.cardId)
|
||||
.intercept('notFound', (nodes) => ({
|
||||
.intercept('notFound', nodes => ({
|
||||
notFound: {
|
||||
task,
|
||||
...nodes,
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isArray(value),
|
||||
custom: value => _.isString(value) || _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isString(value) || _.isPlainObject(value),
|
||||
custom: value => _.isString(value) || _.isPlainObject(value),
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
||||
custom: value => _.isArray(value) || _.isPlainObject(value),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@ const GAP = 2 ** 14;
|
|||
const MIN_GAP = 0.125;
|
||||
const MAX_POSITION = 2 ** 50;
|
||||
|
||||
const findBeginnings = (positions) => {
|
||||
const findBeginnings = positions => {
|
||||
positions.unshift(0);
|
||||
|
||||
let prevPosition = positions.pop();
|
||||
const beginnings = [prevPosition];
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
_.forEachRight(positions, (position) => {
|
||||
_.forEachRight(positions, position => {
|
||||
if (prevPosition - MIN_GAP >= position) {
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ const findBeginnings = (positions) => {
|
|||
return beginnings;
|
||||
};
|
||||
|
||||
const getRepositionsMap = (positions) => {
|
||||
const getRepositionsMap = positions => {
|
||||
const repositionsMap = {};
|
||||
|
||||
if (positions.length <= 1) {
|
||||
|
@ -62,7 +62,7 @@ const getRepositionsMap = (positions) => {
|
|||
return repositionsMap;
|
||||
};
|
||||
|
||||
const getFullRepositionsMap = (positions) => {
|
||||
const getFullRepositionsMap = positions => {
|
||||
const repositionsMap = {};
|
||||
|
||||
_.forEach(positions, (position, index) => {
|
||||
|
@ -96,8 +96,9 @@ module.exports = {
|
|||
|
||||
const beginnings = findBeginnings([...lowers, inputs.position]);
|
||||
|
||||
const repositionsMap = getRepositionsMap([...beginnings, ...uppers])
|
||||
|| getFullRepositionsMap([...lowers, inputs.position, ...uppers]);
|
||||
const repositionsMap =
|
||||
getRepositionsMap([...beginnings, ...uppers]) ||
|
||||
getFullRepositionsMap([...lowers, inputs.position, ...uppers]);
|
||||
|
||||
const position = repositionsMap[inputs.position]
|
||||
? repositionsMap[inputs.position].pop()
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
inputs: {
|
||||
records: {
|
||||
type: 'ref',
|
||||
custom: (value) => _.isArray(value),
|
||||
custom: value => _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
attribute: {
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
// eslint-disable-next-line max-len
|
||||
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
custom: value =>
|
||||
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -29,7 +29,7 @@ module.exports = {
|
|||
boards,
|
||||
);
|
||||
|
||||
inputs.values.position = position;
|
||||
inputs.values.position = position; // eslint-disable-line no-param-reassign
|
||||
|
||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||
await Board.update({
|
||||
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
position: nextPosition,
|
||||
});
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
|
||||
item: {
|
||||
id,
|
||||
|
@ -53,7 +53,7 @@ module.exports = {
|
|||
const board = await Board.updateOne(inputs.record.id).set(inputs.values);
|
||||
|
||||
if (board) {
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'boardUpdate',
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
// eslint-disable-next-line max-len
|
||||
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
custom: value =>
|
||||
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
required: true,
|
||||
},
|
||||
toList: {
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
if (listId !== inputs.list.id) {
|
||||
values.listId = listId;
|
||||
} else {
|
||||
delete inputs.toList;
|
||||
delete inputs.toList; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
} else {
|
||||
listId = inputs.list.id;
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
// eslint-disable-next-line max-len
|
||||
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
custom: value =>
|
||||
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
lists,
|
||||
);
|
||||
|
||||
inputs.values.position = position;
|
||||
inputs.values.position = position; // eslint-disable-line no-param-reassign
|
||||
|
||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||
await List.update({
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
inputs: {
|
||||
ids: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isArray(value),
|
||||
custom: value => _.isArray(value),
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
|
@ -26,7 +26,7 @@ module.exports = {
|
|||
.set(inputs.values)
|
||||
.fetch();
|
||||
|
||||
notifications.forEach((notification) => {
|
||||
notifications.forEach(notification => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${notification.userId}`,
|
||||
'notificationUpdate',
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
if (project) {
|
||||
const userIds = await sails.helpers.getMembershipUserIdsForProject(project.id);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'projectUpdate',
|
||||
|
|
|
@ -10,9 +10,10 @@ module.exports = {
|
|||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
custom: (value) => _.isPlainObject(value)
|
||||
&& (_.isUndefined(value.email) || _.isString(value.email))
|
||||
&& (_.isUndefined(value.password) || _.isString(value.password)),
|
||||
custom: value =>
|
||||
_.isPlainObject(value) &&
|
||||
(_.isUndefined(value.email) || _.isString(value.email)) &&
|
||||
(_.isUndefined(value.password) || _.isString(value.password)),
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -26,12 +27,14 @@ module.exports = {
|
|||
|
||||
async fn(inputs, exits) {
|
||||
if (!_.isUndefined(inputs.values.email)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
inputs.values.email = inputs.values.email.toLowerCase();
|
||||
}
|
||||
|
||||
let isOnlyPasswordChange = false;
|
||||
|
||||
if (!_.isUndefined(inputs.values.password)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
inputs.values.password = bcrypt.hashSync(inputs.values.password, 10);
|
||||
|
||||
if (Object.keys(inputs.values).length === 1) {
|
||||
|
@ -70,7 +73,7 @@ module.exports = {
|
|||
|
||||
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
userIds.forEach(userId => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userUpdate',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
module.exports = function defineCurrentUserHook(sails) {
|
||||
const TOKEN_PATTERN = /^Bearer /;
|
||||
|
||||
const getUser = async (accessToken) => {
|
||||
const getUser = async accessToken => {
|
||||
let id;
|
||||
|
||||
try {
|
||||
|
|
|
@ -80,13 +80,13 @@ module.exports.models = {
|
|||
},
|
||||
|
||||
beforeCreate(valuesToSet, proceed) {
|
||||
valuesToSet.createdAt = new Date().toUTCString();
|
||||
valuesToSet.createdAt = new Date().toUTCString(); // eslint-disable-line no-param-reassign
|
||||
|
||||
proceed();
|
||||
},
|
||||
|
||||
beforeUpdate(valuesToSet, proceed) {
|
||||
valuesToSet.updatedAt = new Date().toUTCString();
|
||||
valuesToSet.updatedAt = new Date().toUTCString(); // eslint-disable-line no-param-reassign
|
||||
|
||||
proceed();
|
||||
},
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
module.exports.up = (knex) => knex.raw(`
|
||||
CREATE SEQUENCE next_id_seq;
|
||||
module.exports.up = knex =>
|
||||
knex.raw(`
|
||||
CREATE SEQUENCE next_id_seq;
|
||||
|
||||
CREATE FUNCTION next_id(OUT id BIGINT) AS $$
|
||||
DECLARE
|
||||
shard INT := 1;
|
||||
epoch BIGINT := 1567191600000;
|
||||
CREATE FUNCTION next_id(OUT id BIGINT) AS $$
|
||||
DECLARE
|
||||
shard INT := 1;
|
||||
epoch BIGINT := 1567191600000;
|
||||
|
||||
sequence BIGINT;
|
||||
milliseconds BIGINT;
|
||||
BEGIN
|
||||
SELECT nextval('next_id_seq') % 1024 INTO sequence;
|
||||
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO milliseconds;
|
||||
sequence BIGINT;
|
||||
milliseconds BIGINT;
|
||||
BEGIN
|
||||
SELECT nextval('next_id_seq') % 1024 INTO sequence;
|
||||
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO milliseconds;
|
||||
|
||||
id := (milliseconds - epoch) << 23;
|
||||
id := id | (shard << 10);
|
||||
id := id | (sequence);
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
`);
|
||||
id := (milliseconds - epoch) << 23;
|
||||
id := id | (shard << 10);
|
||||
id := id | (sequence);
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
`);
|
||||
|
||||
module.exports.down = (knex) => knex.raw(`
|
||||
DROP SEQUENCE next_id_seq;
|
||||
module.exports.down = knex =>
|
||||
knex.raw(`
|
||||
DROP SEQUENCE next_id_seq;
|
||||
|
||||
DROP FUNCTION next_id(OUT id BIGINT);
|
||||
`);
|
||||
DROP FUNCTION next_id(OUT id BIGINT);
|
||||
`);
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('archive', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('archive', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('from_model').notNullable();
|
||||
table.bigInteger('original_record_id').notNullable();
|
||||
table.json('original_record').notNullable();
|
||||
table.text('from_model').notNullable();
|
||||
table.bigInteger('original_record_id').notNullable();
|
||||
table.json('original_record').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.unique(['from_model', 'original_record_id']);
|
||||
});
|
||||
table.unique(['from_model', 'original_record_id']);
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('archive');
|
||||
module.exports.down = knex => knex.schema.dropTable('archive');
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
module.exports.up = (knex) => knex.schema
|
||||
.createTable('user', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema
|
||||
.createTable('user', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('email').notNullable();
|
||||
table.text('password').notNullable();
|
||||
table.boolean('is_admin').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.text('avatar');
|
||||
table.text('email').notNullable();
|
||||
table.text('password').notNullable();
|
||||
table.boolean('is_admin').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.text('avatar');
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('deleted_at', true);
|
||||
})
|
||||
.raw(
|
||||
'ALTER TABLE "user" ADD CONSTRAINT "user_email_unique" EXCLUDE ("email" WITH =) WHERE ("deleted_at" IS NULL)',
|
||||
);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('deleted_at', true);
|
||||
})
|
||||
.raw(
|
||||
'ALTER TABLE "user" ADD CONSTRAINT "user_email_unique" EXCLUDE ("email" WITH =) WHERE ("deleted_at" IS NULL)',
|
||||
);
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('user');
|
||||
module.exports.down = knex => knex.schema.dropTable('user');
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('project', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('project', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.text('name').notNullable();
|
||||
table.text('name').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
});
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('project');
|
||||
module.exports.down = knex => knex.schema.dropTable('project');
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('project_membership', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('project_membership', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('project_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('project_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.unique(['project_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
table.unique(['project_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('project_membership');
|
||||
module.exports.down = knex => knex.schema.dropTable('project_membership');
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('board', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('board', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('project_id').notNullable();
|
||||
table.bigInteger('project_id').notNullable();
|
||||
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('project_id');
|
||||
table.index('position');
|
||||
});
|
||||
table.index('project_id');
|
||||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('board');
|
||||
module.exports.down = knex => knex.schema.dropTable('board');
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('list', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('list', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('board_id').notNullable();
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('board_id');
|
||||
table.index('position');
|
||||
});
|
||||
table.index('board_id');
|
||||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('list');
|
||||
module.exports.down = knex => knex.schema.dropTable('list');
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('label', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('label', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('board_id').notNullable();
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
||||
table.text('name');
|
||||
table.text('color').notNullable();
|
||||
table.text('name');
|
||||
table.text('color').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('board_id');
|
||||
});
|
||||
table.index('board_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('label');
|
||||
module.exports.down = knex => knex.schema.dropTable('label');
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('card', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('list_id').notNullable();
|
||||
table.bigInteger('board_id').notNullable();
|
||||
table.bigInteger('list_id').notNullable();
|
||||
table.bigInteger('board_id').notNullable();
|
||||
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.text('description');
|
||||
table.timestamp('dueDate', true);
|
||||
table.jsonb('timer');
|
||||
table.specificType('position', 'double precision').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.text('description');
|
||||
table.timestamp('dueDate', true);
|
||||
table.jsonb('timer');
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('list_id');
|
||||
table.index('position');
|
||||
});
|
||||
table.index('list_id');
|
||||
table.index('position');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card');
|
||||
module.exports.down = knex => knex.schema.dropTable('card');
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('card_subscription', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_subscription', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
||||
table.boolean('is_permanent').notNullable();
|
||||
table.boolean('is_permanent').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.unique(['card_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
table.unique(['card_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_subscription');
|
||||
module.exports.down = knex => knex.schema.dropTable('card_subscription');
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('card_membership', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_membership', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.unique(['card_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
table.unique(['card_id', 'user_id']);
|
||||
table.index('user_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_membership');
|
||||
module.exports.down = knex => knex.schema.dropTable('card_membership');
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('card_label', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('card_label', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('label_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('label_id').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.unique(['card_id', 'label_id']);
|
||||
table.index('label_id');
|
||||
});
|
||||
table.unique(['card_id', 'label_id']);
|
||||
table.index('label_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('card_label');
|
||||
module.exports.down = knex => knex.schema.dropTable('card_label');
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('task', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('task', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
|
||||
table.text('name').notNullable();
|
||||
table.boolean('is_completed').notNullable();
|
||||
table.text('name').notNullable();
|
||||
table.boolean('is_completed').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('card_id');
|
||||
});
|
||||
table.index('card_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('task');
|
||||
module.exports.down = knex => knex.schema.dropTable('task');
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('action', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('action', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
|
||||
table.text('type').notNullable();
|
||||
table.jsonb('data').notNullable();
|
||||
table.text('type').notNullable();
|
||||
table.jsonb('data').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('card_id');
|
||||
});
|
||||
table.index('card_id');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('action');
|
||||
module.exports.down = knex => knex.schema.dropTable('action');
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
module.exports.up = (knex) => knex.schema.createTable('notification', (table) => {
|
||||
/* Columns */
|
||||
module.exports.up = knex =>
|
||||
knex.schema.createTable('notification', table => {
|
||||
/* Columns */
|
||||
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
table
|
||||
.bigInteger('id')
|
||||
.primary()
|
||||
.defaultTo(knex.raw('next_id()'));
|
||||
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('action_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
table.bigInteger('user_id').notNullable();
|
||||
table.bigInteger('action_id').notNullable();
|
||||
table.bigInteger('card_id').notNullable();
|
||||
|
||||
table.boolean('is_read').notNullable();
|
||||
table.boolean('is_read').notNullable();
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
||||
/* Indexes */
|
||||
/* Indexes */
|
||||
|
||||
table.index('user_id');
|
||||
table.index('action_id');
|
||||
table.index('card_id');
|
||||
table.index('is_read');
|
||||
});
|
||||
table.index('user_id');
|
||||
table.index('action_id');
|
||||
table.index('card_id');
|
||||
table.index('is_read');
|
||||
});
|
||||
|
||||
module.exports.down = (knex) => knex.schema.dropTable('notification');
|
||||
module.exports.down = knex => knex.schema.dropTable('notification');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const bcrypt = require('bcrypt');
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
exports.seed = (knex) => {
|
||||
exports.seed = knex => {
|
||||
const date = new Date().toUTCString();
|
||||
|
||||
return knex('user').insert({
|
||||
|
|
1124
server/package-lock.json
generated
1124
server/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -8,22 +8,34 @@
|
|||
"db:init": "cd db && node init.js",
|
||||
"db:migrate": "knex migrate:latest --cwd db",
|
||||
"db:seed": "knex seed:run --cwd db",
|
||||
"format": "prettier-eslint --write \"**/*.js\"",
|
||||
"lint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'",
|
||||
"start": "npm run db:init && NODE_ENV=production node app.js",
|
||||
"start:dev": "nodemon",
|
||||
"test": "npm run lint && npm run custom-tests && echo 'Done.'"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "airbnb-base",
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"no-throw-literal": "off",
|
||||
"no-undef": "off",
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globals": {
|
||||
"_": true,
|
||||
"sails": true
|
||||
},
|
||||
"rules": {
|
||||
"no-param-reassign": "off",
|
||||
"no-throw-literal": "off",
|
||||
"no-undef": "off"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -31,23 +43,24 @@
|
|||
"dotenv": "^8.2.0",
|
||||
"dotenv-cli": "^3.1.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"knex": "^0.20.7",
|
||||
"knex": "^0.20.8",
|
||||
"lodash": "^4.17.15",
|
||||
"moment": "^2.24.0",
|
||||
"sails": "^1.2.3",
|
||||
"sails-hook-orm": "^2.1.1",
|
||||
"sails-hook-sockets": "^2.0.0",
|
||||
"sails-postgresql": "^1.0.2",
|
||||
"sharp": "^0.23.4",
|
||||
"uuid": "^3.3.3"
|
||||
"sharp": "^0.24.0",
|
||||
"uuid": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.16.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-airbnb-base": "^14.0.0",
|
||||
"eslint-plugin-import": "^2.20.0",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"nodemon": "^2.0.2",
|
||||
"prettier-eslint": "^9.0.1",
|
||||
"prettier-eslint-cli": "^5.0.0"
|
||||
"prettier": "1.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.10"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue