90a96b4125
- Remove api_es service, Dockerfile, all Go source files - Remove api_es from docker-compose.yml, nginx-ssl.conf, .env, Makefile - Replace nginx /api/ proxy with /api/v1/ → api_yal:8787 - Add amenity/upload domains, AuthResponse, GET /auth/me, GET /objects/my to api_yal - Rewrite easysite frontend: types, composables, and all 5 pages to use api_yal DTOs - Wire nuxt.config public.apiBase, add useObjects CRUD composable - Update docs references from api_es to api_yal
37 lines
961 B
Go
37 lines
961 B
Go
package amenity
|
|
|
|
import (
|
|
"api_yal/internal/logger"
|
|
"api_yal/internal/middleware"
|
|
"api_yal/internal/repository"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func RegisterRoutes(r chi.Router, db *gorm.DB, jwtSecret string) {
|
|
l := logger.Get()
|
|
l.Debug("Регистрация маршрутов для amenity")
|
|
|
|
amenityRepo := repository.NewAmenityRepository(db)
|
|
amenityService := NewService(amenityRepo)
|
|
amenityHandler := NewHandler(amenityService)
|
|
|
|
r.Route("/amenities", func(r chi.Router) {
|
|
r.Group(func(r chi.Router) {
|
|
r.Get("/", amenityHandler.List)
|
|
r.Get("/{id}", amenityHandler.GetByID)
|
|
r.Get("/object/{objectId}", amenityHandler.GetByObject)
|
|
})
|
|
|
|
r.Group(func(r chi.Router) {
|
|
r.Use(middleware.AuthMiddleware(jwtSecret))
|
|
|
|
r.Post("/", amenityHandler.Create)
|
|
r.Put("/{id}", amenityHandler.Update)
|
|
r.Delete("/{id}", amenityHandler.Delete)
|
|
r.Put("/object/{objectId}", amenityHandler.ReplaceObjectAmenities)
|
|
})
|
|
})
|
|
}
|