blob: c43146156efad09d366c76df309695ac01ac8f0d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { isHostValid } from '../../helpers/custom-validators/servers'
import { throwIfNotValid } from '../utils'
@Table({
tableName: 'server',
indexes: [
{
fields: [ 'host' ],
unique: true
}
]
})
export class ServerModel extends Model<ServerModel> {
@AllowNull(false)
@Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host'))
@Column
host: string
@CreatedAt
createdAt: Date
@UpdatedAt
updatedAt: Date
}
|