Skip to content

Commit

Permalink
fixed the struct for UserRatesSchema() and updated the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
heycatch committed Sep 11, 2024
1 parent e128d83 commit b748f30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
33 changes: 12 additions & 21 deletions api/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,18 @@ type MangasGraphQL struct {
}

type UserRatesGraphQL struct {
Anime AnimesGraphQL `json:"anime"`
Manga MangasGraphQL `json:"manga"`
Id string `json:"id"`
Text string `json:"text"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Rewatches int `json:"rewatches"`
Score float32 `json:"score"`
Status UserRatesStatusGraphQL `json:"status"`
Episodes int `json:"episodes"`
Chapters int `json:"chapters"`
Volumes int `json:"volumes"`
}

type UserRatesStatusGraphQL struct {
Planned string `json:"planned"`
Watching string `json:"watching"`
Rewatching string `json:"rewatching"`
Completed string `json:"completed"`
On_hold string `json:"on_hold"`
Dropped string `json:"dropped"`
Anime AnimesGraphQL `json:"anime"`
Manga MangasGraphQL `json:"manga"`
Id string `json:"id"`
Text string `json:"text"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Rewatches int `json:"rewatches"`
Score int `json:"score"`
Status string `json:"status"`
Episodes int `json:"episodes"`
Chapters int `json:"chapters"`
Volumes int `json:"volumes"`
}

type AiredOnGraphQL struct {
Expand Down
4 changes: 2 additions & 2 deletions graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func main() {
// Про доступные значения можно почитать в описании функции: graph.Values();
// Про доступные параметры интерфейса можно почитать в описании функции: graph.UserRatesSchema();
schema, err := graph.UserRatesSchema(
graph.Values("id", "text", "score", "createdAt", "anime{name}"),
graph.Values("id", "text", "score", "createdAt", "anime{id name}"),
181833, graph.UserRatesOrder(shiki.GRAPHQL_ORDER_FIELD_ID, shiki.GRAPHQL_ORDER_ORDER_DESC),
1, 10, shiki.MY_LIST_COMPLETED, shiki.TARGET_TYPE_ANIME,
)
Expand All @@ -293,7 +293,7 @@ func main() {
fmt.Println(ur.Errors)
// Стандартный вывод нашего поиска, ничего нового.
for _, v := range ur.Data.UserRates {
fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Name)
fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Id, v.Anime.Name)
}
}
```
4 changes: 2 additions & 2 deletions graphql/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func main() {
// The available values can be found in the function description: graph.Values();
// The available interface parameters can be found in the function description: graph.UserRatesSchema();
schema, err := graph.UserRatesSchema(
graph.Values("id", "text", "score", "createdAt", "anime{name}"),
graph.Values("id", "text", "score", "createdAt", "anime{id name}"),
181833, graph.UserRatesOrder(shiki.GRAPHQL_ORDER_FIELD_ID, shiki.GRAPHQL_ORDER_ORDER_DESC),
1, 10, shiki.MY_LIST_COMPLETED, shiki.TARGET_TYPE_ANIME,
)
Expand All @@ -290,7 +290,7 @@ func main() {
fmt.Println(ur.Errors)
// Standard output of our search, nothing new.
for _, v := range ur.Data.UserRates {
fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Name)
fmt.Println(v.Id, v.Text, v.Score, v.CreatedAt, v.Anime.Id, v.Anime.Name)
}
}
```

0 comments on commit b748f30

Please sign in to comment.