Migrate easysite from api_es to api_yal
- 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
This commit is contained in:
@@ -109,6 +109,7 @@ func (h *ObjectHandler) ListObjects(w http.ResponseWriter, r *http.Request) {
|
||||
PageSize: h.getQueryParamInt(r, "page_size", 10),
|
||||
Type: r.URL.Query().Get("type"),
|
||||
Query: r.URL.Query().Get("q"),
|
||||
ObjectStatus: r.URL.Query().Get("status"),
|
||||
}
|
||||
|
||||
if statusStr := r.URL.Query().Get("is_active"); statusStr != "" {
|
||||
@@ -127,6 +128,26 @@ func (h *ObjectHandler) ListObjects(w http.ResponseWriter, r *http.Request) {
|
||||
h.respondWithJSON(w, http.StatusOK, response)
|
||||
}
|
||||
|
||||
// GetMyObjects обрабатывает GET /objects/my
|
||||
func (h *ObjectHandler) GetMyObjects(w http.ResponseWriter, r *http.Request) {
|
||||
userID, ok := r.Context().Value(middleware.UserIDKey).(uint)
|
||||
if !ok {
|
||||
http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
page := h.getQueryParamInt(r, "page", 1)
|
||||
pageSize := h.getQueryParamInt(r, "page_size", 10)
|
||||
|
||||
response, err := h.objectService.GetObjectsByOwner(r.Context(), userID, page, pageSize)
|
||||
if err != nil {
|
||||
h.handleError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
h.respondWithJSON(w, http.StatusOK, response)
|
||||
}
|
||||
|
||||
// GetObjectsByOwner обрабатывает GET /objects/owner/{ownerId}
|
||||
func (h *ObjectHandler) GetObjectsByOwner(w http.ResponseWriter, r *http.Request) {
|
||||
ownerID, err := strconv.ParseUint(chi.URLParam(r, "ownerId"), 10, 32)
|
||||
|
||||
Reference in New Issue
Block a user