forked from linuxfoundation/crowd.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskQuery.ts
More file actions
31 lines (27 loc) · 1.07 KB
/
Copy pathtaskQuery.ts
File metadata and controls
31 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Permissions from '../../security/permissions'
import track from '../../segment/track'
import TaskService from '../../services/taskService'
import PermissionChecker from '../../services/user/permissionChecker'
/**
* POST /tenant/{tenantId}/task/query
* @summary Query tasks
* @tag Tasks
* @security Bearer
* @description Query tasks. It accepts filters, sorting options and pagination.
* @pathParam {string} tenantId - Your workspace/tenant ID
* @bodyContent {TaskQuery} application/json
* @response 200 - Ok
* @responseContent {TaskList} 200.application/json
* @responseExample {TaskList} 200.application/json.Task
* @response 401 - Unauthorized
* @response 404 - Not found
* @response 429 - Too many requests
*/
export default async (req, res) => {
new PermissionChecker(req).validateHas(Permissions.values.taskRead)
const payload = await new TaskService(req).query(req.body)
if (req.query.filter && Object.keys(req.query.filter).length > 0) {
track('Tasks Advanced Filter', { ...payload }, { ...req })
}
await req.responseHandler.success(req, res, payload)
}