feat: User invitation system.

This commit is contained in:
Ahmed Bouhuolia
2020-04-23 20:09:07 +02:00
parent 1e13aa16ac
commit 11e3d4c1a9
23 changed files with 970 additions and 50 deletions

View File

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

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('user_invites', (table) => {
table.increments();
table.string('email');
table.string('token').unique();
table.integer('tenant_id').unsigned();
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('user_invites');
};

View File

@@ -0,0 +1,10 @@
import SystemModel from '@/system/models/SystemModel';
export default class UserInvite extends SystemModel {
/**
* Table name.
*/
static get tableName() {
return 'user_invites';
}
}

View File

@@ -0,0 +1,10 @@
import SystemModel from '@/system/models/SystemModel';
export default class PasswordResets extends SystemModel {
/**
* Table name
*/
static get tableName() {
return 'password_resets';
}
}

View File

@@ -21,7 +21,7 @@ export default class SystemUser extends SystemModel {
relation: Model.BelongsToOneRelation,
modelClass: Tenant.default,
join: {
from: 'users.tenant_id',
from: 'users.tenantId',
to: 'tenants.id',
},
},