more fixes and update of translations database

This commit is contained in:
Daniel Goc
2026-03-11 15:24:00 +01:00
parent 4450468145
commit 6f00e7f784
11 changed files with 287 additions and 289 deletions

View File

@@ -49,7 +49,7 @@ const (
// TableName specifies the table name for User model
func (Customer) TableName() string {
return "customers"
return "b2b_customers"
}
// IsAdmin checks if the user has admin role
@@ -140,5 +140,5 @@ type RefreshToken struct {
// TableName specifies the table name for RefreshToken model
func (RefreshToken) TableName() string {
return "refresh_tokens"
return "b2b_refresh_tokens"
}

View File

@@ -25,7 +25,7 @@ type Translation struct {
}
func (Translation) TableName() string {
return "translations"
return "b2b_translations"
}
type Language struct {
@@ -45,7 +45,7 @@ type Language struct {
}
func (Language) TableName() string {
return "language"
return "b2b_language"
}
type Component struct {
@@ -54,7 +54,7 @@ type Component struct {
}
func (Component) TableName() string {
return "components"
return "b2b_components"
}
type Scope struct {
@@ -63,5 +63,5 @@ type Scope struct {
}
func (Scope) TableName() string {
return "scopes"
return "b2b_scopes"
}

1
go.mod
View File

@@ -11,7 +11,6 @@ require (
github.com/joho/godotenv v1.5.1
golang.org/x/crypto v0.48.0
golang.org/x/oauth2 v0.36.0
gorm.io/driver/postgres v1.6.0
gorm.io/gorm v1.31.1
)

2
go.sum
View File

@@ -172,7 +172,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=

View File

@@ -1,6 +1,6 @@
# Database configuration (shared between Vue and Go extractors)
database:
type: postgres # "mysql" (default),sqlite or "postgres"
type: mysql # "mysql" (default),sqlite or "postgres"
host: localhost
port: 5432
user: gitea

View File

@@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS b2b_translations (
-- customers
CREATE TABLE IF NOT EXISTS b2b_customers (
id INT AUTO_INCREMENT PRIMARY KEY,
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NULL,
first_name VARCHAR(100) NULL,
@@ -101,7 +101,7 @@ ON b2b_customers (deleted_at);
-- refresh_tokens
CREATE TABLE IF NOT EXISTS b2b_refresh_tokens (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT NOT NULL,
customer_id BIGINT UNSIGNED NOT NULL,
token_hash VARCHAR(64) NOT NULL,
expires_at DATETIME(6) NOT NULL,
created_at DATETIME(6) NOT NULL,
@@ -116,6 +116,7 @@ CREATE INDEX IF NOT EXISTS idx_refresh_tokens_customer_id ON b2b_refresh_tokens
INSERT IGNORE INTO b2b_customers (id, email, password, first_name, last_name, role, provider, provider_id, avatar_url, is_active, email_verified, email_verification_token, email_verification_expires, password_reset_token, password_reset_expires, last_password_reset_request, last_login_at, lang, created_at, updated_at, deleted_at)
VALUES
(1, 'admin@ma-al.com', '$2a$10$Owy9DjrS0l3Fz4XoOvh5pulgmOMqdwXmb7hYE9BovnSuWS2plGr82', 'Super', 'Admin', 'admin', 'local', '', '', 1, 1, NULL, NULL, '', NULL, NULL, NULL, 'pl', '2026-03-02 16:55:10.252740', '2026-03-02 16:55:10.252740', NULL);
ALTER TABLE b2b_customers AUTO_INCREMENT = 1;
-- +goose Down

View File

@@ -2,7 +2,7 @@
-- Dump translations from database
-- Components
INSERT IGNORE INTO b2b_components (id, name) VALUES
INSERT IGNORE b2b_components (id, name) VALUES
(1, 'be'),
(2, 'login'),
(3, 'verify_email'),
@@ -16,20 +16,18 @@ INSERT IGNORE INTO b2b_components (id, name) VALUES
(303, 'verify_email');
-- Scope
INSERT IGNORE INTO b2b_scopes (id, name) VALUES
(3, 'backoffice');
INSERT IGNORE b2b_scopes (id, name) VALUES (3, 'backoffice');
-- Translations
-- Component: general
INSERT IGNORE INTO b2b_translations
(lang_id, scope_id, component_id, `key`, data)
VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 3, 300, 'already_have_an_account', 'Masz już konto?'),
(1, 3, 300, 'and', 'i'),
(1, 3, 300, 'back_to_sign_in', 'Powrót do logowania'),
(1, 3, 300, 'by_signing_in_you_agree_to_our', 'Logując się, zgadzasz się z naszymi'),
(1, 3, 300, 'check_your_email', 'Sprawdź swoją skrzynkę e-mail'),
(1, 3, 300, 'close', 'zamknij'),
(1, 3, 300, 'confirm_password', 'Potwierdź hasło'),
(1, 3, 300, 'confirm_your_new_password', 'Potwierdź swoje nowe hasło'),
(1, 3, 300, 'confirm_your_password', 'Potwierdź swoje hasło'),
@@ -46,7 +44,9 @@ VALUES
(1, 3, 300, 'forgot_password', 'Zapomniałeś hasła'),
(1, 3, 300, 'i_agree_to_the', 'Zgadzam się z'),
(1, 3, 300, 'last_name', 'Nazwisko'),
(1, 3, 300, 'logout', 'Wyloguj się'),
(1, 3, 300, 'new_password', 'Nowe hasło'),
(1, 3, 300, 'or', 'albo'),
(1, 3, 300, 'password', 'Hasło'),
(1, 3, 300, 'password_reset_link_sent_notice', 'Jeśli konto z tym adresem e-mail istnieje, wysłaliśmy link do resetowania hasła. Sprawdź swoją skrzynkę odbiorczą'),
(1, 3, 300, 'password_updated', 'Hasło zaktualizowane'),
@@ -61,6 +61,7 @@ VALUES
(2, 3, 300, 'back_to_sign_in', 'Back to Sign In'),
(2, 3, 300, 'by_signing_in_you_agree_to_our', 'By signing in, you agree to our terms'),
(2, 3, 300, 'check_your_email', 'Check your email'),
(2, 3, 300, 'close', 'close'),
(2, 3, 300, 'confirm_password', 'Confirm password'),
(2, 3, 300, 'confirm_your_new_password', 'Confirm your new password'),
(2, 3, 300, 'confirm_your_password', 'Confirm your password'),
@@ -77,7 +78,9 @@ VALUES
(2, 3, 300, 'forgot_password', 'Forgot password'),
(2, 3, 300, 'i_agree_to_the', 'I agree to the'),
(2, 3, 300, 'last_name', 'Last name'),
(2, 3, 300, 'logout', 'Logout'),
(2, 3, 300, 'new_password', 'New password'),
(2, 3, 300, 'or', 'or'),
(2, 3, 300, 'password', 'Password'),
(2, 3, 300, 'password_reset_link_sent_notice', 'If an account with that email exists, we have sent a password reset link. Please check your inbox.'),
(2, 3, 300, 'password_updated', 'Password updated'),
@@ -92,6 +95,7 @@ VALUES
(3, 3, 300, 'back_to_sign_in', 'Zpět k přihlášení'),
(3, 3, 300, 'by_signing_in_you_agree_to_our', 'Přihlášením souhlasíte s našimi'),
(3, 3, 300, 'check_your_email', 'Zkontrolujte svůj e-mail'),
(3, 3, 300, 'close', 'zavřít'),
(3, 3, 300, 'confirm_password', 'Potvrzení hesla'),
(3, 3, 300, 'confirm_your_new_password', 'Potvrďte své nové heslo'),
(3, 3, 300, 'confirm_your_password', 'Potvrďte své heslo'),
@@ -108,7 +112,9 @@ VALUES
(3, 3, 300, 'forgot_password', 'Zapomněli jste heslo'),
(3, 3, 300, 'i_agree_to_the', 'Souhlasím s'),
(3, 3, 300, 'last_name', 'Příjmení'),
(3, 3, 300, 'logout', 'Odhlásit se'),
(3, 3, 300, 'new_password', 'Nové heslo'),
(3, 3, 300, 'or', 'nebo'),
(3, 3, 300, 'password', 'Heslo'),
(3, 3, 300, 'password_reset_link_sent_notice', 'Pokud účet s touto e-mailovou adresou existuje, poslali jsme odkaz pro obnovení hesla. Zkontrolujte svůj inbox.'),
(3, 3, 300, 'password_updated', 'Heslo aktualizováno'),
@@ -120,9 +126,7 @@ VALUES
(3, 3, 300, 'terms_of_service', 'Podmínky služby');
-- Component: validate_error
INSERT IGNORE INTO b2b_translations
(lang_id, scope_id, component_id, `key`, data)
VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 3, 301, 'confirm_password_required', 'Potwierdź hasło'),
(1, 3, 301, 'email_required', 'Adres e-mail jest wymagany'),
(1, 3, 301, 'first_name_required', 'Imię jest wymagane'),
@@ -149,9 +153,7 @@ VALUES
(3, 3, 301, 'registration_validation_password_requirements', 'Požadavky na heslo při registraci');
-- Component: repo_chart
INSERT IGNORE INTO b2b_translations
(lang_id, scope_id, component_id, `key`, data)
VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 3, 302, 'all_quarters', 'Wszystkie kwartały'),
(1, 3, 302, 'created_on', 'Utworzono'),
(1, 3, 302, 'failed_to_load_issues', 'Nie udało się załadować zadań'),
@@ -230,10 +232,9 @@ VALUES
(3, 3, 302, 'work_by_quarter', 'Práce dokončená po čtvrtletích (hodiny)'),
(3, 3, 302, 'work_done_by_quarter', 'práce provedená za čtvrtletí'),
(3, 3, 302, 'year', 'Rok');
-- Component: verify_email
INSERT IGNORE INTO b2b_translations
(lang_id, scope_id, component_id, `key`, data)
VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 3, 303, 'already_registered', 'Masz już konto?'),
(1, 3, 303, 'error_message', 'Nie udało nam się zweryfikować Twojego adresu e-mail.'),
(1, 3, 303, 'error_title', 'Weryfikacja nie powiodła się'),
@@ -245,7 +246,7 @@ VALUES
(1, 3, 303, 'success_title', 'E-mail zweryfikowany!'),
(1, 3, 303, 'verification_failed', 'Weryfikacja e-maila nie powiodła się'),
(1, 3, 303, 'verifying', 'Sprawdzanie Twojego adresu e-mail...'),
(2, 3, 303, 'already_registered', 'already registered?'),
(2, 3, 303, 'already_registered', 'Already have an account?'),
(2, 3, 303, 'error_message', 'We could not verify your email.'),
(2, 3, 303, 'error_title', 'Verification Failed'),
(2, 3, 303, 'go_to_login', 'Go to Login'),
@@ -270,4 +271,4 @@ VALUES
-- +goose Down
-- Remove translations for this scope
DELETE FROM translations WHERE scope_id = 3;
DELETE FROM b2b_translations WHERE scope_id = 3;

View File

@@ -2,7 +2,7 @@
-- Dump translations from database
-- Components
INSERT IGNORE INTO b2b_components (id, name) VALUES
INSERT IGNORE b2b_components (id, name) VALUES
(1, 'be'),
(2, 'login'),
(3, 'verify_email'),
@@ -16,13 +16,12 @@ INSERT IGNORE INTO b2b_components (id, name) VALUES
(303, 'verify_email');
-- Scope
INSERT IGNORE INTO b2b_scopes (id, name) VALUES
(1, 'Backend');
INSERT IGNORE b2b_scopes (id, name) VALUES (1, 'Backend');
-- Translations
-- Component: be
INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 1, 1, 'langs_loaded', NULL),
(1, 1, 1, 'langs_not_loaded', NULL),
(1, 1, 1, 'message_nok', NULL),
@@ -43,7 +42,7 @@ INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, dat
(3, 1, 1, 'translations_not_loaded', NULL);
-- Component: email
INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 1, 100, 'langs_loaded', NULL),
(1, 1, 100, 'langs_not_loaded', NULL),
(1, 1, 100, 'message_nok', NULL),
@@ -64,7 +63,7 @@ INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, dat
(3, 1, 100, 'translations_not_loaded', NULL);
-- Component: error
INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 1, 101, 'err_bad_paging', 'zła paginacja'),
(1, 1, 101, 'err_bad_quarter_attribute', 'nieprawidłowy atrybut quarter'),
(1, 1, 101, 'err_bad_repo_id_attribute', 'nieprawidłowy atrybut repoID'),
@@ -148,7 +147,7 @@ INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, dat
(3, 1, 101, 'err_verification_token_expired', 'platnost ověřovacího tokenu vypršela');
-- Component: auth
INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 1, 102, 'auth_if_account_exists', 'jeśli konto o tym adresie e-mail istnieje, został wysłany link do resetowania hasła'),
(1, 1, 102, 'auth_logged_out_successfully', 'wylogowano pomyślnie'),
(1, 1, 102, 'auth_password_reset_successfully', 'pomyślnie zresetowano hasło'),
@@ -163,7 +162,7 @@ INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, dat
(3, 1, 102, 'auth_registration_successful', 'Registrace úspěšná, prosím ověřte svůj e-mail');
-- Component: email
INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
INSERT IGNORE b2b_translations (lang_id, scope_id, component_id, `key`, data) VALUES
(1, 1, 103, 'email_admin_notification_title', 'Admin notification title'),
(1, 1, 103, 'email_footer', 'Wszelkie prawa zastrzeżone.'),
(1, 1, 103, 'email_greeting', 'Witaj,'),
@@ -217,5 +216,5 @@ INSERT IGNORE INTO b2b_translations (lang_id, scope_id, component_id, `key`, dat
(3, 1, 103, 'email_warning_title', 'Důležité:');
-- +goose Down
-- Remove translations for this scope
DELETE FROM translations WHERE scope_id = 1;
-- Remove b2b_translations for this scope
DELETE FROM b2b_translations WHERE scope_id = 1;

View File

@@ -1 +1 @@
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1

BIN
tmp/main

Binary file not shown.