Skip to content

devdesk-queue/node-back-end

 
 

Repository files navigation

node-back-end

This repository will server as the backend server for the devdesk queue application

API documentation

Resource: Authentication

[POST] registration

URL: /api/auth/register

Payload: an object with the following properties.

{
  "email": "whiskers@example.com",
  "username": "mr. kitty",
  "password": "purr"
}

Returns an object with new user data.

Example:

{
  "user": {
    "id": 6,
    "email": "whiskers@example.com",
    "username": "mr. kitty",
    "role": "student",
    "created_at": "2019-04-16 18:43:41"
  },
  "token": "<hidden>"
}

[POST] login

URL: /api/auth/login

Payload: an object with the following properties.

{
  "username": "mr. kitty",
  "password": "purr"
}

Returns an object with user token.

Example:

{
  "message": "Welcome, mr. kitty!",
  "token": "<hidden>"
}

Resource: Tickets

[GET] all tickets

URL: /api/tickets

Returns an array of ticket objects.

Example:

[
  {
    "id": 1,
    "status": "resolved",
    "title": "problem1",
    "description": "big problem",
    "tried": "cry",
    "student_id": 2,
    "helper_id": 1,
    "created_at": "2019-04-17 01:57:26",
    "updated_at": "2019-04-17 01:57:26",
    "categories": [
      {
        "id": 2,
        "name": "User Interface II"
      },
      {
        "id": 3,
        "name": "User Interface III"
      }
    ]
  }
]

[GET] ticket by ID

URL: /api/tickets/:id

Returns a ticket object.

Example:

{
  "id": 1,
  "status": "resolved",
  "title": "problem1",
  "description": "big problem",
  "tried": "cry",
  "student_id": 2,
  "helper_id": 1,
  "created_at": "2019-04-17 01:57:26",
  "updated_at": "2019-04-17 01:57:26",
  "categories": [
    {
      "id": 2,
      "name": "User Interface II"
    },
    {
      "id": 3,
      "name": "User Interface III"
    }
  ]
}

[POST] new ticket

URL: /api/tickets

Payload: an object with the following properties.

Category can be a string from pre-selected list!

{
  "title": "Please help",          // string, max 256 chars, required
  "description": "I need help",    // string, required
  "tried": "I tried this....",     // string, optional
  "category": "JavaScript I",      // string, required
}

Returns: new ticket object.

[PUT] ticket

URL: /api/tickets/:id

Payload: an object with the status and helper_id property. Valid status values are "inQueue", "opened", "resolved" strings. helper_id is the user_id of helper user role, who is editing the ticket.

{
  "status": "inQueue",    // Required
  "helper_id": 1          // Integer, Required.
}

Returns: updated ticket object.

About

This repository will server as the backend server for the devdesk queue application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •