Skip to content

HackHajs/skrunkly_draw_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skrunkly Draw Backend

rust-version nix-version

Dependencies

Endpoints

Post

  • GET /v0/post?id=<uuid> Returns:

    • 200 Response body:
      {
        "_id": "<uuid>",
        "user": "<uuid>",
        "created_at": "<iso_6801_utc_datetime>"
        "reply": {
          "parent": "<uuid>",
          "on_feed": bool,
        } // This is skipped if the post is not a reply
        "mature": bool,
        "liked_by": ["<uuid>"],
        "flagged_by": ["<uuid>"],
        "skrunkle": {
          "palette": ["str"]; // Exactly 8 elements
          "bg_color": "str",
          "strokes": [
            {
              "color": number,
              "shape": [
                 [num, num, num] // Exactly 3 elements  
              ]
            }
          ]
        }
      }
    • 400 When the uuid in the query is malformed
    • 401 Response body:
      {
        "type": { "authentication": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L25
        "message": "<human_readable_message>"
      }
    • 500 Response body:
      {
        "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
        "message": "<human_readable_message>"
      }
  • GET /v0/post/all

    • Everything is the same as GET /v0/post but you get a list instead. The list is ordered from newest to oldest, and limited to 100 elements. You don't get replies on this list unless the author of the reply specifically wanted the reply to also be published to the feed.
  • GET /v0/post/replies?id=<uuid>

    • Similar to /v0/post/all, but instead you only get posts which reply to the post provided on the query. The skrunkles in each post will contain the strokes of the original post and the strokes added by the reply.
  • POST /v0/post HTTP Headers

    • Content-Type: application/json
    • Authorization: Bearer <jwt> Body:
    {
      "reply": {
        "parent": "<uuid>",
        "on_feed": bool,
      } // Can be skipped if the post shouldn't be a reply
      "mature": bool,
      "skrunkle": {
        "palette": ["str"]; // Exactly 8 elements
        "bg_color": "str",
        "strokes": [
            {
              "color": number,
              "shape": [
                [num, num, num] // Exactly 3 elements  
              ]
            q}
          ]
        }
    }

    Returns:

    • 200 (no body)
    • 400 When the json sent is malformed
    • 401 Response body:
      {
        "type": { "authentication": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L25
        "message": "<human_readable_message>"
      }
    • 500 Response body:
      {
        "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
        "message": "<human_readable_message>"
      }
  • DELETE /v0/post?id=<uuid> HTTP Headers

    • Authorization: Bearer <jwt> Returns:
    • 200: The body is simply the number of updated documents. Should be equal to 1,
    • 400 When the uuid in the query is malformed
    • 401 Response body:
      {
        "type": { "authentication": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L25
        "message": "<human_readable_message>"
      }
    • 500 Response body:
      {
        "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
        "message": "<human_readable_message>"
      }

User

  • GET /user?id=<uuid> Returns:

    • 200 Response body:
      {
        "_id": "<uuid>",
        "created_at": "<iso_6801_utc_datetime>",
        "name": "<string>",
        "link": "<string>", // This could be like a personal website or a portfolio
        "profile_picture": "<uuid>", // The profile picture can reference one of the user's posts
      }
    • 400 When the uuid in the query is malformed
    • 500 Response body:
    {
      "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
      "message": "<human_readable_message>"
    }
  • PUT /user HTTP Headers

    • Content-Type: application/json
    • Authorization: Bearer <jwt> Body:
    {
      "name": "<string>", // All fields are required on create. Fields skipped when updating will stay unchanged.
      "link": "<string>", // Creates the user if it doesn't exist. Updates it otherwise.
      "profile_picture": "<uuid>"
    }

    Returns:

    • 200 (no body)
    • 400 When the json sent is malformed
    • 401 Response body:
      {
        "type": { "authentication": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L25
        "message": "<human_readable_message>"
      }
    • 500 Response body:
      {
        "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
        "message": "<human_readable_message>"
      }
  • DELETE /v0/user?id=<uuid> HTTP Headers

    • Authorization: Bearer <jwt> Returns:
    • 200: The body is simply the number of updated documents. Should be equal to 1,
    • 400 When the uuid in the query is malformed
    • 401 Response body:
      {
        "type": { "authentication": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L25
        "message": "<human_readable_message>"
      }
    • 500 Response body:
      {
        "type": { "database": "<type>" } // type is one of https://github.com/HackHajs/skrunkly_draw_backend/blob/trunk/src/error.rs#L42
        "message": "<human_readable_message>"
      }

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors