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