mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 17:29:54 +01:00
Add appointment to watchext
This commit is contained in:
@@ -215,7 +215,8 @@ _[]AnimeUserExtended_ (GET)
|
||||
"updated": "2022-05-15T20:44:35Z"
|
||||
}
|
||||
],
|
||||
"data": { --SEE ANIME GET (Anime object)-- }
|
||||
"data": { --SEE ANIME GET (Anime object)-- },
|
||||
"appointments": { --SEE APPOINTMENT GET (Appointment list)-- }
|
||||
},
|
||||
{
|
||||
"anime": 40356,
|
||||
@@ -227,7 +228,8 @@ _[]AnimeUserExtended_ (GET)
|
||||
"updated": "2022-04-25T18:11:27Z"
|
||||
}
|
||||
],
|
||||
"data": { --SEE ANIME GET (Anime object)-- }
|
||||
"data": { --SEE ANIME GET (Anime object)-- },
|
||||
"appointments": { --SEE APPOINTMENT GET (Appointment list)-- }
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
12
ober.go
12
ober.go
@@ -316,10 +316,16 @@ func WatchExtendedGet(ctx *fasthttp.RequestCtx) {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
apps, err := SearchAppointments(a.Anime)
|
||||
if err != nil {
|
||||
addErrorToCtx(ctx, err)
|
||||
return
|
||||
}
|
||||
animeUsersExtended = append(animeUsersExtended, AnimeUserExtended{
|
||||
Anime: a.Anime,
|
||||
Users: a.Users,
|
||||
Data: *data,
|
||||
Anime: a.Anime,
|
||||
Users: a.Users,
|
||||
Data: *data,
|
||||
Appointments: apps,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
20
schaffer.go
20
schaffer.go
@@ -6,6 +6,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/xujiajun/nutsdb"
|
||||
)
|
||||
|
||||
func JikanConvert(jik *SeasonAnimeJikan) Anime {
|
||||
@@ -160,6 +162,24 @@ func SearchAnime(animeId int64) (*Anime, error) {
|
||||
return anime, err
|
||||
}
|
||||
|
||||
func SearchAppointments(animeId int64) ([]Appointment, error) {
|
||||
appointments, err := ReadAppointments()
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "not found") || err == nutsdb.ErrBucketEmpty {
|
||||
return make([]Appointment, 0), nil
|
||||
} else {
|
||||
return appointments, err
|
||||
}
|
||||
}
|
||||
result := make([]Appointment, 0)
|
||||
for _, a := range appointments {
|
||||
if animeId == a.Anime {
|
||||
result = append(result, a)
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func FetchProgress(animeId, userId int64, username string, progress int) (int, time.Time, string, error) {
|
||||
// check watching first
|
||||
newProgress, updated, err := fetchProgressOnState(animeId, userId, progress, username, malApiStatusW)
|
||||
|
||||
Reference in New Issue
Block a user