generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 49
items api contract #112
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
Open
vinayak-trivedi
wants to merge
1
commit into
main
Choose a base branch
from
docs/items-tag-api-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
items api contract #112
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# ItemTags | ||
|
||
# itemTags Object | ||
|
||
``` | ||
{ | ||
"id": "DuNaDRR1fgzDQO3Qh4Aj", | ||
"itemId": "Ts3ZiJdD4OOPThZrBpc0", | ||
"tagType": "SKILL", | ||
"levelName": "test-level-value", | ||
"levelId": "b0Fnaz6T9yh3ljkKgmPy", | ||
"levelValue": 2, | ||
"tagId": "QHuZ5rI9CjWPDhPsxZ61", | ||
"itemType": "USER", | ||
"tagName": "EMBER" | ||
} | ||
``` | ||
|
||
## **Requests** | ||
|
||
| Route | Description | | ||
| :--------------------------------: | :---------------: | | ||
| [GET /items/filter](#get-itemsfilter) | Returns items based on filter | | ||
| [POST /items](#post-items) | Creates an item object used for assigning levels and skills | | ||
| [DELETE /items](#get-tasksself) | Deletes the items object | | ||
|
||
## **GET /items/filter** | ||
|
||
Returns all items based on filter | ||
|
||
- **Params** | ||
None | ||
- **Query** | ||
Optional: `itemType` (`itemType` is the type of the item which we have added the tag to, e.g. USER, TASK, it need to be uppercase) <br> | ||
|
||
Optional: `itemId` | ||
(`itemId` is the Id of items for which all the tags we are trying to fetch, for example, if we want to fetch all the tags that are there on a particular user we can filter it by providing the userId in this query) <br> | ||
|
||
Optional: `levelId` (`levelId` is used when we want ot filter the items based on the levels, this can be used to fetch all the items of a particular level) <br> | ||
|
||
Optional: `levelName` (`levelName` is the name of level that we have added in the levels object of db, we can use this to filter the items based on a levelName) <br> | ||
|
||
Optional: `levelNumber` (`levelNumber` is the number that we have added in the level object in our RDS db, e.g 1, 2 ,3 etc.) | ||
|
||
Optional: `tagId` (`tagId` is the doc id of the tag that we added to a particular item, example of tags are react, ember, etc.) | ||
|
||
Optional: `tagType` (`tagType` is the type of tag that we are finding, currently we are only using one tag, i.e SKILL.) | ||
|
||
|
||
- **Body** | ||
None | ||
- **Headers** | ||
Content-Type: application/json | ||
- **Cookie** | ||
rds-session: `<JWT>` | ||
- **Success Response:** | ||
- **Code:** 200 | ||
- **Content:** | ||
|
||
``` | ||
{ | ||
"message": "Items fetched Successfully", | ||
"data": [ | ||
{items_object} | ||
{items_object} | ||
{items_object} | ||
] | ||
} | ||
|
||
``` | ||
|
||
- **Error Response:** | ||
- **Code:** 401 | ||
- **Content:** | ||
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }` | ||
- **Code:** 404 | ||
- **Content:** | ||
`{ 'statusCode': 404, 'error': 'Bad Request', message: '\"itemType\" must only contain uppercase characters' }` | ||
- **Code:** 500 | ||
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }` | ||
|
||
## **POST /items** | ||
|
||
- **Params** | ||
None | ||
- **Query** | ||
None | ||
- **Headers** | ||
Content-Type: application/json | ||
- **Body** `{ | ||
itemId: <item-id>, | ||
itemType: <item-type>, | ||
tagPayload: [ | ||
tagId: <tag-id>, | ||
levelId: <level-id>, | ||
] | ||
}` | ||
RitikJaiswal75 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- **Success Response:** | ||
- **Code:** 200 | ||
- **Content:** | ||
|
||
``` | ||
{ | ||
"message": "Tags added successfully!", | ||
"itemId": <item-id> | ||
} | ||
``` | ||
|
||
- **Error Response:** | ||
- **Code:** 401 | ||
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }` | ||
- **Code:** 500 | ||
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }` | ||
|
||
## **DELETE /items** | ||
|
||
- **Params** | ||
None | ||
- **Query** | ||
None | ||
- **Headers** | ||
Content-Type: application/json | ||
- **Body** `{ | ||
itemId: <item-id>, | ||
tagId: <tag-id>, | ||
}` | ||
- **Success Response:** | ||
- **Code:** 200 | ||
- **Content:** | ||
|
||
``` | ||
{ | ||
"message": "Tags removed successfully!", | ||
"itemId": <ItemId>, | ||
"tagId": <tagId>, | ||
} | ||
``` | ||
|
||
- **Error Response:** | ||
- **Code:** 401 | ||
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }` | ||
- **Code:** 500 | ||
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/filter
is it mandatory?