feat: introduce full name column to user model
This commit is contained in:
@@ -12,6 +12,7 @@ export async function createUser(
|
|||||||
const userParams = {
|
const userParams = {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
|
fullName: 'Initial admin',
|
||||||
role: 'admin',
|
role: 'admin',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
|
export async function up(knex: Knex): Promise<void> {
|
||||||
|
return knex.schema.table('users', async (table) => {
|
||||||
|
table.string('full_name');
|
||||||
|
|
||||||
|
await knex('users').update({ full_name: 'Initial admin' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(knex: Knex): Promise<void> {
|
||||||
|
return knex.schema.table('users', (table) => {
|
||||||
|
table.dropColumn('full_name');
|
||||||
|
});
|
||||||
|
}
|
@@ -427,7 +427,9 @@ input StepInput {
|
|||||||
|
|
||||||
type User {
|
type User {
|
||||||
id: String
|
id: String
|
||||||
|
fullName: String
|
||||||
email: String
|
email: String
|
||||||
|
role: String
|
||||||
createdAt: String
|
createdAt: String
|
||||||
updatedAt: String
|
updatedAt: String
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@ import crypto from 'crypto';
|
|||||||
|
|
||||||
class User extends Base {
|
class User extends Base {
|
||||||
id!: string;
|
id!: string;
|
||||||
|
fullName!: string;
|
||||||
email!: string;
|
email!: string;
|
||||||
password!: string;
|
password!: string;
|
||||||
role: string;
|
role: string;
|
||||||
@@ -23,10 +24,11 @@ class User extends Base {
|
|||||||
|
|
||||||
static jsonSchema = {
|
static jsonSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
required: ['email', 'password'],
|
required: ['fullName', 'email', 'password'],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
id: { type: 'string', format: 'uuid' },
|
id: { type: 'string', format: 'uuid' },
|
||||||
|
fullName: { type: 'string', minLength: 1 },
|
||||||
email: { type: 'string', format: 'email', minLength: 1, maxLength: 255 },
|
email: { type: 'string', format: 'email', minLength: 1, maxLength: 255 },
|
||||||
password: { type: 'string', minLength: 1, maxLength: 255 },
|
password: { type: 'string', minLength: 1, maxLength: 255 },
|
||||||
role: { type: 'string', enum: ['admin', 'user'] },
|
role: { type: 'string', enum: ['admin', 'user'] },
|
||||||
|
@@ -4,6 +4,7 @@ export const GET_CURRENT_USER = gql`
|
|||||||
query GetCurrentUser {
|
query GetCurrentUser {
|
||||||
getCurrentUser {
|
getCurrentUser {
|
||||||
id
|
id
|
||||||
|
fullName
|
||||||
email
|
email
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
Reference in New Issue
Block a user