Compare commits

...

5 commits

Author SHA1 Message Date
148ae646b1 feat
All checks were successful
Build and Deploy Go App / build (push) Successful in 17m38s
Build and Deploy Go App / deploy (push) Successful in 3m33s
2025-11-17 09:39:26 +03:00
76d28d0170 Merge branch 'dev-ars' into dev
Some checks failed
Build and Deploy Go App / build (push) Has been cancelled
Build and Deploy Go App / deploy (push) Has been cancelled
2025-11-17 09:27:32 +03:00
fe54b61822 Merge branch 'dev-ars' into dev
All checks were successful
Build and Deploy Go App / build (push) Successful in 17m29s
Build and Deploy Go App / deploy (push) Successful in 3m26s
2025-11-16 04:52:52 +03:00
96611825bc Merge branch 'dev-ars' into dev
All checks were successful
Build and Deploy Go App / build (push) Successful in 18m14s
Build and Deploy Go App / deploy (push) Successful in 3m34s
2025-11-16 03:45:06 +03:00
f49fad2307 fix: tmp commeneted method
All checks were successful
Build and Deploy Go App / build (push) Successful in 18m15s
Build and Deploy Go App / deploy (push) Successful in 4m50s
2025-11-15 03:01:38 +03:00

View file

@ -2,12 +2,12 @@ package handlers
import ( import (
"context" "context"
"database/sql"
"encoding/json" "encoding/json"
"fmt" "fmt"
oapi "nyanimedb/api" oapi "nyanimedb/api"
sqlc "nyanimedb/sql" sqlc "nyanimedb/sql"
"github.com/jackc/pgx/v5"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -61,7 +61,7 @@ func (s Server) GetTagsByTitleId(ctx context.Context, id int64) (oapi.Tags, erro
sqlc_title_tags, err := s.db.GetTitleTags(ctx, id) sqlc_title_tags, err := s.db.GetTitleTags(ctx, id)
if err != nil { if err != nil {
if err == sql.ErrNoRows { if err == pgx.ErrNoRows {
return nil, nil return nil, nil
} }
return nil, fmt.Errorf("query GetTitleTags: %v", err) return nil, fmt.Errorf("query GetTitleTags: %v", err)
@ -82,14 +82,14 @@ func (s Server) GetTagsByTitleId(ctx context.Context, id int64) (oapi.Tags, erro
func (s Server) GetImage(ctx context.Context, id int64) (*oapi.Image, error) { func (s Server) GetImage(ctx context.Context, id int64) (*oapi.Image, error) {
var oapi_image *oapi.Image var oapi_image oapi.Image
sqlc_image, err := s.db.GetImageByID(ctx, id) sqlc_image, err := s.db.GetImageByID(ctx, id)
if err != nil { if err != nil {
if err == sql.ErrNoRows { if err == pgx.ErrNoRows {
return nil, nil return nil, 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 fields required in image table //can cast and dont use brain cause all this fields required in image table
@ -98,7 +98,7 @@ func (s Server) GetImage(ctx context.Context, id int64) (*oapi.Image, error) {
storageTypeStr := string(sqlc_image.StorageType) storageTypeStr := string(sqlc_image.StorageType)
oapi_image.StorageType = &storageTypeStr oapi_image.StorageType = &storageTypeStr
return oapi_image, nil return &oapi_image, nil
} }
func (s Server) GetStudio(ctx context.Context, id int64) (*oapi.Studio, error) { func (s Server) GetStudio(ctx context.Context, id int64) (*oapi.Studio, error) {
@ -107,7 +107,7 @@ func (s Server) GetStudio(ctx context.Context, id int64) (*oapi.Studio, error) {
sqlc_studio, err := s.db.GetStudioByID(ctx, id) sqlc_studio, err := s.db.GetStudioByID(ctx, id)
if err != nil { if err != nil {
if err == sql.ErrNoRows { if err == pgx.ErrNoRows {
return nil, nil return nil, nil
} }
return &oapi_studio, fmt.Errorf("query GetStudioByID: %v", err) return &oapi_studio, fmt.Errorf("query GetStudioByID: %v", err)
@ -195,7 +195,7 @@ func (s Server) GetTitleTitleId(ctx context.Context, request oapi.GetTitleTitleI
sqlc_title, err := s.db.GetTitleByID(ctx, request.TitleId) sqlc_title, err := s.db.GetTitleByID(ctx, request.TitleId)
if err != nil { if err != nil {
if err == sql.ErrNoRows { if err == pgx.ErrNoRows {
return oapi.GetTitleTitleId204Response{}, nil return oapi.GetTitleTitleId204Response{}, nil
} }
log.Errorf("%v", err) log.Errorf("%v", err)