feat(resources): editar ubicación de un punto in-place (PATCH) - #434
Merged
Conversation
El endpoint PATCH /resources/:id solo permitía cambiar name/description/ contact/schedule; para corregir coordenadas había que descartar+recrear (cambiando el id). Se añade `location` (dirección + coordenadas) a la edición: EditResourceProps/Command, EditResourceDto y el diff de auditoría. Además arregla un bug latente: el bloque `set` del upsert del repositorio NO incluía description ni address/latitude/longitude, así que editar esos campos en un punto ya persistido no se guardaba.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
vgpastor
added a commit
that referenced
this pull request
Jul 26, 2026
## Qué Añade al agregado `Resource` cuatro campos nuevos (todos nullable), fijables al registrar y editables después vía `PATCH /resources/:id`, y expuestos en la vista pública: - **`capacity`** / **`occupancy`** — aforo total y ocupación actual del refugio. - **`sourceOrganisation`** / **`sourceUrl`** — organismo oficial que publica el dato y enlace a la fuente (distinto de `provenance`, ingesta externa). Sale de la carga de refugios de los incendios: los MD de SITREM traían aforo, ocupación y fuente oficial que acababan como texto libre en `description`. ## Cambios - Migración `0059_resource_capacity_source.sql`. - Dominio (props/snapshot/getters/`register`/`fromSnapshot`/`edit`/`toSnapshot`; números sin trim, source con trim y vacío→null). - `register-resource` / `edit-resource` (comandos + diff de auditoría). - `ingest-external-resources`: preserva los 4 en update, `null` en insert. - DTOs (`RegisterResourceDto`, `EditResourceDto`) y vista pública (`ResourceView` + `ResourceViewDto`). - Repositorio Drizzle: schema, 3 mapeadores, `insert` y `set` del upsert. - `packages/api-client/src/schema.ts` regenerado. ## Gate `nest build` ✅ · eslint/prettier ✅ · 1635 tests ✅. ## Nota Reemplaza a #435 (se cerró sola al mergear #434 y borrarse su rama base). Ya rebasada sobre `main`; el diff es solo el enriquecimiento.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
Permite corregir la geolocalización (dirección + coordenadas) de un punto ya creado vía
PATCH /resources/:resourceId, sin tener que descartar+recrear (que cambia el id).Por qué
Operando la emergencia de incendios se detectó que varias coordenadas eran aproximadas/erróneas y no había forma de corregirlas: el
editsolo tocaba name/description/contact/schedule ydiscardno aplica a puntos publicados. La única vía era recrear el punto (nuevo id, se pierde historial).Cambios
Resource:locationpasa a mutable (_location+ getter);edit()aceptalocation.EditResourceProps/EditResourceCommand/EditResourceDto: nuevo campo opcionallocation(LocationDto).edit-resource: el diff de auditoría incluyeaddress/latitude/longitude.setdel upsert del repositorio Drizzle no incluíadescriptionniaddress/latitude/longitude→ editar esos campos en un punto ya persistido no se guardaba. Ahora sí.packages/api-client/src/schema.ts.Gate
pnpm --filter api build✅ · eslint/prettier ✅ · 1633 tests ✅ (nuevo test de edición de ubicación enedit-resource.spec.ts).Notas