aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/jobs.ts20
-rw-r--r--shared/models/server/job.model.ts2
2 files changed, 15 insertions, 7 deletions
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index cac00e9ab..a53749589 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -1,12 +1,20 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3import { makeGetRequest } from '../../../shared/extra-utils'
2import { Job, JobState, JobType } from '../../models' 4import { Job, JobState, JobType } from '../../models'
3import { wait } from '../miscs/miscs' 5import { wait } from '../miscs/miscs'
4import { ServerInfo } from './servers' 6import { ServerInfo } from './servers'
5import { makeGetRequest } from '../../../shared/extra-utils'
6import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
7 7
8function getJobsList (url: string, accessToken: string, state: JobState) { 8function buildJobsUrl (state?: JobState) {
9 const path = '/api/v1/jobs/' + state 9 let path = '/api/v1/jobs'
10
11 if (state) path += '/' + state
12
13 return path
14}
15
16function getJobsList (url: string, accessToken: string, state?: JobState) {
17 const path = buildJobsUrl(state)
10 18
11 return request(url) 19 return request(url)
12 .get(path) 20 .get(path)
@@ -19,14 +27,14 @@ function getJobsList (url: string, accessToken: string, state: JobState) {
19function getJobsListPaginationAndSort (options: { 27function getJobsListPaginationAndSort (options: {
20 url: string 28 url: string
21 accessToken: string 29 accessToken: string
22 state: JobState
23 start: number 30 start: number
24 count: number 31 count: number
25 sort: string 32 sort: string
33 state?: JobState
26 jobType?: JobType 34 jobType?: JobType
27}) { 35}) {
28 const { url, accessToken, state, start, count, sort, jobType } = options 36 const { url, accessToken, state, start, count, sort, jobType } = options
29 const path = '/api/v1/jobs/' + state 37 const path = buildJobsUrl(state)
30 38
31 const query = { 39 const query = {
32 start, 40 start,
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index 346b25607..b0ed860a7 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -2,7 +2,7 @@ import { ContextType } from '../activitypub/context'
2import { VideoResolution } from '../videos/video-resolution.enum' 2import { VideoResolution } from '../videos/video-resolution.enum'
3import { SendEmailOptions } from './emailer.model' 3import { SendEmailOptions } from './emailer.model'
4 4
5export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' 5export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
6 6
7export type JobType = 7export type JobType =
8 | 'activitypub-http-unicast' 8 | 'activitypub-http-unicast'