mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
ref: Little refactoring
This commit is contained in:
parent
58eda7d555
commit
6f79fc45eb
8 changed files with 14 additions and 17 deletions
|
@ -3,7 +3,7 @@ const valuesValidator = (value) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isFinite(value.position)) {
|
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ module.exports = {
|
||||||
throw 'userMustBePresent';
|
throw 'userMustBePresent';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isNil(values.position)) {
|
if (!_.isUndefined(values.position)) {
|
||||||
const boardId = values.boardId || inputs.record.boardId;
|
const boardId = values.boardId || inputs.record.boardId;
|
||||||
const listId = values.listId || inputs.record.listId;
|
const listId = values.listId || inputs.record.listId;
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ const valuesValidator = (value) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.background && !_.isPlainObject(value.background)) {
|
if (!_.isNil(value.background) && !_.isPlainObject(value.background)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.backgroundImage && !_.isPlainObject(value.backgroundImage)) {
|
if (!_.isNil(value.backgroundImage) && !_.isPlainObject(value.backgroundImage)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const valuesValidator = (value) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.username && !_.isString(value.username)) {
|
if (!_.isNil(value.username) && !_.isString(value.username)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ const valuesValidator = (value) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.username && !_.isString(value.username)) {
|
if (!_.isNil(value.username) && !_.isString(value.username)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.avatar && !_.isPlainObject(value.avatar)) {
|
if (!_.isNil(value.avatar) && !_.isPlainObject(value.avatar)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,11 +63,9 @@ module.exports.down = async (knex) => {
|
||||||
.where('id', attachment.id);
|
.where('id', attachment.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
await knex.schema.table('attachment', (table) => {
|
return knex.schema.table('attachment', (table) => {
|
||||||
table.dropColumn('image');
|
table.dropColumn('image');
|
||||||
});
|
|
||||||
|
|
||||||
return knex.schema.alterTable('attachment', (table) => {
|
table.dropNullable('is_image');
|
||||||
table.boolean('is_image').notNullable().alter();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,8 @@ module.exports.up = async (knex) => {
|
||||||
table.dropColumn('type');
|
table.dropColumn('type');
|
||||||
});
|
});
|
||||||
|
|
||||||
return knex.schema.alterTable('card', (table) => {
|
return knex.schema.table('card', (table) => {
|
||||||
table.bigInteger('list_id').notNullable().alter();
|
table.dropNullable('list_id');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ module.exports.down = async (knex) => {
|
||||||
await knex.schema.table('board', (table) => {
|
await knex.schema.table('board', (table) => {
|
||||||
/* Columns */
|
/* Columns */
|
||||||
|
|
||||||
table.text('type').notNullable().defaultTo('kanban');
|
table.text('type').notNullable().defaultTo('kanban'); // FIXME: drop default
|
||||||
});
|
});
|
||||||
|
|
||||||
return knex.schema.alterTable('card', (table) => {
|
return knex.schema.table('card', (table) => {
|
||||||
table.bigInteger('list_id').alter();
|
table.setNullable('list_id');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -100,7 +100,6 @@ const processAttachmentImage = async (attachment, attachmentsPath) => {
|
||||||
|
|
||||||
module.exports.up = async (knex) => {
|
module.exports.up = async (knex) => {
|
||||||
const config = await getConfig();
|
const config = await getConfig();
|
||||||
|
|
||||||
const users = await knex('user_account').whereNotNull('avatar');
|
const users = await knex('user_account').whereNotNull('avatar');
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue