From ae1c9473fc98efaa9fc4565ccbad8b7d724581e1 Mon Sep 17 00:00:00 2001 From: AzenKain Date: Thu, 16 Apr 2026 10:19:17 +0700 Subject: [PATCH] UPDATE: fix bug --- assets/resources/historian_approved.html | 4 ++-- assets/resources/historian_rejected.html | 6 +++--- db/migrations/000001_users.up.sql | 1 + db/migrations/000004_files.up.sql | 2 +- db/schema.sql | 2 +- docs/docs.go | 2 ++ docs/swagger.json | 2 ++ docs/swagger.yaml | 2 ++ pkg/constants/status.go | 4 ++-- 9 files changed, 16 insertions(+), 9 deletions(-) diff --git a/assets/resources/historian_approved.html b/assets/resources/historian_approved.html index 356164f..a6d213a 100644 --- a/assets/resources/historian_approved.html +++ b/assets/resources/historian_approved.html @@ -31,7 +31,7 @@ - Hello {{name}}, + Hello {{NAME}}, @@ -45,7 +45,7 @@ - Hello {{name}}, + Hello {{NAME}}, @@ -25,14 +25,14 @@ rejected.

Reason:
- {{reason}} + {{REASON}}

You can update your information and reapply anytime. -
+ Reapply diff --git a/db/migrations/000001_users.up.sql b/db/migrations/000001_users.up.sql index 278b617..2f74ed5 100644 --- a/db/migrations/000001_users.up.sql +++ b/db/migrations/000001_users.up.sql @@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS users ( updated_at TIMESTAMPTZ DEFAULT now() ); +ALTER TABLE users DROP CONSTRAINT IF EXISTS check_auth_provider; ALTER TABLE users ADD CONSTRAINT check_auth_provider CHECK (auth_provider IN ('local', 'google', 'facebook', 'github')); diff --git a/db/migrations/000004_files.up.sql b/db/migrations/000004_files.up.sql index e08dc34..22da306 100644 --- a/db/migrations/000004_files.up.sql +++ b/db/migrations/000004_files.up.sql @@ -1,6 +1,6 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm; -CREATE TABLE medias ( +CREATE TABLE IF NOT EXISTS medias ( id UUID PRIMARY KEY DEFAULT uuidv7(), user_id UUID REFERENCES users(id) ON DELETE CASCADE, storage_key VARCHAR(255) UNIQUE NOT NULL, diff --git a/db/schema.sql b/db/schema.sql index 32638ab..f604503 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS user_roles ( PRIMARY KEY (user_id, role_id) ); -CREATE TABLE medias ( +CREATE TABLE IF NOT EXISTS medias ( id UUID PRIMARY KEY DEFAULT uuidv7(), user_id UUID REFERENCES users(id) ON DELETE CASCADE, storage_key VARCHAR(255) UNIQUE NOT NULL, diff --git a/docs/docs.go b/docs/docs.go index 8aa3a78..4f68cc2 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2229,6 +2229,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": {}, + "errors": {}, "message": { "type": "string" }, @@ -2241,6 +2242,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": {}, + "errors": {}, "message": { "type": "string" }, diff --git a/docs/swagger.json b/docs/swagger.json index d9cdea4..29b1626 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2222,6 +2222,7 @@ "type": "object", "properties": { "data": {}, + "errors": {}, "message": { "type": "string" }, @@ -2234,6 +2235,7 @@ "type": "object", "properties": { "data": {}, + "errors": {}, "message": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 6eaa1d1..0646476 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -197,6 +197,7 @@ definitions: history-api_internal_dtos_response.CommonResponse: properties: data: {} + errors: {} message: type: string status: @@ -205,6 +206,7 @@ definitions: history-api_internal_dtos_response.PaginatedResponse: properties: data: {} + errors: {} message: type: string pagination: diff --git a/pkg/constants/status.go b/pkg/constants/status.go index da47b80..a6db104 100644 --- a/pkg/constants/status.go +++ b/pkg/constants/status.go @@ -16,7 +16,7 @@ func (t StatusType) String() string { case StatusApproved: return "APPROVED" case StatusRejected: - return "REJECT" + return "REJECTED" default: return "UNKNOWN" } @@ -45,7 +45,7 @@ func ParseStatusTypeText(v string) StatusType { return StatusPending case "APPROVED": return StatusApproved - case "REJECT": + case "REJECTED": return StatusRejected default: return StatusUnknown