2020-08-16 14:32:22 +00:00
|
|
|
import {Model} from '../../orm/src/model/Model.ts'
|
|
|
|
import {Field} from '../../orm/src/model/Field.ts'
|
|
|
|
import {Type} from '../../orm/src/db/types.ts'
|
2020-08-16 14:46:17 +00:00
|
|
|
import UserModel from "./User.model.ts";
|
|
|
|
import {Relation} from "../../orm/src/model/relation/decorators.ts";
|
2020-08-16 14:32:22 +00:00
|
|
|
|
|
|
|
export default class LoginAttemptModel extends Model<LoginAttemptModel> {
|
|
|
|
protected static table = 'daton_login_attempts'
|
|
|
|
protected static key = 'daton_login_attempt_id'
|
|
|
|
|
|
|
|
protected static readonly CREATED_AT = 'attempt_date'
|
|
|
|
protected static readonly UPDATED_AT = null
|
|
|
|
|
|
|
|
@Field(Type.int)
|
|
|
|
protected daton_login_attempt_id?: number
|
|
|
|
|
|
|
|
@Field(Type.int)
|
|
|
|
protected user_id!: number
|
|
|
|
|
|
|
|
@Field(Type.timestamp)
|
|
|
|
protected attempt_date!: Date
|
2020-08-16 14:46:17 +00:00
|
|
|
|
|
|
|
@Relation()
|
|
|
|
public user() {
|
|
|
|
return this.belongs_to_one(UserModel, 'login_attempts')
|
|
|
|
}
|
2020-08-16 14:32:22 +00:00
|
|
|
}
|