Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add api contract for task request #110

Closed
wants to merge 4 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions taskRequest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Task Request

## Task Request Object

```
// TBD
```

## **Requests**

| Route | Description |
| :-------------------------------------------: | :---------------------------: |
| [GET /taskRequests](#get-taskRequests) | Returns all task Reqeusts |
| [PUT /taskRequest](#put-taskRequest) | Creates a task Request |
| [PATCH /taskRequest](#patch-taskRequests) | Approves task request to user |
| [DELETE /taskRequest/:id](#delete-taskRequst) | Delete task request |

## **GET /taskRequests**

Returns all tasks to super user.

- **Params**
None
- **Query**
None
- **Body**
None
- **Headers**
None
- **Cookie**
rds-session: `<JWT>`
- Success Response
- Code: 200
Content:
```
{
message: "Task requests returned successfully",
taskRequests: [
{<task request object>}
],
}
```
- Error Response
- Code: 401
Content: `{'statusCode': 401, 'error': 'Unauthorized User' }`
- Code: 403
Content: `{'statusCode: 403, 'error': 'Unauthorized access: user is not super user'}`
- Code: 500
Content: `{'statusCode: 500, 'error': 'Internal Server Error'}`

## **PUT /taskRequest**

Creates a task request.

- **Params**
None
- **Query**
None
- **Headers**
`Content-Type: 'application/json'`
- **Body**
`{<taskInfo, userInfo>}`
TanishqSingla marked this conversation as resolved.
Show resolved Hide resolved
- **Cookie**
rds-session: `<JWT>`
- Success Response
- Code: 201
Content:
```
{
message: "Task request created successfully",
taskRequest: {<created task request object>}
}
```
- Error Response
- Code: 401
Content: `{statusCode: 500, 'error': "Unauthorized User"}`
- Code: 403
Content: `{'statusCode: 403, 'error': 'Unauthorized access: user is not super user'}`
- Code: 500
Content: `{statusCode: 500, 'error': "Internal server error"}`

## **PATCH /taskRequest/:id**

Changes status of task request

- **Params**
Task Request id
- **Query**
None
- **Headers**
`Content-Type: 'application/json'`
- **Body**
`{<New Task Status>, approvedTo: userId}`
TanishqSingla marked this conversation as resolved.
Show resolved Hide resolved
- **Success**
- Code: 204
Content: `<No Content>`
TanishqSingla marked this conversation as resolved.
Show resolved Hide resolved
- Error Response
- Code: 401
Content: `{statusCode: 500, 'error': "Unauthorized User"}`
- Code: 403
Content: `{'statusCode: 403, 'error': 'Unauthorized access: user is not super user'}`