Initial commit

This commit is contained in:
2023-08-21 00:15:16 +00:00
commit 6a880d814f
31 changed files with 1519 additions and 0 deletions

21
database/factory.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict'
/*
|--------------------------------------------------------------------------
| Factory
|--------------------------------------------------------------------------
|
| Factories are used to define blueprints for database tables or Lucid
| models. Later you can use these blueprints to seed your database
| with dummy data.
|
*/
/** @type {import('@adonisjs/lucid/src/Factory')} */
// const Factory = use('Factory')
// Factory.blueprint('App/Models/User', (faker) => {
// return {
// username: faker.username()
// }
// })

View File

@@ -0,0 +1,22 @@
'use strict'
/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
class UserSchema extends Schema {
up () {
this.create('users', (table) => {
table.increments()
table.string('username', 80).notNullable().unique()
table.string('email', 254).notNullable().unique()
table.string('password', 60).notNullable()
table.timestamps()
})
}
down () {
this.drop('users')
}
}
module.exports = UserSchema

View File

@@ -0,0 +1,23 @@
'use strict'
/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
class TokensSchema extends Schema {
up () {
this.create('tokens', (table) => {
table.increments()
table.integer('user_id').unsigned().references('id').inTable('users')
table.string('token', 255).notNullable().unique().index()
table.string('type', 80).notNullable()
table.boolean('is_revoked').defaultTo(false)
table.timestamps()
})
}
down () {
this.drop('tokens')
}
}
module.exports = TokensSchema