]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Better models define typing
authorChocobozzz <florian.bigard@gmail.com>
Sun, 11 Jun 2017 15:35:32 +0000 (17:35 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Sun, 11 Jun 2017 15:35:32 +0000 (17:35 +0200)
17 files changed:
server/models/application.ts
server/models/author.ts
server/models/job.ts
server/models/oauth-client.ts
server/models/oauth-token.ts
server/models/pod.ts
server/models/request-to-pod.ts
server/models/request-video-event.ts
server/models/request-video-qadu.ts
server/models/request.ts
server/models/tag.ts
server/models/user-video-rate.ts
server/models/user.ts
server/models/video-abuse.ts
server/models/video-blacklist.ts
server/models/video-tag.ts
server/models/video.ts

index 14b87777ac61c44d08236b070770d873d84824a9..55bb40d840de3178249ddbd0392354a9f9f0a14f 100644 (file)
@@ -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: {
index 3264d3a880fde51c9913754b75bd381822aa0d58..e0fb250f994a17eade22f179a5cbf452f2382fda 100644 (file)
@@ -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: {
index 1afae8f0866f9e6bebec9a2f1f46297d3f2d4b6e..d4380a575fbfc710502e4e1bfa62ab45cf43ecaf 100644 (file)
@@ -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: {
index 22fae284271924b627f728109ae4085d1f8161a8..a5438f45a7e62606d24b684f23debcde101c775e 100644 (file)
@@ -14,8 +14,8 @@ let countTotal: OAuthClientMethods.CountTotal
 let loadFirstClient: OAuthClientMethods.LoadFirstClient
 let getByIdAndSecret: OAuthClientMethods.GetByIdAndSecret
 
-export default function (sequelizeDataTypes) {
-  OAuthClient = sequelize.define('OAuthClient',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  OAuthClient = sequelize.define<OAuthClientInstance, OAuthClientAttributes>('OAuthClient',
     {
       clientId: {
         type: DataTypes.STRING,
index d70bd2bce87dee407e1c45806910ce6359a56edb..91cef11dd5393022e9a405e4bdee034dab227efc 100644 (file)
@@ -18,8 +18,8 @@ let getByTokenAndPopulateUser: OAuthTokenMethods.GetByTokenAndPopulateUser
 let getByRefreshTokenAndPopulateUser: OAuthTokenMethods.GetByRefreshTokenAndPopulateUser
 let removeByUserId: OAuthTokenMethods.RemoveByUserId
 
-export default function (sequelizeDataTypes) {
-  OAuthToken = sequelize.define('OAuthToken',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  OAuthToken = sequelize.define<OAuthTokenInstance, OAuthTokenAttributes>('OAuthToken',
     {
       accessToken: {
         type: DataTypes.STRING,
index 107744c43063eb5c25307acc29b66540368aa247..fef9d4da6a41baae68bc9c2ab408a9b3b3202146 100644 (file)
@@ -27,8 +27,8 @@ let loadByHost: PodMethods.LoadByHost
 let removeAll: PodMethods.RemoveAll
 let updatePodsScore: PodMethods.UpdatePodsScore
 
-export default function (sequelizeDataTypes) {
-  Pod = sequelize.define('Pod',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  Pod = sequelize.define<PodInstance, PodAttributes>('Pod',
     {
       host: {
         type: DataTypes.STRING,
index 3562069cc761b17fe8c80b523301a29b9dda48d6..d2f31463c3176da8b1ae11d84ef3ee300dfea429 100644 (file)
@@ -12,8 +12,8 @@ import {
 let RequestToPod: Sequelize.Model<RequestToPodInstance, RequestToPodAttributes>
 let removeByRequestIdsAndPod: RequestToPodMethods.RemoveByRequestIdsAndPod
 
-export default function (sequelizeDataTypes) {
-  RequestToPod = sequelize.define('RequestToPod', {}, {
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  RequestToPod = sequelize.define<RequestToPodInstance, RequestToPodAttributes>('RequestToPod', {}, {
     indexes: [
       {
         fields: [ 'requestId' ]
index e422649afc0b4072588b20efd98b4beffc91a80b..32438b581cb8ef3c6830a21430e1fc5bb60ea713 100644 (file)
@@ -24,8 +24,8 @@ let listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom
 let removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod
 let removeAll: RequestVideoEventMethods.RemoveAll
 
-export default function (sequelizeDataTypes) {
-  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)),
index 38627ad55f3fde4c2f9996390f856090f653b40d..27ce0ff29ced0a0f620140b6921ef13944f8ffc9 100644 (file)
@@ -29,8 +29,8 @@ let listWithLimitAndRandom: RequestVideoQaduMethods.ListWithLimitAndRandom
 let removeByRequestIdsAndPod: RequestVideoQaduMethods.RemoveByRequestIdsAndPod
 let removeAll: RequestVideoQaduMethods.RemoveAll
 
-export default function (sequelizeDataTypes) {
-  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)),
index 71f81ae66fd78044f6f1c00a9e8a0a2db5b4fc44..e6c367f287ade6902a79df91ba4a0f278fd51a14 100644 (file)
@@ -19,8 +19,8 @@ let listWithLimitAndRandom: RequestMethods.ListWithLimitAndRandom
 let removeWithEmptyTo: RequestMethods.RemoveWithEmptyTo
 let removeAll: RequestMethods.RemoveAll
 
-export default function (sequelizeDataTypes) {
-  Request = sequelize.define('Request',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  Request = sequelize.define<RequestInstance, RequestAttributes>('Request',
     {
       request: {
         type: DataTypes.JSON,
index c4402e83c2d19e2d5aa4e6581a8e274718b73e02..54a5f79e59717b9a14fd08a27327821794ae3db1 100644 (file)
@@ -13,8 +13,8 @@ import {
 let Tag: Sequelize.Model<TagInstance, TagAttributes>
 let findOrCreateTags: TagMethods.FindOrCreateTags
 
-export default function (sequelizeDataTypes) {
-  Tag = sequelize.define('Tag',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  Tag = sequelize.define<TagInstance, TagAttributes>('Tag',
     {
       name: {
         type: DataTypes.STRING,
index 6b71e841263db7a1ea66ecdd95314305b8042782..0326e17967b64edc6879014cbad113e8dafcf179 100644 (file)
@@ -19,8 +19,8 @@ import {
 let UserVideoRate: Sequelize.Model<UserVideoRateInstance, UserVideoRateAttributes>
 let load: UserVideoRateMethods.Load
 
-export default function (sequelizeDataTypes) {
-  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)),
index cd383a16acb90f58c8059a72ce298a660535dd2d..1a56a6dc346c907d60219740137a5f62667acac4 100644 (file)
@@ -32,8 +32,8 @@ let loadById: UserMethods.LoadById
 let loadByUsername: UserMethods.LoadByUsername
 let loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail
 
-export default function (sequelizeDataTypes) {
-  User = sequelize.define('User',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  User = sequelize.define<UserInstance, UserAttributes>('User',
     {
       password: {
         type: DataTypes.STRING,
index 92168439c54f5157fddac5d2f561712923c6cd18..5602ef968c292a3400843d87c7559bd7a06f0705 100644 (file)
@@ -15,8 +15,8 @@ import {
 let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>
 let listForApi: VideoAbuseMethods.ListForApi
 
-export default function (sequelizeDataTypes) {
-  VideoAbuse = sequelize.define('VideoAbuse',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  VideoAbuse = sequelize.define<VideoAbuseInstance, VideoAbuseAttributes>('VideoAbuse',
     {
       reporterUsername: {
         type: DataTypes.STRING,
index f3675608573f7ed974ce0288e901054b88fefe85..040ed03d77830ba319abf97517f0f255914c9400 100644 (file)
@@ -17,8 +17,8 @@ let listForApi: BlacklistedVideoMethods.ListForApi
 let loadById: BlacklistedVideoMethods.LoadById
 let loadByVideoId: BlacklistedVideoMethods.LoadByVideoId
 
-export default function (sequelizeDataTypes) {
-  BlacklistedVideo = sequelize.define('BlacklistedVideo',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  BlacklistedVideo = sequelize.define<BlacklistedVideoInstance, BlacklistedVideoAttributes>('BlacklistedVideo',
     {},
     {
       indexes: [
index 2ccaf820d361eeff5cea1c0843b2710438ecfd20..514eede252bf70bf6e450da88501eabeaede561d 100644 (file)
@@ -11,8 +11,8 @@ import {
 
 let VideoTag: Sequelize.Model<VideoTagInstance, VideoTagAttributes>
 
-export default function (sequelizeDataTypes) {
-  VideoTag = sequelize.define('VideoTag', {}, {
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  VideoTag = sequelize.define<VideoTagInstance, VideoTagAttributes>('VideoTag', {}, {
     indexes: [
       {
         fields: [ 'videoId' ]
index 2234664f465f1d0a318299cc5507e42a8313cb70..78119f51629a36373082806361c4ad7380157323 100644 (file)
@@ -68,8 +68,8 @@ let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
 let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
 let searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
 
-export default function (sequelizeDataTypes) {
-  Video = sequelize.define('Video',
+export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
+  Video = sequelize.define<VideoInstance, VideoAttributes>('Video',
     {
       id: {
         type: DataTypes.UUID,