aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/tag.ts2
-rw-r--r--server/models/video/video.ts16
2 files changed, 9 insertions, 9 deletions
diff --git a/server/models/video/tag.ts b/server/models/video/tag.ts
index d0d8353d7..2992da56d 100644
--- a/server/models/video/tag.ts
+++ b/server/models/video/tag.ts
@@ -54,7 +54,7 @@ function associate (models) {
54findOrCreateTags = function (tags: string[], transaction: Sequelize.Transaction) { 54findOrCreateTags = function (tags: string[], transaction: Sequelize.Transaction) {
55 const tasks: Promise<TagInstance>[] = [] 55 const tasks: Promise<TagInstance>[] = []
56 tags.forEach(tag => { 56 tags.forEach(tag => {
57 const query: any = { 57 const query: Sequelize.FindOrInitializeOptions<TagAttributes> = {
58 where: { 58 where: {
59 name: tag 59 name: tag
60 }, 60 },
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 47d3cad1d..496385b35 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -696,23 +696,23 @@ loadAndPopulateAuthorAndPodAndTags = function (id: string) {
696} 696}
697 697
698searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, start: number, count: number, sort: string) { 698searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, start: number, count: number, sort: string) {
699 const podInclude: any = { 699 const podInclude: Sequelize.IncludeOptions = {
700 model: Video['sequelize'].models.Pod, 700 model: Video['sequelize'].models.Pod,
701 required: false 701 required: false
702 } 702 }
703 703
704 const authorInclude: any = { 704 const authorInclude: Sequelize.IncludeOptions = {
705 model: Video['sequelize'].models.Author, 705 model: Video['sequelize'].models.Author,
706 include: [ 706 include: [
707 podInclude 707 podInclude
708 ] 708 ]
709 } 709 }
710 710
711 const tagInclude: any = { 711 const tagInclude: Sequelize.IncludeOptions = {
712 model: Video['sequelize'].models.Tag 712 model: Video['sequelize'].models.Tag
713 } 713 }
714 714
715 const query: any = { 715 const query: Sequelize.FindOptions = {
716 distinct: true, 716 distinct: true,
717 where: createBaseVideosWhere(), 717 where: createBaseVideosWhere(),
718 offset: start, 718 offset: start,
@@ -723,10 +723,10 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s
723 // Make an exact search with the magnet 723 // Make an exact search with the magnet
724 if (field === 'magnetUri') { 724 if (field === 'magnetUri') {
725 const infoHash = magnetUtil.decode(value).infoHash 725 const infoHash = magnetUtil.decode(value).infoHash
726 query.where.infoHash = infoHash 726 query.where['infoHash'] = infoHash
727 } else if (field === 'tags') { 727 } else if (field === 'tags') {
728 const escapedValue = Video['sequelize'].escape('%' + value + '%') 728 const escapedValue = Video['sequelize'].escape('%' + value + '%')
729 query.where.id.$in = Video['sequelize'].literal( 729 query.where['id'].$in = Video['sequelize'].literal(
730 `(SELECT "VideoTags"."videoId" 730 `(SELECT "VideoTags"."videoId"
731 FROM "Tags" 731 FROM "Tags"
732 INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId" 732 INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId"
@@ -830,14 +830,14 @@ function createThumbnail (video: VideoInstance, videoPath: string) {
830} 830}
831 831
832function generateImage (video: VideoInstance, videoPath: string, folder: string, imageName: string, size: string) { 832function generateImage (video: VideoInstance, videoPath: string, folder: string, imageName: string, size: string) {
833 const options: any = { 833 const options = {
834 filename: imageName, 834 filename: imageName,
835 count: 1, 835 count: 1,
836 folder 836 folder
837 } 837 }
838 838
839 if (size) { 839 if (size) {
840 options.size = size 840 options['size'] = size
841 } 841 }
842 842
843 return new Promise<string>((res, rej) => { 843 return new Promise<string>((res, rej) => {