Better models define typing
This commit is contained in:
parent
294f80f21e
commit
127944aacb
|
@ -13,7 +13,7 @@ let Application: Sequelize.Model<ApplicationInstance, ApplicationAttributes>
|
|||
let loadMigrationVersion: ApplicationMethods.LoadMigrationVersion
|
||||
let updateMigrationVersion: ApplicationMethods.UpdateMigrationVersion
|
||||
|
||||
export default function defineApplication (sequelize: Sequelize.Sequelize, DataTypes) {
|
||||
export default function defineApplication (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Application = sequelize.define<ApplicationInstance, ApplicationAttributes>('Application',
|
||||
{
|
||||
migrationVersion: {
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
let Author: Sequelize.Model<AuthorInstance, AuthorAttributes>
|
||||
let findOrCreateAuthor: AuthorMethods.FindOrCreateAuthor
|
||||
|
||||
export default function defineAuthor (sequelize: Sequelize.Sequelize, DataTypes) {
|
||||
export default function defineAuthor (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Author = sequelize.define<AuthorInstance, AuthorAttributes>('Author',
|
||||
{
|
||||
name: {
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
let Job: Sequelize.Model<JobInstance, JobAttributes>
|
||||
let listWithLimit: JobMethods.ListWithLimit
|
||||
|
||||
export default function defineJob (sequelize: Sequelize.Sequelize, DataTypes) {
|
||||
export default function defineJob (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Job = sequelize.define<JobInstance, JobAttributes>('Job',
|
||||
{
|
||||
state: {
|
||||
|
|
|
@ -14,8 +14,8 @@ let countTotal: OAuthClientMethods.CountTotal
|
|||
let loadFirstClient: OAuthClientMethods.LoadFirstClient
|
||||
let getByIdAndSecret: OAuthClientMethods.GetByIdAndSecret
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
OAuthClient = sequelize.define('OAuthClient',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
OAuthClient = sequelize.define<OAuthClientInstance, OAuthClientAttributes>('OAuthClient',
|
||||
{
|
||||
clientId: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -18,8 +18,8 @@ let getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
|
|||
let getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
|
||||
let removeByUserId: OAuthTokenMethods.RemoveByUserId
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
OAuthToken = sequelize.define('OAuthToken',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
OAuthToken = sequelize.define<OAuthTokenInstance, OAuthTokenAttributes>('OAuthToken',
|
||||
{
|
||||
accessToken: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -27,8 +27,8 @@ let loadByHost: PodMethods.LoadByHost
|
|||
let removeAll: PodMethods.RemoveAll
|
||||
let updatePodsScore: PodMethods.UpdatePodsScore
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
Pod = sequelize.define('Pod',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Pod = sequelize.define<PodInstance, PodAttributes>('Pod',
|
||||
{
|
||||
host: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -12,8 +12,8 @@ import {
|
|||
let RequestToPod: Sequelize.Model<RequestToPodInstance, RequestToPodAttributes>
|
||||
let removeByRequestIdsAndPod: RequestToPodMethods.RemoveByRequestIdsAndPod
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
RequestToPod = sequelize.define('RequestToPod', {}, {
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
RequestToPod = sequelize.define<RequestToPodInstance, RequestToPodAttributes>('RequestToPod', {}, {
|
||||
indexes: [
|
||||
{
|
||||
fields: [ 'requestId' ]
|
||||
|
|
|
@ -24,8 +24,8 @@ let listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom
|
|||
let removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod
|
||||
let removeAll: RequestVideoEventMethods.RemoveAll
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
RequestVideoEvent = sequelize.define('RequestVideoEvent',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
RequestVideoEvent = sequelize.define<RequestVideoEventInstance, RequestVideoEventAttributes>('RequestVideoEvent',
|
||||
{
|
||||
type: {
|
||||
type: DataTypes.ENUM(values(REQUEST_VIDEO_EVENT_TYPES)),
|
||||
|
|
|
@ -29,8 +29,8 @@ let listWithLimitAndRandom: RequestVideoQaduMethods.ListWithLimitAndRandom
|
|||
let removeByRequestIdsAndPod: RequestVideoQaduMethods.RemoveByRequestIdsAndPod
|
||||
let removeAll: RequestVideoQaduMethods.RemoveAll
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
RequestVideoQadu = sequelize.define('RequestVideoQadu',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
RequestVideoQadu = sequelize.define<RequestVideoQaduInstance, RequestVideoQaduAttributes>('RequestVideoQadu',
|
||||
{
|
||||
type: {
|
||||
type: DataTypes.ENUM(values(REQUEST_VIDEO_QADU_TYPES)),
|
||||
|
|
|
@ -19,8 +19,8 @@ let listWithLimitAndRandom: RequestMethods.ListWithLimitAndRandom
|
|||
let removeWithEmptyTo: RequestMethods.RemoveWithEmptyTo
|
||||
let removeAll: RequestMethods.RemoveAll
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
Request = sequelize.define('Request',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Request = sequelize.define<RequestInstance, RequestAttributes>('Request',
|
||||
{
|
||||
request: {
|
||||
type: DataTypes.JSON,
|
||||
|
|
|
@ -13,8 +13,8 @@ import {
|
|||
let Tag: Sequelize.Model<TagInstance, TagAttributes>
|
||||
let findOrCreateTags: TagMethods.FindOrCreateTags
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
Tag = sequelize.define('Tag',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Tag = sequelize.define<TagInstance, TagAttributes>('Tag',
|
||||
{
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -19,8 +19,8 @@ import {
|
|||
let UserVideoRate: Sequelize.Model<UserVideoRateInstance, UserVideoRateAttributes>
|
||||
let load: UserVideoRateMethods.Load
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
UserVideoRate = sequelize.define('UserVideoRate',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
UserVideoRate = sequelize.define<UserVideoRateInstance, UserVideoRateAttributes>('UserVideoRate',
|
||||
{
|
||||
type: {
|
||||
type: DataTypes.ENUM(values(VIDEO_RATE_TYPES)),
|
||||
|
|
|
@ -32,8 +32,8 @@ let loadById: UserMethods.LoadById
|
|||
let loadByUsername: UserMethods.LoadByUsername
|
||||
let loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
User = sequelize.define('User',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
User = sequelize.define<UserInstance, UserAttributes>('User',
|
||||
{
|
||||
password: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -15,8 +15,8 @@ import {
|
|||
let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>
|
||||
let listForApi: VideoAbuseMethods.ListForApi
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
VideoAbuse = sequelize.define('VideoAbuse',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
VideoAbuse = sequelize.define<VideoAbuseInstance, VideoAbuseAttributes>('VideoAbuse',
|
||||
{
|
||||
reporterUsername: {
|
||||
type: DataTypes.STRING,
|
||||
|
|
|
@ -17,8 +17,8 @@ let listForApi: BlacklistedVideoMethods.ListForApi
|
|||
let loadById: BlacklistedVideoMethods.LoadById
|
||||
let loadByVideoId: BlacklistedVideoMethods.LoadByVideoId
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
BlacklistedVideo = sequelize.define('BlacklistedVideo',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
BlacklistedVideo = sequelize.define<BlacklistedVideoInstance, BlacklistedVideoAttributes>('BlacklistedVideo',
|
||||
{},
|
||||
{
|
||||
indexes: [
|
||||
|
|
|
@ -11,8 +11,8 @@ import {
|
|||
|
||||
let VideoTag: Sequelize.Model<VideoTagInstance, VideoTagAttributes>
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
VideoTag = sequelize.define('VideoTag', {}, {
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
VideoTag = sequelize.define<VideoTagInstance, VideoTagAttributes>('VideoTag', {}, {
|
||||
indexes: [
|
||||
{
|
||||
fields: [ 'videoId' ]
|
||||
|
|
|
@ -68,8 +68,8 @@ let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
|
|||
let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
|
||||
let searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
|
||||
|
||||
export default function (sequelize, DataTypes) {
|
||||
Video = sequelize.define('Video',
|
||||
export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
|
||||
Video = sequelize.define<VideoInstance, VideoAttributes>('Video',
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
|
|
Loading…
Reference in New Issue