From 62aaa2316485976521cd8757479f612f138f2c14 Mon Sep 17 00:00:00 2001 From: Marek Goc Date: Tue, 24 Mar 2026 13:09:12 +0100 Subject: [PATCH] update openapi --- .env_example | 59 +++++++++++++++++++ app/model/countries.go | 13 ++++ app/repos/categoriesRepo/categoriesRepo.go | 22 +++++-- .../localeSelectorRepo/localeSelectorRepo.go | 6 +- 4 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 .env_example diff --git a/.env_example b/.env_example new file mode 100644 index 0000000..6dcd355 --- /dev/null +++ b/.env_example @@ -0,0 +1,59 @@ +SERVER_PORT=3000 +SERVER_HOST=0.0.0.0 + +# Database Configuration +DB_HOST=localhost +DB_PORT=3306 +DB_USER=root +DB_PASSWORD=Maal12345678 +DB_NAME=nalu +PROJECT_NAME=nalu_b2b +DB_SERVICE_NAME=nalu_b2b +DB_SSLMODE=disable + +# App COnfig +APP_NAME="B2b Management System" +APP_VERSION=2.1.0 +APP_ENVIRONMENT=development + +# JWT Configuration +AUTH_JWT_SECRET=5c020e6ed3d8d6e67e5804d67c83c4bd5ae474df749af6d63d8f20e7e2ba29b3 +AUTH_JWT_EXPIRATION=86400 +AUTH_REFRESH_EXPIRATION=604800 + +# Meili search +MEILISEARCH_URL=http://localhost:7700 +MEILISEARCH_API_KEY=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + +# OpenAI +OPENAI_KEY=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 + +# Google Translate Client +GOOGLE_APPLICATION_CREDENTIALS=./google-cred.json +GOOGLE_CLOUD_PROJECT_ID=translation-343517 + +# Google OAuth2 +OAUTH_GOOGLE_CLIENT_ID=331979954218-9vrpe08oqhhcgj6bvu6d4lds0dt630m9.apps.googleusercontent.com +OAUTH_GOOGLE_CLIENT_SECRET=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 +OAUTH_GOOGLE_REDIRECT_URL=http://localhost:3000/api/v1/public/auth/google/callback + +# Email Configuration (SMTP) +# Set EMAIL_ENABLED=true to require email verification +EMAIL_ENABLED=true +EMAIL_SMTP_HOST=mail.ma-al.com +EMAIL_SMTP_PORT=587 +EMAIL_SMTP_USER=test@ma-al.com +EMAIL_SMTP_PASSWORD=maal12345678 +EMAIL_FROM=test@ma-al.com +EMAIL_FROM_NAME=Gitea Manager +EMAIL_ADMIN=goc_marek@ma-al.pl + +I18N_LANGS=en,pl,cs + +PDF_SERVER_URL=http://localhost:8000 + + +FILE_MAAL_PL_USER=git_operator +FILE_MAAL_PL_PASSWORD=1FnwqcEgIUjQHjt1 + +IMAGE_PREFIX=https://www.naluconcept.com # remove prefix to serv them from same host as presta \ No newline at end of file diff --git a/app/model/countries.go b/app/model/countries.go index 61972d2..dccbe8b 100644 --- a/app/model/countries.go +++ b/app/model/countries.go @@ -9,3 +9,16 @@ type Country struct { CurrencyISOCode string `gorm:"column:iso_code" json:"currency_iso_code"` CurrencyName string `gorm:"column:name" json:"currency_name"` } + +func (Country) TableName() string { + return "b2b_countries" +} + +type PSCountry struct { + ID uint `gorm:"primaryKey;column:id_country" json:"id"` + CurrencyID uint `gorm:"column:id_currency" json:"currency_id"` +} + +func (PSCountry) TableName() string { + return "ps_country" +} diff --git a/app/repos/categoriesRepo/categoriesRepo.go b/app/repos/categoriesRepo/categoriesRepo.go index d420187..bc378c1 100644 --- a/app/repos/categoriesRepo/categoriesRepo.go +++ b/app/repos/categoriesRepo/categoriesRepo.go @@ -30,12 +30,22 @@ func (repo *CategoriesRepo) GetAllCategories(id_lang uint) ([]model.ScannedCateg ps_category.is_root_category AS is_root_category, ps_category_lang.link_rewrite AS link_rewrite, ps_lang.iso_code AS iso_code - FROM ps_category - LEFT JOIN ps_category_lang ON ps_category_lang.id_category = ps_category.id_category AND ps_category_lang.id_shop = ? AND ps_category_lang.id_lang = ? - LEFT JOIN ps_category_shop ON ps_category_shop.id_category = ps_category.id_category AND ps_category_shop.id_shop = ? - JOIN ps_lang ON ps_lang.id_lang = ps_category_lang.id_lang - `, - constdata.SHOP_ID, id_lang, constdata.SHOP_ID). + `). + Joins(` + LEFT JOIN ps_category_lang + ON ps_category_lang.id_category = ps_category.id_category + AND ps_category_lang.id_shop = ? + AND ps_category_lang.id_lang = ? + `, constdata.SHOP_ID, id_lang). + Joins(` + LEFT JOIN ps_category_shop + ON ps_category_shop.id_category = ps_category.id_category + AND ps_category_shop.id_shop = ? + `, constdata.SHOP_ID). + Joins(` + JOIN ps_lang + ON ps_lang.id_lang = ps_category_lang.id_lang + `). Scan(&allCategories).Error return allCategories, err diff --git a/app/repos/localeSelectorRepo/localeSelectorRepo.go b/app/repos/localeSelectorRepo/localeSelectorRepo.go index f08a57b..d52ef87 100644 --- a/app/repos/localeSelectorRepo/localeSelectorRepo.go +++ b/app/repos/localeSelectorRepo/localeSelectorRepo.go @@ -27,9 +27,9 @@ func (repo *LocaleSelectorRepo) GetLanguages() ([]model.Language, error) { func (repo *LocaleSelectorRepo) GetCountriesAndCurrencies() ([]model.Country, error) { var countries []model.Country - err := db.DB.Table("b2b_countries"). - Select("b2b_countries.id, b2b_countries.name, b2b_countries.flag, ps_currency.id as id_currency, ps_currency.name as currency_name, ps_currency.iso_code as currency_iso_code"). - Joins("JOIN ps_currency ON ps_currency.id = b2b_countries.currency"). + err := db.DB. + Select("b2b_countries.id, b2b_countries.name, b2b_countries.flag, ps_currency.id_currency as id_currency, ps_currency.name as currency_name, ps_currency.iso_code as currency_iso_code"). + Joins("JOIN ps_currency ON ps_currency.id_currency = b2b_countries.currency"). Scan(&countries).Error return countries, err