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

Challenges #64

Open
mohamed040406 opened this issue Nov 22, 2021 · 0 comments
Open

Challenges #64

mohamed040406 opened this issue Nov 22, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mohamed040406
Copy link
Contributor

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, deleted should 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 CreateWeeklyChallenge permission

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 @ /challenges should be done here too (deleted and unreleased)


PATCH @ /challenges/{id}

Updates said challenge. Should return 200 OK with the new challenge data.

Needs EditWeeklyChallenge permission

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 EditWeeklyChallenge permission


DELETE @ /challenges/{id}

Update said challenge and set deleted to true. If executed successfully 204 No Content should be returned.

Needs DeleteWeeklyChallenge permission

@mohamed040406 mohamed040406 added enhancement New feature or request good first issue Good for newcomers labels Nov 22, 2021
@mohamed040406 mohamed040406 added this to the Initial Release milestone Nov 22, 2021
@Tech-With-Tim Tech-With-Tim deleted a comment from github-actions bot Nov 22, 2021
@SylteA SylteA pinned this issue Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant