feat:
This commit is contained in:
parent
9f74c9eeb6
commit
4c7d03cddc
7 changed files with 28 additions and 6 deletions
|
|
@ -412,6 +412,10 @@ components:
|
|||
format: int64
|
||||
storage_type:
|
||||
type: string
|
||||
description: Image storage type
|
||||
enum:
|
||||
- s3
|
||||
- local
|
||||
image_path:
|
||||
type: string
|
||||
TitleStatus:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ import (
|
|||
openapi_types "github.com/oapi-codegen/runtime/types"
|
||||
)
|
||||
|
||||
// Defines values for ImageStorageType.
|
||||
const (
|
||||
Local ImageStorageType = "local"
|
||||
S3 ImageStorageType = "s3"
|
||||
)
|
||||
|
||||
// Defines values for ReleaseSeason.
|
||||
const (
|
||||
Fall ReleaseSeason = "fall"
|
||||
|
|
@ -57,9 +63,14 @@ type CursorObj struct {
|
|||
type Image struct {
|
||||
Id *int64 `json:"id,omitempty"`
|
||||
ImagePath *string `json:"image_path,omitempty"`
|
||||
StorageType *string `json:"storage_type,omitempty"`
|
||||
|
||||
// StorageType Image storage type
|
||||
StorageType *ImageStorageType `json:"storage_type,omitempty"`
|
||||
}
|
||||
|
||||
// ImageStorageType Image storage type
|
||||
type ImageStorageType string
|
||||
|
||||
// ReleaseSeason Title release season
|
||||
type ReleaseSeason string
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ properties:
|
|||
type: integer
|
||||
format: int64
|
||||
storage_type:
|
||||
type: string
|
||||
$ref: './enums/StorageType.yaml'
|
||||
image_path:
|
||||
type: string
|
||||
|
|
|
|||
5
api/schemas/enums/StorageType.yaml
Normal file
5
api/schemas/enums/StorageType.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type: string
|
||||
description: Image storage type
|
||||
enum:
|
||||
- s3
|
||||
- local
|
||||
|
|
@ -141,7 +141,7 @@ func UserTitleStatus2Sqlc1(s *oapi.UserTitleStatus) (*sqlc.UsertitleStatusT, err
|
|||
case oapi.UserTitleStatusPlanned:
|
||||
sqlc_status = sqlc.UsertitleStatusTPlanned
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected tittle status: %s", s)
|
||||
return nil, fmt.Errorf("unexpected tittle status: %s", *s)
|
||||
}
|
||||
|
||||
return &sqlc_status, nil
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ WHERE
|
|||
sqlc.narg('usertitle_statuses')::usertitle_status_t[] IS NULL
|
||||
OR array_length(sqlc.narg('usertitle_statuses')::usertitle_status_t[], 1) IS NULL
|
||||
OR array_length(sqlc.narg('usertitle_statuses')::usertitle_status_t[], 1) = 0
|
||||
OR t.title_status = ANY(sqlc.narg('usertitle_statuses')::usertitle_status_t[])
|
||||
OR u.status = ANY(sqlc.narg('usertitle_statuses')::usertitle_status_t[])
|
||||
)
|
||||
AND (sqlc.narg('rate')::int IS NULL OR u.rate >= sqlc.narg('rate')::int)
|
||||
AND (sqlc.narg('rating')::float IS NULL OR t.rating >= sqlc.narg('rating')::float)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ sql:
|
|||
emit_pointers_for_null_types: true
|
||||
emit_empty_slices: true #slices returned by :many queries will be empty instead of nil
|
||||
overrides:
|
||||
- column: "titles.title_storage_type"
|
||||
go_type: "*string"
|
||||
- db_type: "jsonb"
|
||||
go_type: "encoding/json.RawMessage"
|
||||
- db_type: "uuid"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue