mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
Add phone and organization fields to user
This commit is contained in:
parent
c4acb3eb24
commit
f3e0cadca6
11 changed files with 102 additions and 13 deletions
|
@ -30,6 +30,16 @@ module.exports = {
|
|||
regex: /^[a-zA-Z0-9]+(_?[a-zA-Z0-9])*$/,
|
||||
allowNull: true,
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
organization: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
|
@ -42,7 +52,14 @@ module.exports = {
|
|||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
const values = _.pick(inputs, ['email', 'password', 'name', 'username']);
|
||||
const values = _.pick(inputs, [
|
||||
'email',
|
||||
'password',
|
||||
'name',
|
||||
'username',
|
||||
'phone',
|
||||
'organization',
|
||||
]);
|
||||
|
||||
const user = await sails.helpers
|
||||
.createUser(values, this.req)
|
||||
|
|
|
@ -22,6 +22,16 @@ module.exports = {
|
|||
type: 'json',
|
||||
custom: (value) => _.isNull(value),
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
organization: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
|
@ -47,7 +57,7 @@ module.exports = {
|
|||
throw Errors.USER_NOT_FOUND;
|
||||
}
|
||||
|
||||
const values = _.pick(inputs, ['isAdmin', 'name', 'avatar']);
|
||||
const values = _.pick(inputs, ['isAdmin', 'name', 'avatar', 'phone', 'organization']);
|
||||
|
||||
user = await sails.helpers.updateUser(user, values, this.req);
|
||||
|
||||
|
|
|
@ -42,6 +42,16 @@ module.exports = {
|
|||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
organization: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
},
|
||||
deletedAt: {
|
||||
type: 'ref',
|
||||
columnName: 'deleted_at',
|
||||
|
|
|
@ -11,6 +11,8 @@ module.exports.up = (knex) =>
|
|||
table.text('name').notNullable();
|
||||
table.text('username');
|
||||
table.text('avatar');
|
||||
table.text('phone');
|
||||
table.text('organization');
|
||||
|
||||
table.timestamp('created_at', true);
|
||||
table.timestamp('updated_at', true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue