daton_app/app/models/User.model.ts

28 lines
700 B
TypeScript
Raw Permalink Normal View History

2020-10-05 16:44:05 +00:00
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)
}
}