From 2295ce6c4e7ba805cc100ff961527bebc2cd89e5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Dec 2017 10:34:40 +0100 Subject: Add account avatar --- server/models/avatar/avatar-interface.ts | 16 ++++++++++++++++ server/models/avatar/avatar.ts | 24 ++++++++++++++++++++++++ server/models/avatar/index.ts | 1 + 3 files changed, 41 insertions(+) create mode 100644 server/models/avatar/avatar-interface.ts create mode 100644 server/models/avatar/avatar.ts create mode 100644 server/models/avatar/index.ts (limited to 'server/models/avatar') diff --git a/server/models/avatar/avatar-interface.ts b/server/models/avatar/avatar-interface.ts new file mode 100644 index 000000000..4af2b87b7 --- /dev/null +++ b/server/models/avatar/avatar-interface.ts @@ -0,0 +1,16 @@ +import * as Sequelize from 'sequelize' + +export namespace AvatarMethods {} + +export interface AvatarClass {} + +export interface AvatarAttributes { + filename: string +} + +export interface AvatarInstance extends AvatarClass, AvatarAttributes, Sequelize.Instance { + createdAt: Date + updatedAt: Date +} + +export interface AvatarModel extends AvatarClass, Sequelize.Model {} diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts new file mode 100644 index 000000000..3d329d888 --- /dev/null +++ b/server/models/avatar/avatar.ts @@ -0,0 +1,24 @@ +import * as Sequelize from 'sequelize' +import { addMethodsToModel } from '../utils' +import { AvatarAttributes, AvatarInstance, AvatarMethods } from './avatar-interface' + +let Avatar: Sequelize.Model + +export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { + Avatar = sequelize.define('Avatar', + { + filename: { + type: DataTypes.STRING, + allowNull: false + } + }, + {} + ) + + const classMethods = [] + addMethodsToModel(Avatar, classMethods) + + return Avatar +} + +// ------------------------------ Statics ------------------------------ diff --git a/server/models/avatar/index.ts b/server/models/avatar/index.ts new file mode 100644 index 000000000..877aed1ce --- /dev/null +++ b/server/models/avatar/index.ts @@ -0,0 +1 @@ +export * from './avatar-interface' -- cgit v1.2.3 From be44767854709dbf7da4ba37fe4f16ac4e297f08 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Dec 2017 11:17:08 +0100 Subject: Fix lint --- server/models/avatar/avatar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/models/avatar') diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts index 3d329d888..96308fd5f 100644 --- a/server/models/avatar/avatar.ts +++ b/server/models/avatar/avatar.ts @@ -1,6 +1,6 @@ import * as Sequelize from 'sequelize' import { addMethodsToModel } from '../utils' -import { AvatarAttributes, AvatarInstance, AvatarMethods } from './avatar-interface' +import { AvatarAttributes, AvatarInstance } from './avatar-interface' let Avatar: Sequelize.Model -- cgit v1.2.3