Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GuillermoNavarro/Proyecto_comunidades/llms.txt

Use this file to discover all available pages before exploring further.

The announcements module gives each community a news board (tablón de noticias) where ADMINs can post updates, notices, and important information for all residents. Every post is scoped to a single community, stored as a Publicacion record, and presented in reverse-chronological order in the frontend’s NoticePage. Residents (USER role) can read all posts but cannot create, edit, or delete them.

Post Types

The TipoPublicacion enum currently defines two values:
ValueStatusDescription
NOTICIAActiveGeneral news and announcements. This is the type used by all current API endpoints under /api/publicaciones/noticias.
INCIDENCIAReservedIncident / maintenance request type. Defined in the enum but not yet exposed through dedicated endpoints in the current version.
All endpoints described in this page operate exclusively on publications of type NOTICIA. The tipo field is set automatically by the backend and does not need to be included in the request body.

The Publicacion Entity

FieldColumnTypeDescription
idid_publicacionLong (auto)Primary key
tipotipoTipoPublicacion enumNOTICIA or INCIDENCIA
titulotituloStringPost headline
descripciondescripcionStringPost body / content
imagenimagenStringOptional image filename (stored relative path)
usuarioid_usuario (FK)UsuarioAuthor — set automatically from the JWT, never from the request body
comunidadid_comunidad (FK)ComunidadThe community this post belongs to — set from the JWT
documentoid_documento (FK, nullable)DocumentoOptional attached community document
fechaCreacionfecha_creacionLocalDateTimeAuto-set by the database on insert; not updatable
fechaFinfecha_completadoLocalDateTimeOptional end/resolution date
estadoestadobooleantrue = active, false = archived
moderadomoderadobooleanModeration flag (default false)

Creating a News Post

POST api/publicaciones/noticias
Authorization: Bearer <admin_token>
Content-Type: application/json
The usuario (author) and comunidad fields are resolved automatically from the JWT and set by the backend. Do not include them in the request body. The tipo is also hardcoded to NOTICIA by the service layer. Request body:
{
  "titulo": "Revisión del ascensor — 20 de junio",
  "descripcion": "El próximo viernes 20 de junio, de 9:00 a 14:00 h, se realizará la revisión anual obligatoria del ascensor. Durante ese tiempo el servicio estará interrumpido. Disculpen las molestias."
}
Successful response:
{
  "id": 15,
  "tipo": "NOTICIA",
  "titulo": "Revisión del ascensor — 20 de junio",
  "descripcion": "El próximo viernes 20 de junio, de 9:00 a 14:00 h, se realizará la revisión anual obligatoria del ascensor. Durante ese tiempo el servicio estará interrumpido. Disculpen las molestias.",
  "imagen": null,
  "documento": null,
  "fechaCreacion": "2025-06-11T11:45:00",
  "fechaFin": null,
  "estado": true,
  "moderado": false,
  "usuario": {
    "id": 3,
    "nombre": "Laura",
    "apellidos": "Fernández Mora"
  },
  "comunidad": {
    "id": 1,
    "nombre": "Comunidad Los Pinos"
  }
}

Reading News Posts

GET api/publicaciones/noticias
Authorization: Bearer <user_or_admin_token>
Returns all NOTICIA publications for the authenticated user’s community, scoped automatically by the JWT’s community claim. Available to both USER and ADMIN. The frontend sorts the list by fechaCreacion descending so the newest post always appears first.

Updating a Post

PUT api/publicaciones/noticias/{id}
Authorization: Bearer <admin_token>
Content-Type: application/json
Restricted to ADMIN. Replaces the updatable fields of the post. Returns the updated Publicacion object, or 404 if the ID does not exist.
{
  "titulo": "Revisión del ascensor — 20 de junio (ACTUALIZADO)",
  "descripcion": "La revisión ha sido reprogramada para el martes 24 de junio, misma franja horaria."
}

Deleting a Post

DELETE api/publicaciones/{id}
Authorization: Bearer <admin_token>
Permanently removes the publication record from the database. Returns 200 OK with "eliminado" on success, or 404 if not found. Restricted to ADMIN.

Workflow Summary

1

ADMIN composes the post

The ADMIN writes the titulo and descripcion in the Nueva Noticia modal on the NoticePage. An optional document attachment and image can also be linked.
2

Backend resolves author and community

On POST api/publicaciones/noticias, the controller extracts idComunidad and idUsuario from the JWT and sets them on the Publicacion entity. The request body only needs to contain the content fields.
3

Post appears on the news board

The new post is immediately returned in GET api/publicaciones/noticias for all community members. The frontend renders each post using the AnuncioCard component, showing title, description, author name, creation date, and any attached document.
4

ADMIN can edit or remove

Clicking the edit icon opens the ModalNoticia with the existing post data pre-filled. Saving calls PUT api/publicaciones/noticias/{id}. The delete button confirms and then calls DELETE api/publicaciones/{id}.

Access Control Summary

ActionUSERADMINSUPER_ADMIN
Read news posts
Create a news post
Update a news post
Delete a news post
The data model also includes a Comentario entity mapped to a comentarios table. It links a Publicacion to a Usuario and stores a texto, imagen, fecha, and a moderado flag. Comment thread functionality is not yet exposed through any API endpoint in the current version — it is reserved for a future feature release.

Build docs developers (and LLMs) love