diff options
Diffstat (limited to 'server/models/avatar/avatar.ts')
-rw-r--r-- | server/models/avatar/avatar.ts | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts index 96308fd5f..2e7a8ae2c 100644 --- a/server/models/avatar/avatar.ts +++ b/server/models/avatar/avatar.ts | |||
@@ -1,24 +1,17 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import { AllowNull, Column, CreatedAt, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { addMethodsToModel } from '../utils' | ||
3 | import { AvatarAttributes, AvatarInstance } from './avatar-interface' | ||
4 | 2 | ||
5 | let Avatar: Sequelize.Model<AvatarInstance, AvatarAttributes> | 3 | @Table({ |
4 | tableName: 'avatar' | ||
5 | }) | ||
6 | export class AvatarModel extends Model<AvatarModel> { | ||
6 | 7 | ||
7 | export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { | 8 | @AllowNull(false) |
8 | Avatar = sequelize.define<AvatarInstance, AvatarAttributes>('Avatar', | 9 | @Column |
9 | { | 10 | filename: string |
10 | filename: { | ||
11 | type: DataTypes.STRING, | ||
12 | allowNull: false | ||
13 | } | ||
14 | }, | ||
15 | {} | ||
16 | ) | ||
17 | 11 | ||
18 | const classMethods = [] | 12 | @CreatedAt |
19 | addMethodsToModel(Avatar, classMethods) | 13 | createdAt: Date |
20 | 14 | ||
21 | return Avatar | 15 | @UpdatedAt |
16 | updatedAt: Date | ||
22 | } | 17 | } |
23 | |||
24 | // ------------------------------ Statics ------------------------------ | ||