From f888ac9b70ae3514baa643fbbaa07c70b2de5e99 Mon Sep 17 00:00:00 2001 From: nihonium Date: Mon, 17 Nov 2025 02:41:45 +0300 Subject: [PATCH] review: review notes for titles.go --- modules/backend/handlers/titles.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/backend/handlers/titles.go b/modules/backend/handlers/titles.go index e5fcf18..6e3967a 100644 --- a/modules/backend/handlers/titles.go +++ b/modules/backend/handlers/titles.go @@ -11,6 +11,7 @@ import ( ) func Word2Sqlc(s *string) *string { + // TODO: merge two ifs if s == nil { return nil } @@ -69,6 +70,7 @@ func (s Server) GetTagsByTitleId(ctx context.Context, id int64) (oapi.Tags, erro return nil, fmt.Errorf("query GetTitleTags: %v", err) } + // TODO: check if underlying slice initialized as nil var oapi_tag_names oapi.Tags for _, title_tag := range sqlc_title_tags { var oapi_tag_name map[string]string @@ -91,6 +93,7 @@ func (s Server) GetImage(ctx context.Context, id int64) (oapi.Image, error) { return oapi_image, fmt.Errorf("query GetImageByID: %v", err) } + // TODO: clearer comment //can cast and dont use brain cause all this fiels required oapi_image.Id = &sqlc_image.ID oapi_image.ImagePath = &sqlc_image.ImagePath @@ -101,7 +104,7 @@ func (s Server) GetImage(ctx context.Context, id int64) (oapi.Image, error) { } func (s Server) GetStudio(ctx context.Context, id int64) (oapi.Studio, error) { - + // TODO: check all possibly nil fields var oapi_studio oapi.Studio sqlc_studio, err := s.db.GetStudioByID(ctx, id) @@ -123,6 +126,7 @@ func (s Server) GetStudio(ctx context.Context, id int64) (oapi.Studio, error) { } func (s Server) mapTitle(ctx context.Context, title sqlc.Title) (oapi.Title, error) { + // TODO: check all possibly nil fields var oapi_title oapi.Title var title_names map[string][]string