fix
This commit is contained in:
parent
8371121130
commit
8deba7afd9
4 changed files with 28 additions and 7 deletions
|
|
@ -757,4 +757,26 @@ components:
|
||||||
|
|
||||||
UserTitle:
|
UserTitle:
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- user_id
|
||||||
|
- title_id
|
||||||
|
- status
|
||||||
|
properties:
|
||||||
|
user_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
title_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
status:
|
||||||
|
$ref: '#components/schemas/UserTitleStatus'
|
||||||
|
rate:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
review_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
ctime:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ func (s Server) GetImage(ctx context.Context, id int64) (*oapi.Image, error) {
|
||||||
sqlc_image, err := s.db.GetImageByID(ctx, id)
|
sqlc_image, err := s.db.GetImageByID(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == pgx.ErrNoRows {
|
if err == pgx.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil //todo: error reference in db
|
||||||
}
|
}
|
||||||
return &oapi_image, fmt.Errorf("query GetImageByID: %v", err)
|
return &oapi_image, fmt.Errorf("query GetImageByID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +217,7 @@ func (s Server) GetTitleTitleId(ctx context.Context, request oapi.GetTitleTitleI
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Server) GetTitle(ctx context.Context, request oapi.GetTitleRequestObject) (oapi.GetTitleResponseObject, error) {
|
func (s Server) GetTitle(ctx context.Context, request oapi.GetTitleRequestObject) (oapi.GetTitleResponseObject, error) {
|
||||||
opai_titles := make([]oapi.Title, 1)
|
opai_titles := make([]oapi.Title, 0)
|
||||||
|
|
||||||
word := Word2Sqlc(request.Params.Word)
|
word := Word2Sqlc(request.Params.Word)
|
||||||
status, err := TitleStatus2Sqlc(request.Params.Status)
|
status, err := TitleStatus2Sqlc(request.Params.Status)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
-- name: GetImageByID :one
|
-- name: GetImageByID :one
|
||||||
SELECT id, storage_type, image_path
|
SELECT id, storage_type, image_path
|
||||||
FROM images
|
FROM images
|
||||||
WHERE id = sqlc.arg('illust_id');
|
WHERE id = sqlc.arg('illust_id')::bigint;
|
||||||
|
|
||||||
-- name: CreateImage :one
|
-- name: CreateImage :one
|
||||||
INSERT INTO images (storage_type, image_path)
|
INSERT INTO images (storage_type, image_path)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ CREATE TABLE reviews (
|
||||||
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
data text NOT NULL,
|
data text NOT NULL,
|
||||||
rating int CHECK (rating >= 0 AND rating <= 10),
|
rating int CHECK (rating >= 0 AND rating <= 10),
|
||||||
illust_id bigint REFERENCES images (id),
|
|
||||||
user_id bigint REFERENCES users (id),
|
user_id bigint REFERENCES users (id),
|
||||||
title_id bigint REFERENCES titles (id),
|
title_id bigint REFERENCES titles (id),
|
||||||
created_at timestamptz DEFAULT NOW()
|
created_at timestamptz DEFAULT NOW()
|
||||||
|
|
@ -87,9 +86,9 @@ CREATE TABLE usertitles (
|
||||||
title_id bigint NOT NULL REFERENCES titles (id),
|
title_id bigint NOT NULL REFERENCES titles (id),
|
||||||
status usertitle_status_t NOT NULL,
|
status usertitle_status_t NOT NULL,
|
||||||
rate int CHECK (rate > 0 AND rate <= 10),
|
rate int CHECK (rate > 0 AND rate <= 10),
|
||||||
review_text text,
|
review_id bigint NOT NULL REFERENCES reviews (id),
|
||||||
review_date timestamptz
|
ctime timestamptz
|
||||||
// TODO: series status
|
-- // TODO: series status
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE title_tags (
|
CREATE TABLE title_tags (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue