diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-27 14:32:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-27 15:12:22 +0200 |
commit | 41fb13c330de629df2d23379209e79c7af0f2e9a (patch) | |
tree | 73bc5a90566406b3910f142beae2a879c1e4265d /server/models | |
parent | 40e7ed0714f96c01e16de3ac971a4b28116294e1 (diff) | |
download | PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.gz PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.zst PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.zip |
esModuleInterop to true
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/application/application.ts | 2 | ||||
-rw-r--r-- | server/models/model-cache.ts | 3 | ||||
-rw-r--r-- | server/models/video/video-comment.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-file.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-streaming-playlist.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-view.ts | 12 | ||||
-rw-r--r-- | server/models/video/video.ts | 2 |
7 files changed, 12 insertions, 13 deletions
diff --git a/server/models/application/application.ts b/server/models/application/application.ts index 5531d134a..e3939383b 100644 --- a/server/models/application/application.ts +++ b/server/models/application/application.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as memoizee from 'memoizee' | 1 | import memoizee from 'memoizee' |
2 | import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' | 2 | import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' |
3 | import { AttributesOnly } from '@shared/core-utils' | 3 | import { AttributesOnly } from '@shared/core-utils' |
4 | import { AccountModel } from '../account/account' | 4 | import { AccountModel } from '../account/account' |
diff --git a/server/models/model-cache.ts b/server/models/model-cache.ts index eafb5c13c..3651267e7 100644 --- a/server/models/model-cache.ts +++ b/server/models/model-cache.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { Model } from 'sequelize-typescript' | 1 | import { Model } from 'sequelize-typescript' |
2 | import * as Bluebird from 'bluebird' | ||
3 | import { logger } from '@server/helpers/logger' | 2 | import { logger } from '@server/helpers/logger' |
4 | 3 | ||
5 | type ModelCacheType = | 4 | type ModelCacheType = |
@@ -52,7 +51,7 @@ class ModelCache { | |||
52 | 51 | ||
53 | if (cache.has(key)) { | 52 | if (cache.has(key)) { |
54 | logger.debug('Model cache hit for %s -> %s.', cacheType, key) | 53 | logger.debug('Model cache hit for %s -> %s.', cacheType, key) |
55 | return Bluebird.resolve<T>(cache.get(key)) | 54 | return Promise.resolve<T>(cache.get(key)) |
56 | } | 55 | } |
57 | 56 | ||
58 | return fun().then(m => { | 57 | return fun().then(m => { |
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index e933989ae..c89279c65 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -585,7 +585,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment | |||
585 | 585 | ||
586 | if (accountId) { | 586 | if (accountId) { |
587 | whereAnd.push({ | 587 | whereAnd.push({ |
588 | [Op.eq]: accountId | 588 | accountId |
589 | }) | 589 | }) |
590 | } | 590 | } |
591 | 591 | ||
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 627c95763..5e8d29d0a 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import * as memoizee from 'memoizee' | 2 | import memoizee from 'memoizee' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { FindOptions, Op, Transaction } from 'sequelize' | 4 | import { FindOptions, Op, Transaction } from 'sequelize' |
5 | import { | 5 | import { |
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts index 3e9fd97c7..18d96c750 100644 --- a/server/models/video/video-streaming-playlist.ts +++ b/server/models/video/video-streaming-playlist.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as memoizee from 'memoizee' | 1 | import memoizee from 'memoizee' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { Op } from 'sequelize' | 3 | import { Op } from 'sequelize' |
4 | import { | 4 | import { |
diff --git a/server/models/video/video-view.ts b/server/models/video/video-view.ts index dfc6296ce..b51f0f84d 100644 --- a/server/models/video/video-view.ts +++ b/server/models/video/video-view.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import { literal, Op } from 'sequelize' |
2 | import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table } from 'sequelize-typescript' |
3 | import { AttributesOnly } from '@shared/core-utils' | 3 | import { AttributesOnly } from '@shared/core-utils' |
4 | import { VideoModel } from './video' | 4 | import { VideoModel } from './video' |
5 | 5 | ||
@@ -20,11 +20,11 @@ export class VideoViewModel extends Model<Partial<AttributesOnly<VideoViewModel> | |||
20 | createdAt: Date | 20 | createdAt: Date |
21 | 21 | ||
22 | @AllowNull(false) | 22 | @AllowNull(false) |
23 | @Column(Sequelize.DATE) | 23 | @Column(DataType.DATE) |
24 | startDate: Date | 24 | startDate: Date |
25 | 25 | ||
26 | @AllowNull(false) | 26 | @AllowNull(false) |
27 | @Column(Sequelize.DATE) | 27 | @Column(DataType.DATE) |
28 | endDate: Date | 28 | endDate: Date |
29 | 29 | ||
30 | @AllowNull(false) | 30 | @AllowNull(false) |
@@ -47,10 +47,10 @@ export class VideoViewModel extends Model<Partial<AttributesOnly<VideoViewModel> | |||
47 | const query = { | 47 | const query = { |
48 | where: { | 48 | where: { |
49 | startDate: { | 49 | startDate: { |
50 | [Sequelize.Op.lt]: beforeDate | 50 | [Op.lt]: beforeDate |
51 | }, | 51 | }, |
52 | videoId: { | 52 | videoId: { |
53 | [Sequelize.Op.in]: Sequelize.literal('(SELECT "id" FROM "video" WHERE "remote" IS TRUE)') | 53 | [Op.in]: literal('(SELECT "id" FROM "video" WHERE "remote" IS TRUE)') |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } | 56 | } |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 874ad168a..e0c4dd2db 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import Bluebird from 'bluebird' |
2 | import { remove } from 'fs-extra' | 2 | import { remove } from 'fs-extra' |
3 | import { maxBy, minBy } from 'lodash' | 3 | import { maxBy, minBy } from 'lodash' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |