fix
This commit is contained in:
parent
148ae646b1
commit
8371121130
2 changed files with 13 additions and 6 deletions
|
|
@ -117,6 +117,9 @@ func (s Server) GetStudio(ctx context.Context, id int64) (*oapi.Studio, error) {
|
||||||
oapi_studio.Name = sqlc_studio.StudioName
|
oapi_studio.Name = sqlc_studio.StudioName
|
||||||
oapi_studio.Description = sqlc_studio.StudioDesc
|
oapi_studio.Description = sqlc_studio.StudioDesc
|
||||||
|
|
||||||
|
if sqlc_studio.IllustID == nil {
|
||||||
|
return &oapi_studio, nil
|
||||||
|
}
|
||||||
oapi_illust, err := s.GetImage(ctx, *sqlc_studio.IllustID)
|
oapi_illust, err := s.GetImage(ctx, *sqlc_studio.IllustID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &oapi_studio, fmt.Errorf("GetImage: %v", err)
|
return &oapi_studio, fmt.Errorf("GetImage: %v", err)
|
||||||
|
|
@ -152,12 +155,14 @@ func (s Server) mapTitle(ctx context.Context, title sqlc.Title) (oapi.Title, err
|
||||||
oapi_title.Tags = oapi_tag_names
|
oapi_title.Tags = oapi_tag_names
|
||||||
}
|
}
|
||||||
|
|
||||||
oapi_image, err := s.GetImage(ctx, *title.PosterID)
|
if title.PosterID != nil {
|
||||||
if err != nil {
|
oapi_image, err := s.GetImage(ctx, *title.PosterID)
|
||||||
return oapi_title, fmt.Errorf("GetImage: %v", err)
|
if err != nil {
|
||||||
}
|
return oapi_title, fmt.Errorf("GetImage: %v", err)
|
||||||
if oapi_image != nil {
|
}
|
||||||
oapi_title.Poster = oapi_image
|
if oapi_image != nil {
|
||||||
|
oapi_title.Poster = oapi_image
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oapi_studio, err := s.GetStudio(ctx, title.StudioID)
|
oapi_studio, err := s.GetStudio(ctx, title.StudioID)
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ CREATE TABLE studios (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE titles (
|
CREATE TABLE titles (
|
||||||
|
// TODO: anime type (film, season etc)
|
||||||
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
-- example {"ru": ["Атака титанов", "Атака Титанов"],"en": ["Attack on Titan", "AoT"],"ja": ["進撃の巨人", "しんげきのきょじん"]}
|
-- example {"ru": ["Атака титанов", "Атака Титанов"],"en": ["Attack on Titan", "AoT"],"ja": ["進撃の巨人", "しんげきのきょじん"]}
|
||||||
title_names jsonb NOT NULL,
|
title_names jsonb NOT NULL,
|
||||||
|
|
@ -88,6 +89,7 @@ CREATE TABLE usertitles (
|
||||||
rate int CHECK (rate > 0 AND rate <= 10),
|
rate int CHECK (rate > 0 AND rate <= 10),
|
||||||
review_text text,
|
review_text text,
|
||||||
review_date timestamptz
|
review_date timestamptz
|
||||||
|
// TODO: series status
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE title_tags (
|
CREATE TABLE title_tags (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue