WIP Metadata class.

This commit is contained in:
Ahmed Bouhuolia
2019-09-08 02:41:46 +02:00
parent 70809cb05c
commit 9a8de9ca7d
29 changed files with 1707 additions and 98 deletions

View File

@@ -12,18 +12,34 @@ factory.define('user', 'users', async () => {
first_name: faker.name.firstName(),
last_name: faker.name.lastName(),
email: faker.internet.email(),
phone_number: faker.phone.phoneNumber(),
phone_number: faker.phone.phoneNumberFormat().replace('-', ''),
active: 1,
password: hashedPassword,
};
});
factory.define('account', 'accounts', async () => ({
name: faker.lorem.word(),
type: faker.lorem.word(),
description: faker.lorem.paragraph(),
factory.define('password_reset', 'password_resets', async () => {
const user = await faker.create('user');
return {
user_id: user.id,
token: faker.lorem.slug,
};
});
factory.define('account_type', 'account_types', async () => ({
name: faker.lorem.words(2),
}));
factory.define('account', 'accounts', async () => {
const accountType = await factory.create('account_type');
return {
name: faker.lorem.word(),
account_type_id: accountType.id,
description: faker.lorem.paragraph(),
};
});
factory.define('item_category', 'items_categories', () => ({
label: faker.name.firstName(),
description: faker.lorem.text(),
@@ -55,4 +71,16 @@ factory.define('item', 'items', async () => {
};
});
factory.define('setting', 'settings', async () => {
const user = await factory.create('user');
return {
key: faker.lorem.slug(),
user_id: user.id,
type: 'string',
value: faker.lorem.words(),
group: 'default',
};
});
export default factory;

View File

@@ -0,0 +1,9 @@
exports.up = (knex) => knex.schema.createTable('password_resets', (table) => {
table.increments();
table.string('user_id');
table.string('token');
table.timestamp('created_at');
});
exports.down = (knex) => knex.schema.dropTableIfExists('password_resets');

View File

@@ -1,6 +1,6 @@
exports.up = function(knex) {
return knex.schema.createTable('oauth_clients', table => {
return knex.schema.createTable('oauth_clients', (table) => {
table.increments();
table.integer('client_id').unsigned();
table.string('client_secret');

View File

@@ -1,8 +1,10 @@
exports.up = function(knex) {
return knex.schema.createTable('settings', table => {
exports.up = function (knex) {
return knex.schema.createTable('settings', (table) => {
table.increments();
table.integer('user_id').unsigned().references('id').inTable('users');
table.string('group');
table.string('type');
table.string('key');
table.string('value');
});

View File

@@ -3,7 +3,7 @@ exports.up = function (knex) {
return knex.schema.createTable('accounts', (table) => {
table.increments();
table.string('name');
table.string('type');
table.integer('account_type_id');
table.integer('parent_account_id');
table.string('code', 10);
table.text('description');

View File

@@ -0,0 +1,9 @@
exports.up = function (knex) {
return knex.schema.createTable('account_types', (table) => {
table.increments();
table.string('name');
});
};
exports.down = (knex) => knex.schema.dropTableIfExists('account_types');