-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Endpoints
GET @ /challenges
Fetches all challenges which are not deleted and released. Deleted challenges will have deleted set to true, and released challenges will have a date in released_at. Only users with ViewUpcomingWeeklyChallenge permission should be able to see unreleased challenges.
If the user can see deleted challenges,
deletedshould be added in the challenge response
Challenge Object should look something like this:
{
"id": "string",
"title": "string",
"description": "string",
"author_id": "string",
"language_ids": ["string"],
"released_at": "date/null",
"slug": "string"
}if the user has any WeeklyChallenges permission, they should be able to see deleted challenges.
This endpoint needs pagination
POST @ /challenges
Creates a new Challenge. If the challenge is created successfully should return 201 Created with the challenge data.
Needs
CreateWeeklyChallengepermission
Body
{
"title": "string",
"description": "string",
"example_in": ["string"],
"example_out": ["string"],
"language_ids": ["string"]
}GET @ /challenges/{id/slug}
Fetch said challenge by id or slug.
Challenge object should something similar to this:
{
"id": "string",
"title": "string",
"description": "string",
"author_id": "string",
"author": {
"id": "string",
"name": "string",
"avatar": "string",
"discriminator": "string"
},
"example_in": ["string"],
"example_out": ["string"],
"languages": [
{
"id": "string",
"name": "string",
"download_url": "string"
}
],
"released_at": "date/null",
"slug": "string",
"submissions": "integer"
}The checks done on
GET @ /challengesshould be done here too (deleted and unreleased)
PATCH @ /challenges/{id}
Updates said challenge. Should return 200 OK with the new challenge data.
Needs
EditWeeklyChallengepermission
Body
{
"title": "string",
"description": "string",
"example_in": ["string"],
"example_out": ["string"],
"language_ids": ["string"]
}All fields should be optional
PUT @ /challenges/{id}/release
Releases/Unreleases said challenge. Should return 204 No Content if executed successfully.
Needs
EditWeeklyChallengepermission
DELETE @ /challenges/{id}
Update said challenge and set deleted to true. If executed successfully 204 No Content should be returned.
Needs
DeleteWeeklyChallengepermission