mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
GET appointments
This commit is contained in:
25
ober.go
25
ober.go
@@ -153,7 +153,30 @@ func AnimeSearchGet(ctx *fasthttp.RequestCtx) {
|
||||
}
|
||||
|
||||
func AppointmentGet(ctx *fasthttp.RequestCtx) {
|
||||
ctx.SetStatusCode(fasthttp.StatusNotImplemented)
|
||||
appoints, err := ReadAppointments()
|
||||
// check if no appointments exists
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "not found") || err == nutsdb.ErrBucketEmpty {
|
||||
appoints = make([]Appointment, 0)
|
||||
} else {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
bytes, err := json.Marshal(appoints)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
_, err = ctx.Write(bytes)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.SetContentType("application/json; charset=utf-8")
|
||||
ctx.SetStatusCode(fasthttp.StatusOK)
|
||||
}
|
||||
|
||||
func ChatGet(ctx *fasthttp.RequestCtx) {
|
||||
|
||||
Reference in New Issue
Block a user