X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Fmodels%2Fvideo%2Fvideo-job-info.ts;h=6a67a214c13802d823d5233ba7cb0bc31a2d43f0;hb=84845992947365412733d056b9a9fe6ff15bd53f;hp=cb1f3f2f095daf55969dd2b92ceb0c95e11e7657;hpb=ad5db1044c8599eaaaa2a578b350777ae996b068;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-job-info.ts b/server/models/video/video-job-info.ts index cb1f3f2f0..6a67a214c 100644 --- a/server/models/video/video-job-info.ts +++ b/server/models/video/video-job-info.ts @@ -1,8 +1,10 @@ import { Op, QueryTypes, Transaction } from 'sequelize' import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, IsInt, Model, Table, Unique, UpdatedAt } from 'sequelize-typescript' -import { AttributesOnly } from '@shared/core-utils' +import { AttributesOnly } from '@shared/typescript-utils' import { VideoModel } from './video' +export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode' + @Table({ tableName: 'videoJobInfo', indexes: [ @@ -57,7 +59,7 @@ export class VideoJobInfoModel extends Model { + static async increaseOrCreate (videoUUID: string, column: VideoJobInfoColumnType): Promise { const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(` @@ -79,7 +81,7 @@ export class VideoJobInfoModel extends Model { + static async decrease (videoUUID: string, column: VideoJobInfoColumnType): Promise { const options = { type: QueryTypes.SELECT as QueryTypes.SELECT, bind: { videoUUID } } const [ { pendingMove } ] = await VideoJobInfoModel.sequelize.query<{ pendingMove: number }>(`