fix:
This commit is contained in:
parent
29f0a61299
commit
b81cc86beb
1 changed files with 24 additions and 16 deletions
|
|
@ -90,10 +90,12 @@ func (s Server) GetImage(ctx context.Context, id int64) (oapi.Image, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return oapi_image, fmt.Errorf("query GetImageByID: %v", err)
|
return oapi_image, fmt.Errorf("query GetImageByID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
//can cast and dont use brain cause all this fiels required
|
//can cast and dont use brain cause all this fiels required
|
||||||
oapi_image.Id = &sqlc_image.ID
|
oapi_image.Id = &sqlc_image.ID
|
||||||
oapi_image.ImagePath = &sqlc_image.ImagePath
|
oapi_image.ImagePath = &sqlc_image.ImagePath
|
||||||
oapi_image.StorageType = (*string)(&sqlc_image.StorageType)
|
storageTypeStr := string(sqlc_image.StorageType) // или fmt.Sprint(...), если int
|
||||||
|
oapi_image.StorageType = &storageTypeStr
|
||||||
|
|
||||||
return oapi_image, nil
|
return oapi_image, nil
|
||||||
}
|
}
|
||||||
|
|
@ -150,22 +152,28 @@ func (s Server) mapTitle(ctx context.Context, title sqlc.Title) (oapi.Title, err
|
||||||
return oapi_title, fmt.Errorf("GetStudio: %v", err)
|
return oapi_title, fmt.Errorf("GetStudio: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
oapi_title = oapi.Title{
|
if title.ReleaseSeason != nil {
|
||||||
|
rs := oapi.ReleaseSeason(*title.ReleaseSeason)
|
||||||
Id: title.ID,
|
oapi_title.ReleaseSeason = &rs
|
||||||
Poster: &oapi_image,
|
} else {
|
||||||
Rating: title.Rating,
|
oapi_title.ReleaseSeason = nil
|
||||||
RatingCount: title.RatingCount,
|
|
||||||
ReleaseSeason: (*oapi.ReleaseSeason)(title.ReleaseSeason),
|
|
||||||
ReleaseYear: title.ReleaseYear,
|
|
||||||
Studio: &oapi_studio,
|
|
||||||
Tags: oapi_tag_names,
|
|
||||||
TitleNames: title_names,
|
|
||||||
TitleStatus: (*oapi.TitleStatus)(&title.TitleStatus),
|
|
||||||
EpisodesAired: title.EpisodesAired,
|
|
||||||
EpisodesAll: title.EpisodesAll,
|
|
||||||
EpisodesLen: &episodes_lens,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ts := oapi.TitleStatus(title.TitleStatus)
|
||||||
|
oapi_title.TitleStatus = &ts
|
||||||
|
|
||||||
|
oapi_title.Id = title.ID
|
||||||
|
oapi_title.Poster = &oapi_image
|
||||||
|
oapi_title.Rating = title.Rating
|
||||||
|
oapi_title.RatingCount = title.RatingCount
|
||||||
|
oapi_title.ReleaseYear = title.ReleaseYear
|
||||||
|
oapi_title.Studio = &oapi_studio
|
||||||
|
oapi_title.Tags = oapi_tag_names
|
||||||
|
oapi_title.TitleNames = title_names
|
||||||
|
oapi_title.EpisodesAired = title.EpisodesAired
|
||||||
|
oapi_title.EpisodesAll = title.EpisodesAll
|
||||||
|
oapi_title.EpisodesLen = &episodes_lens
|
||||||
|
|
||||||
return oapi_title, nil
|
return oapi_title, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue