Added ticket and participant creation. Revised Gate kiosk.
This commit is contained in:
parent
d30ee18e77
commit
3906b73c61
5 changed files with 231 additions and 117 deletions
|
|
@ -131,6 +131,28 @@ func (app *App) handleExportParticipants(w http.ResponseWriter, r *http.Request)
|
|||
wr.Flush()
|
||||
}
|
||||
|
||||
func (app *App) handleCreateTicket(w http.ResponseWriter, r *http.Request) {
|
||||
var t Ticket
|
||||
if err := json.NewDecoder(r.Body).Decode(&t); err != nil {
|
||||
writeError(w, "invalid request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if t.ParticipantID == nil {
|
||||
writeError(w, "participant_id is required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if t.Source == "" {
|
||||
t.Source = "manual"
|
||||
}
|
||||
created, err := app.createTicket(t)
|
||||
if err != nil {
|
||||
writeError(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
writeJSON(w, created)
|
||||
}
|
||||
|
||||
func (app *App) handleListTickets(w http.ResponseWriter, r *http.Request) {
|
||||
tickets, err := app.listTickets(nil, "")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue