]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video.ts
Convert scripts to typescript
[github/Chocobozzz/PeerTube.git] / server / models / video.ts
index 3f808b811f9d4b63b571d97fa5b62c59ddb98776..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,
@@ -447,7 +447,7 @@ isOwned = function () {
   return this.remoteId === null
 }
 
-toFormatedJSON = function () {
+toFormatedJSON = function (this: VideoInstance) {
   let podHost
 
   if (this.Author.Pod) {
@@ -488,7 +488,7 @@ toFormatedJSON = function () {
     views: this.views,
     likes: this.likes,
     dislikes: this.dislikes,
-    tags: map(this.Tags, 'name'),
+    tags: map<VideoTagInstance, string>(this.Tags, 'name'),
     thumbnailPath: join(STATIC_PATHS.THUMBNAILS, this.getThumbnailName()),
     createdAt: this.createdAt,
     updatedAt: this.updatedAt