This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL Risks Found
|
FireMario211
changed the title
Support Ticket Pull Request.
Support Ticket API Pull Request.
Jun 24, 2021
SQL Risks Found
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull requests adds a new API endpoint
/api/tickets
. (Requires Client Permission)Additions from this branch:
/api/auth.ts
permission_id
.src
.permissions.json
, which can handle what users can access what pages.ticket_categories.json
, which are for what categories users can add to their ticket.website.ts
to allow any Request Method (GET, POST, PATCH, DELETE, etc)Support Ticket API Documentation:
GET /api/tickets/list
(Client [1] will be able to view their own tickets, and Support [2:level] will be able to view all tickets based on their level, and below.) - Lists the tickets.number
- Page Number (example:page=4
| defaults to1
.)"opened" | "closed"
- Filter based on closed or opened tickets (example:status=closed
| defaults toopened
.)number
- Limit to how much tickets should be shown. (example:limit=15
| defaults to10
.)POST /api/tickets/create
- Creates the ticket.string
- Subject or Title of the Ticket. (example:subject=Need help.
)string
- Contents of the Ticket. (example:content=My service is not operating properly.
)string
orarray
- Category IDs for the Ticket. (example:categories=0,1
)GET /api/tickets/:ticketid
(Client [1] will only be able to access if it's their own ticket, and Support [2:level] will only be able to view the ticket based on if the ticket is based on their level, or below.) - View information about the ticket.number
- Page Number for messages (example:page=4
| defaults to1
.)number
- Limit to how much messages should be shown. (example:limit=15
| defaults to10
.)PUT /api/tickets/:ticketid
- (Client [1] will only be able to access if it's their own ticket, and Support [2:level] will only be able to view the ticket based on if the ticket is based on their level, or below.) - Edits the ticket information, such as changing the categories, changing the status (closed/open), or editing the subject/content.number
- Reopens the Ticket (example:reopen=1
)number
- Closes the Ticket (example:closed=1
)string
- Subject or Title of the Ticket. (example:subject=Need help.
)string
- Contents of the Ticket. (example:content=My service is not operating properly.
)string
orarray
- Category IDs for the Ticket. (example:categories=0,1
)204 No Content
POST /api/tickets/:ticketid
(Client [1] will only be able to access if it's their own ticket, and Support [2:level] will only be able to view the ticket based on if the ticket is based on their level, or below.) - Posts a new message to the Ticket.string
- Contents of the message. (example:content=My reply to my ticket.
)DELETE /api/tickets/:ticketid
- (Client [1] will only be able to access if it's their own ticket, and Support [2:level] will only be able to view the ticket based on if the ticket is based on their level, or below. Administrators [4] are able to delete the ticket instead of closing it.) - Closes the Ticket.204 No Content
GET /api/tickets/:ticketid/:msgid
- (Client [1] will only be able to access if it's their own message, and Support [2:level] will only be able to view the message based on if the ticket is based on their level, or below.) - View information about the message (Not useful but it's there.)PATCH /api/tickets/:ticketid/:msgid
(Client [1] will only be able to access if it's their own message, though Support is not able to edit the message if it's not theirs.) - Posts a new message to the Ticket.string
- Contents of the message. (example:content=My edit to this message.
)DELETE /api/tickets/:ticketid/:msgid
- (Client [1] will only be able to access if it's their own message, and Support [2:level] will only be able to delete the message based on if the ticket is based on their level, or below.) - Deletes the message.204 No Content
File uploading is currently not supported and will be supported later.
Requirements after using
git pull
when PR is merged:ALTER TABLE users ADD COLUMN permission_id INTEGER NOT NULL DEFAULT 0
, this will add thepermission_id
field to the users table.npm run sql
, this will create thetickets
andticket_msgs
table.If there are any questions or issues about this Pull Request, let me know.