mirror of
https://github.com/ultrasn0w/huso.git
synced 2026-10-26 14:34:17 +01:00
GET appointments
This commit is contained in:
1 parent
b2b6c97282
commit
a079fbf9db
1 file changed
+24
-1
@@ -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