modified: begushiybashkir/bbvue/src/components/AvatarUpload.vue

modified:   begushiybashkir/bbvue/src/stores/auth.js
	modified:   serv_nginx/api_bb/.env
	modified:   serv_nginx/api_bb/internal/config/config.go
	modified:   serv_nginx/api_bb/internal/models/user.go
	modified:   serv_nginx/api_bb/internal/routes/routes.go
	modified:   serv_nginx/nginx/nginx-ssl.conf
some for get photo from api_bb
This commit is contained in:
2025-10-13 03:12:42 +05:00
parent b5ebe138cf
commit af9dc82c58
7 changed files with 237 additions and 210 deletions
+2 -1
View File
@@ -12,4 +12,5 @@ LOG_LEVEL=debug
ENVIRONMENT=development
# app
REST_API_VERSION=1.0.0
REST_API_VERSION=1.0.0
VITE_API_BASE_URL=https://begushiybashkir.ru
+4 -3
View File
@@ -12,16 +12,17 @@ type Config struct {
Port string
DatabaseURL string
JWTSecret string
StaticURL string `env:"STATIC_URL" envDefault:"http://localhost:8080"`
}
func Load() *Config {
_ = godotenv.Load(".env")
port := getEnv("PORT", "8080")
jwtSecret := getEnv("JWT_SECRET", "your-secret-key")
// Формируем DSN для PostgreSQL из переменных окружения
databaseURL := getPostgresDSN()
return &Config{
Port: port,
DatabaseURL: databaseURL,
@@ -47,4 +48,4 @@ func getEnv(key, defaultValue string) string {
return defaultValue
}
return value
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ type UserUpdate struct {
ID uint `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Avatar string `json:"avatar"` // Добавить поле аватара
Avatar string `json:"avatar"`
Phone string `json:"phone"`
Experience string `json:"experience"`
Goals string `json:"goals"`
@@ -23,6 +23,10 @@ func SetupRouter(db *gorm.DB, config *config.Config) http.Handler {
r.Use(m)
}
// Serve static files (avatars) - ДОБАВЬТЕ ЭТО
r.Handle("/uploads/*", http.StripPrefix("/uploads/",
http.FileServer(http.Dir("/app/uploads"))))
// Initialize repositories
userRepo := repository.NewUserRepository(db)
newsRepo := repository.NewNewsRepository(db)