Skip to content

BW-Dev-Desk-Queue-1/Back-End

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev-Desk Queue

Students at lambda school need a place where they can escalate their concerns and receive help. This app allows an admin to manage help desk tickets that come in from Lambda School Students. It also allows students (A 2nd user type) to submit a help desk ticket, categorize it and post it to the help channel.

This is the back-end Repository for webservices providing end-points to front-end application.

Back-End

suggested endpoints:

pubic routes

post:

for students Register

    {
    "username" : "samm",
    "password"	: "gamgee"
    }

what back-end returns

{
    "id": 36,
    "username": "young3324",
    "password": "*******",
    "accessType": "student",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjM2LCJ1c2VybmFtZSI6InlvdW5nMzMyNCIsInVzZXJBY2Nlc3NUeXBlIjoic3R1ZGVudCIsImlhdCI6MTU4MDg2NzcxNCwiZXhwIjoxNTgwOTU0MTE0fQ.Q6Fnw5Xt77kvicG7g20xCLa5Z0-MwKLH0_1TFtq482s"
}

post:

for students login

{
    "username" : "samm",
    "password"	: "gamgee"
    }

what backend returns

    {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsInVzZXJuYW1lIjoic2FtbSIsInVzZXJBY2Nlc3NUeXBlIjoic3R1ZGVudCIsImlhdCI6MTU4MDc5MTY2MSwiZXhwIjoxNTgwODc4MDYxfQ.ZNacWbT2m9umvZDBnDe6l6j0D7fbfN8exInmyynmM6M",
    "accessType": "student",
    "userId": 30
}

post:

for helpers/admin login

https://dev-help-desk.herokuapp.com/api/helpers/login input to backend

    {
    "username" : "samssssssssss11",
    "password"	: "gamgeesss",
    "accessType" : "helper"
    }

what backend returns

    {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjE5LCJ1c2VybmFtZSI6InN1bjc3NzciLCJ1c2VyQWNjZXNzVHlwZSI6ImhlbHBlciIsImlhdCI6MTU4MDg2NzgxNCwiZXhwIjoxNTgwOTU0MjE0fQ.BJ8IkruLAcvi17QGT9sQ2_jAyQSOTJhu3SzVrcjhe8k",
    "accessType": "helper",
    "userId": 19
}

post:

for helpers/admin register

https://dev-help-desk.herokuapp.com/api/helpers/register input to backend

    {
    "username" : "samssssssssss11",
    "password"	: "gamgeesss",
    "accessType" : "helper"
    }

output from backend

    {
    "id": 23,
    "username": "young6670",
    "password": "*******",
    "accessType": "helper",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjIzLCJ1c2VybmFtZSI6InlvdW5nNjY3MCIsInVzZXJBY2Nlc3NUeXBlIjoiaGVscGVyIiwiaWF0IjoxNTgwODY3NjE1LCJleHAiOjE1ODA5NTQwMTV9.bL-CYh3w_QiD_1jioh1oDRd1nAIEyXkH0ubNg1FN5Y8"
}

priviate routes:

for students/admin/helpers

get: get all tickets for a specific user

  {
  "id": 2,
  "username": "james123",
  "password": "*********",
  "tickets": [
            {
            "id": 2,
            "title": "progress report",
            "description": "my progress report is not updating since Jan. 2020",
            "ticketCategory": "technical",
            "created_at": "2020-02-02 07:34:54",
            "user_id": 2,
            "resolved": false,
            "helper_id": 1
            }
            ]
  }

get: get a single ticket with related reactions

{
    "id": 3,
    "username": "sunny123",
    "password": "*******",
    "ticket": {
        "id": 3,
        "title": "Slack",
        "description": "My userid is not working in Slack",
        "ticketCategory": "technical",
        "created_at": "2020-02-02 07:34:54",
        "user_id": 3,
        "resolved": false,
        "helper_id": 3
    },
    "reactions": [
        {
            "id": 1,
            "ticket_id": 3,
            "created_at": "2020-02-02 07:34:54",
            "notes": "I re-created userId and sent an email to student for trial with new password. will wait for confirmation from the student."
        },
        {
            "id": 3,
            "ticket_id": 3,
            "created_at": "2020-02-02 07:34:54",
            "notes": "the student confirmed the userId is working now"
        }
    ]
}

post: create a ticket by student

{
    "id": 4,
    "title": "Slack",
    "description": "My userid is not working in Slack",
    "ticketCategory": "Other",
    "created_at": "2020-02-05 18:12:13",
    "tried": "I did make an account but...",
    "user_id": 4,
    "resolved": false,
    "helper_id": null
}

put: update a ticket by student

{
    "title": "Slack",
    "description": "Slack id and password are not working",
    "ticketCategory": "technical",
    "tried": "I did make an account but..."
}

delete: delete a ticket by student

{
    "message": "successfuly deleted..."
}

Access for helpers/admin ONLY:

get all users and its related tickets by helper

[
  {
    id: 1,
    username: 'young123',
    password: '*******',
    accessType: 'student',
    tickets: []
  },
  {
    id: 2,
    username: 'james123',
    password: '*******',
    accessType: 'student',
    tickets: [
      {
        id: 2,
        title: 'progress report',
        description: 'my progress report is not updating since Jan. 2020',
        ticketCategory: 'Other',
        created_at: '2020-02-05 18:06:04',
        tried: 'I restarted the computer',
        user_id: 2,
        resolved: false,
        helper_id: 1
      }
    ]
  },
  {
    id: 3,
    username: 'sunny123',
    password: '*******',
    accessType: 'student',
    tickets: [
      {
        id: 1,
        title: 'registration question',
        description: 'When is the next registration deadline?',
        ticketCategory: 'Track',
        created_at: '2020-02-05 18:06:04',
        tried: '',
        user_id: 3,
        resolved: false,
        helper_id: 2
      },
      {
        id: 3,
        title: 'Slack',
        description: 'My userid is not working in Slack',
        ticketCategory: 'Equipment',
        created_at: '2020-02-05 18:06:04',
        tried: 'I did make an account but...',
        user_id: 3,
        resolved: false,
        helper_id: 3
      }
    ]
  },
  {
    id: 4,
    username: 'young1122',
    password: '*******',
    accessType: 'student',
    tickets: [
      {
        id: 4,
        title: 'Slack',
        description: 'My userid is not working in Slack',
        ticketCategory: null,
        created_at: '2020-02-05 18:12:13',
        tried: 'I did make an account but...',
        user_id: 4,
        resolved: false,
        helper_id: null
      }
    ]
  }
];

get: get all tickets with related reactions by helper

[
  {
    id: 1,
    title: 'registration question',
    description: 'When is the next registration deadline?',
    ticketCategory: 'frontOffice',
    created_at: '2020-02-04 01:42:22',
    tried: '',
    user_id: 3,
    resolved: 0,
    helper_id: 2,
    reactions: [
      {
        id: 2,
        ticket_id: 1,
        created_at: '2020-02-04 01:42:22',
        notes: 'emailed to students with new registration information'
      }
    ]
  },
  {
    id: 2,
    title: 'progress report',
    description: 'my progress report is not updating since Jan. 2020',
    ticketCategory: 'technical',
    created_at: '2020-02-04 01:42:22',
    tried: 'I restarted the computer',
    user_id: 2,
    resolved: 0,
    helper_id: 1,
    reactions: [
      {
        id: 7,
        ticket_id: 2,
        created_at: '2020-02-05 19:04:13',
        notes: "I'm a new reaction"
      }
    ]
  }
];

get: get a single ticket info with related reactions by helper

  {
    "id": 1,
    "title": "registration question",
    "description": "When is the next registration deadline?",
    "ticketCategory": "frontOffice",
    "created_at": "2020-02-04 01:42:22",
    "tried": "",
    "user_id": 3,
    "resolved": false,
    "helper_id": 2,
    "reactions": [
        {
            "id": 2,
            "ticket_id": 1,
            "created_at": "2020-02-04 01:42:22",
            "notes": "emailed to students with new registration information"
        }
    ]
}

post: update a ticket by helper

{
    "title": "Slack12",
    "description": "My userid is not working in Slack22",
    "resolved": true,
    "helper_id": 12
}

post: create a reaction by helper

{
	"notes": "I'm a new another reaction"

}

output to client

  {
      "id": 8,
      "ticket_id": 2,
      "created_at": "2020-02-05T21:28:45.030Z",
      "notes": "I'm a new another reaction"
  }

put: update a reaction by helper

{
        "notes": "I did this"
    }

output to client

  {
    "notes": "I did this",
    "created_at": "2020-02-05 21:31:19",
    "ticket_id": 2
}

delete: delete a reaction by helper

output to client

  {
      "message": "successfuly deleted..."
  }

Database Schema

table: users

  • id: integer (auto-generated number)
  • username: string (not nullable, unique)
  • password: string (not nullable),
  • accessType: enumeration[student] (default to 'student')

table: helpers

  • id: integer (auto-generated number)
  • username: string (not nullable, unique)
  • password: string (not nullable)
  • accessType: enumeration [helper, admin] (default to 'helper')

table: tickets

  • id: integer (auto-generated number)
  • title: string (not nullable, indexed)
  • description: string
  • ticketCategory: enumeration [Equipment, People, Track,Finances, Other] (default to null)
  • created_at: timestamp
  • tried: string
  • user_id: integer (not nullable, foreign-key pointing to id in 'users' table)
  • resolved: boolean (default to false)
  • helper_id: integer (foreign-key pointing to id in 'helpers' table)

table: reactions

  • id: integer (auto-generated number)
  • ticket_id: integer (not nullable, foreign-key pointing to id in 'tickets' table)
  • created_at: timestamp
  • notes: string

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published