X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-job-info.ts;h=6a67a214c13802d823d5233ba7cb0bc31a2d43f0;hb=84845992947365412733d056b9a9fe6ff15bd53f;hp=7c1fe67345be97a3f1dd4194251e7520919ad37a;hpb=0305db28c98fd6cf43a3c50ba92c76215e99d512;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-job-info.ts b/server/models/video/video-job-info.ts index 7c1fe6734..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: [ @@ -49,7 +51,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 }>(`