31 lines
832 B
Go
31 lines
832 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"gitea.hostxtra.co.uk/mrhid6/notely/backend/internal/application/services"
|
|
)
|
|
|
|
// SettingsHandler handles public app settings endpoints.
|
|
type SettingsHandler struct {
|
|
authService *services.AuthService
|
|
}
|
|
|
|
// NewSettingsHandler creates a new settings handler.
|
|
func NewSettingsHandler(authService *services.AuthService) *SettingsHandler {
|
|
return &SettingsHandler{authService: authService}
|
|
}
|
|
|
|
// GetFeatureFlags handles GET /api/v1/settings/feature-flags.
|
|
func (h *SettingsHandler) GetFeatureFlags(w http.ResponseWriter, r *http.Request) {
|
|
flags, err := h.authService.GetFeatureFlags(r.Context())
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(flags)
|
|
}
|