• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GEWIS / sudosos-backend / 26082567712

19 May 2026 07:22AM UTC coverage: 87.549% (-0.2%) from 87.783%
26082567712

Pull #918

github

web-flow
Merge a7f0b4cdb into 9dd74ee61
Pull Request #918: Background task queue (replaces BullMQ) with admin API, WebSocket updates, and failed-task health signal

3969 of 4634 branches covered (85.65%)

Branch coverage included in aggregate %.

498 of 563 new or added lines in 16 files covered. (88.45%)

110 existing lines in 13 files now uncovered.

20607 of 23437 relevant lines covered (87.93%)

840.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/controller/response/task-response.ts
NEW
1
/**
×
2
 *  SudoSOS back-end API service.
3
 *  Copyright (C) 2026 Study association GEWIS
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as published
7
 *  by the Free Software Foundation, either version 3 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 *
18
 *  @license
NEW
19
 */
×
20

NEW
21
/**
×
22
 * @module tasks
NEW
23
 */
×
24

25
import BaseResponse from './base-response';
26
import { PaginationResult } from '../../helpers/pagination';
27

28
/**
29
 * API response for the `task` entity.
30
 * @typedef {allOf|BaseResponse} TaskResponse
31
 * @property {string} type.required - Handler key, e.g. 'send-notification'.
32
 * @property {string} payload.required - JSON-encoded handler payload.
33
 * @property {string} status.required - One of pending, processing, completed, failed.
34
 * @property {integer} attempts.required - Attempts so far.
35
 * @property {integer} maxAttempts.required - Maximum attempts before status=failed.
36
 * @property {string} availableAt - Earliest time this task may be picked up.
37
 * @property {string} startedAt - When the most recent attempt began.
38
 * @property {string} completedAt - When the task finished successfully.
39
 * @property {string} lastError - Most recent error message.
40
 */
41
export interface TaskResponse extends BaseResponse {
42
  type: string;
43
  payload: string;
44
  status: string;
45
  attempts: number;
46
  maxAttempts: number;
47
  availableAt?: string | null;
48
  startedAt?: string | null;
49
  completedAt?: string | null;
50
  lastError?: string | null;
51
}
52

53
/**
54
 * Paginated API response for the `task` entity.
55
 * @typedef {object} PaginatedTaskResponse
56
 * @property {PaginationResult} _pagination.required - Pagination metadata.
57
 * @property {Array.<TaskResponse>} records.required - The page of tasks.
58
 */
59
export interface PaginatedTaskResponse {
60
  _pagination: PaginationResult;
61
  records: TaskResponse[];
62
}
63

NEW
64
/**
×
65
 * Aggregate counts of tasks by status.
66
 * @typedef {object} TaskStatsResponse
67
 * @property {integer} pending.required - Count of tasks waiting to run.
68
 * @property {integer} processing.required - Count of tasks currently in flight.
69
 * @property {integer} completed.required - Count of tasks that succeeded.
70
 * @property {integer} failed.required - Count of tasks that gave up after retries.
NEW
71
 */
×
72
export interface TaskStatsResponse {
73
  pending: number;
74
  processing: number;
75
  completed: number;
76
  failed: number;
NEW
77
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc