support

package
v0.0.0-...-1bc63cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTicketResponsesByTicketID

func GetTicketResponsesByTicketID(db *sql.DB, ticketID int) ([]string, error)

GetTicketResponsesByTicketID gets all of the responses for a ticket by its ticket id. Should only interact with the database.

func InsertNewTicket

func InsertNewTicket(w http.ResponseWriter, r *http.Request)

InsertNewTicket endpoint parses the data from the user and inserts the new ticket in the database.

func InsertNewTicketInDB

func InsertNewTicketInDB(db *sql.DB, username, title, text string) (string, error)

InsertNewTicketInDB only uses database functions and inserts the new ticket into the database as well as the first customer message as a ticket_response. Returns the slug and potential error.

func InsertNewTicketResponse

func InsertNewTicketResponse(w http.ResponseWriter, r *http.Request)

InsertNewTicketResponse endpoint parses the data when responding to a ticket and inserts the new data into the database.

func InsertNewTicketResponseInDB

func InsertNewTicketResponseInDB(db *sql.DB, ticketID, userID int, text string) error

InsertNewTicketResponseInDB inserts a new ticket response into the database based on the userID and ticketID.

func NewTicket

func NewTicket(w http.ResponseWriter, r *http.Request)

NewTicket endpoint rendering page to create a new customer support ticket. Has no other dynamic data than the "standard" data such as username.

func Support

func Support(w http.ResponseWriter, r *http.Request)

Support endpoint showing the user active and finished tickets in a table.

func Ticket

func Ticket(w http.ResponseWriter, r *http.Request)

Ticket endpoint returns the data for the ticket to the user from the ticket slug. I.e. what is sent after /support/{ticket}

Types

type Page

type Page struct {
	Title string
	Paths []helpers.Path
}

Page struct is used for generic data to be rendered in HTML and should not be used in other structs.

type PageData

type PageData struct {
	Title   string
	Paths   []helpers.Path
	Tickets []TicketData
}

PageData struct is used for the data being rendered and should not be used in other structs.

type TicketData

type TicketData struct {
	Title  string
	Slug   string
	Solved bool
}

TicketData struct is used for storing data related to Customer Support Tickets.

func GetTicketBySlug

func GetTicketBySlug(db *sql.DB, slug, username string) (int, TicketData, error)

GetTicketBySlug gets individual ticket by its slug. Should only interact with the database.

func GetTicketsByUsername

func GetTicketsByUsername(db *sql.DB, username string) ([]TicketData, error)

GetTicketsByUsername gets tickets associated with the username variable sent in.

type TicketPage

type TicketPage struct {
	Title     string
	Paths     []helpers.Path
	Ticket    TicketData
	Responses []string
}

TicketPage struct is used for rendering the data for an individual ticket with a ticket and all of its responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL