From 103a872be21c015e3b286c975c8c81431bf82193 Mon Sep 17 00:00:00 2001 From: Iron_Felix Date: Sat, 6 Dec 2025 09:53:02 +0300 Subject: [PATCH 1/2] fix --- modules/backend/handlers/users.go | 3 +++ sql/migrations/000001_init.up.sql | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/backend/handlers/users.go b/modules/backend/handlers/users.go index eecd82f..c0f0f55 100644 --- a/modules/backend/handlers/users.go +++ b/modules/backend/handlers/users.go @@ -386,6 +386,9 @@ func (s Server) AddUserTitle(ctx context.Context, request oapi.AddUserTitleReque // fmt.Println(pgErr.Code) // => 42601 if pgErr.Code == pgErrDuplicateKey { //duplicate key value return oapi.AddUserTitle409Response{}, nil + } else { + log.Errorf("%v", err) + return oapi.AddUserTitle500Response{}, nil } } else { log.Errorf("%v", err) diff --git a/sql/migrations/000001_init.up.sql b/sql/migrations/000001_init.up.sql index 415b9af..57aa238 100644 --- a/sql/migrations/000001_init.up.sql +++ b/sql/migrations/000001_init.up.sql @@ -86,7 +86,6 @@ CREATE TABLE usertitles ( status usertitle_status_t NOT NULL, rate int CHECK (rate > 0 AND rate <= 10), review_id bigint REFERENCES reviews (id) ON DELETE SET NULL, - ctime timestamptz NOT NULL DEFAULT now(), ftime timestamptz NOT NULL DEFAULT now() -- // TODO: series status ); From 541d0fce2704d39aa7ec7aea0987d3ac5d7af694 Mon Sep 17 00:00:00 2001 From: Iron_Felix Date: Sat, 6 Dec 2025 09:55:42 +0300 Subject: [PATCH 2/2] fix: ftime now set to now() if not received in backend --- modules/backend/handlers/users.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/backend/handlers/users.go b/modules/backend/handlers/users.go index 5bbffea..100835a 100644 --- a/modules/backend/handlers/users.go +++ b/modules/backend/handlers/users.go @@ -71,7 +71,10 @@ func sqlDate2oapi(p_date pgtype.Timestamptz) *time.Time { func oapiDate2sql(t *time.Time) pgtype.Timestamptz { if t == nil { - return pgtype.Timestamptz{Valid: false} + return pgtype.Timestamptz{ + Time: time.Now(), + Valid: true, + } } return pgtype.Timestamptz{ Time: *t,