28 lines
700 B
TypeScript
28 lines
700 B
TypeScript
|
import { Model, Type, Field, Relation } from '../../bundle/daton_orm.ts'
|
||
|
import LoginAttemptModel from './LoginAttempt.model.ts'
|
||
|
|
||
|
export default class User extends Model<User> {
|
||
|
protected static table = 'daton_users'
|
||
|
protected static key = 'user_id'
|
||
|
|
||
|
protected static readonly CREATED_AT = 'created_at'
|
||
|
protected static readonly UPDATED_AT = 'updated_at'
|
||
|
|
||
|
@Field(Type.int)
|
||
|
protected user_id?: number
|
||
|
|
||
|
@Field(Type.varchar)
|
||
|
protected first_name!: String
|
||
|
|
||
|
@Field(Type.varchar)
|
||
|
protected last_name!: String
|
||
|
|
||
|
@Field(Type.bool)
|
||
|
protected active!: Boolean
|
||
|
|
||
|
@Relation()
|
||
|
public login_attempts() {
|
||
|
return this.has_many(LoginAttemptModel)
|
||
|
}
|
||
|
}
|