Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Classes API #9

Open
jinwoo1225 opened this issue Oct 24, 2021 · 0 comments
Open

Classes API #9

jinwoo1225 opened this issue Oct 24, 2021 · 0 comments
Assignees
Labels

Comments

@jinwoo1225
Copy link
Member

jinwoo1225 commented Oct 24, 2021

Classes API

  • /api/classes

    • GET
      will get every class

      Request

      No Authentication Header Required

      No Request Body Required

      Success Response

      Status Code : 200 OK

      Content-Type : application/json

      It will response as array which contains...

      Key Description Type
      id Id of class ObjectId(MongoId)
      name Name of class string
      description Description string
      created CreatedDate of class Date
      point Point of class, when user join this class user will lose point of it number
      classType Type of class string["video", "online", "offline", "qna"]
      maxCapacity Capacity of class, when class is full new user can't join this class number
      teacher Creator of class User
      listener Listener of class []User
      state State of Class string["Pending", "Processing", "Ended"]
    • POST
      will create class

      Request

      Authentication Header Required
      x-access-token:jwt_token_value

      Content-Type : application/json

      Key Description Type Optional
      name Name of class string Required
      description Description of class string Optional
      classType Type of class string["video", "online", "offline", "qna"] Required
      point Point of class number[0:50][min:max] Required
      maxCapacity Capacity of Class number[0:][min:max] Required

      Success Response

      Status Code : 201 Created

      Content-Type : application/json

      Key Description Type
      ClassId created class id String

      Error Response

      Status Code : 409 Conflict

      Condition : If same class name is in database

    • /api/classes/:cid

      • GET
        should get class of cid

        Request

        No Authentication Header Required

        No Request Body Required

        Success Response

        Status Code : 200 OK

        Content-Type : application/json

        Key Description Type
        id Id of class ObjectId(MongoId)
        name Name of class string
        description Description of class string
        created CreatedDate of class Date
        point Point of class, when user join this class user will lose point of it number
        classType Type of class string["video", "online", "offline", "qna"]
        maxCapacity Capacity of class, when class is full new user can't join this class number
        teacher Creator of class User
        listener Listener of class []User
        state State of Class string["Pending", "Processing", "Ended"]

        Error Response

        Condition : if given cid is non-exist id in our database

        Status Code : 404 Not Found

      • POST
        should requested user will join class of cid

        Request

        Authentication Header Required
        x-access-token:jwt_token_value

        No Request Body required

        Success Response

        Status Code : 201 Created

        Content-Type : application/json

        Key Description Type
        message result of joining a class string

        Error Response

        Condition : If Requested User is creator of class or already joined class or class is full capacity

        Status Code : 400 Bad Request

      • PATCH
        should change element of class

        Request

        Authentication Header Required
        x-access-token : jwt_token_value

        Key Description Type Optional
        name Name of class string Optional
        description Description of class string Optional
        maxCapacity Capacity of class number Optional, it supports only scale up. can't be lower than current capacity.
        state State of class string["Pending", "Processing", "Ended"] Optional, default it is setted to Pending, You can change only Pending -> Processing, Processing -> Ended. can't be Requested as a reversed order

        Success Response

        Status-Code : 200 OK

        Content-Type : application/json

        Key Description Type
        changed Changed Thing []Changed_Value<string>

        Error Response

        Condition : If Requested User is not a creator of requested class, User requested unvalid Request maxCapacity, state

        Status Code : 400 Bad Request

        Key Description Type
        error array of error []Error<string>
      • DELETE
        Delete Requested Class

        Request

        Authentication Required

        x-access-token:jwt_token_value

        No Request Body Required

        Success Response

        Status Code : 200 OK

        No Response Body

        Error Response

        Condition : Requested cid is non-exist cid

        Status Code : 404 Not Found

@jinwoo1225 jinwoo1225 self-assigned this Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant