TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt
Use this file to discover all available pages before exploring further.
/api/carousel route group manages the hero image carousel displayed on the Eco-It home page. The public GET / endpoint requires no authentication and is intended to be called by the frontend on page load. All write operations (create, update, delete, reorder) are protected by JWT authentication and require the admin role. Slide images are stored in Cloudinary; when a slide is deleted, its Cloudinary asset is automatically removed using the stored publicId.
Slides are ordered by the
order field (ascending). Use the reorder endpoint to update display order without modifying individual slides.CarouselSlide Model
The following fields make up aCarouselSlide document. Understanding the model is important for both creating new slides and interpreting responses.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
tag | string | No | — | Small label shown above the title, e.g. "Nuevo" or "Destacado". |
title | string | Yes | — | Main heading text of the slide. |
subtitle | string | No | — | Supporting sub-heading or body copy. |
src | string | Yes | — | Cloudinary secure URL of the slide image. |
publicId | string | Yes | — | Cloudinary public ID used to delete the asset when the slide is removed. |
alt | string | No | title | Accessible alt text for the image. Defaults to the slide title. |
active | boolean | No | true | Controls whether the slide appears in the public feed. |
order | number | No | 0 | Sort position (ascending). Managed automatically on create; updated via the reorder endpoint. |
width | number | No | null | Optional intrinsic image width hint in pixels. |
height | number | No | null | Optional intrinsic image height hint in pixels. |
createdAt | string | — | auto | ISO 8601 timestamp set by Mongoose timestamps. |
updatedAt | string | — | auto | ISO 8601 timestamp updated on every save. |
Public Endpoint
GET /api/carousel
Returns all slides whereactive: true, sorted by order ascending. This endpoint is unauthenticated and is the only carousel route intended for end-user consumption.
Auth: None (public)
true on success.Array of active
CarouselSlide documents sorted by order ascending. See the CarouselSlide Model table for field descriptions.Admin Endpoints
All endpoints below require a valid admin JWT in theAuthorization header.
GET /api/carousel/admin
Returns all slides regardless of theiractive status, sorted by order ascending. Used by the admin dashboard to display and manage the full slide library.
Auth: Admin
true on success.Array of all
CarouselSlide documents (including inactive), sorted by order ascending.POST /api/carousel
Creates a new carousel slide. The new slide is automatically assigned anorder value equal to the current total count of slides, placing it at the end of the carousel. An audit log entry of type "slide" is created automatically.
Auth: Admin
Main heading of the slide. Also used as the
alt fallback if alt is not provided.Cloudinary secure URL of the slide image. Upload the image to Cloudinary separately and pass the resulting
secure_url here.Cloudinary public ID of the image (e.g.
"ecoit_carousel/my_slide"). This is used to delete the Cloudinary asset when the slide is deleted.Optional label displayed above the title, e.g.
"Nuevo", "Destacado".Optional supporting text shown below the title.
Accessible alt text for the image. Defaults to the value of
title if omitted.Set to
false to create the slide in a hidden/draft state.Optional intrinsic image width in pixels.
Optional intrinsic image height in pixels.
true on successful creation."Slide creado correctamente".The newly created
CarouselSlide document, including the auto-assigned order value.Upload images to Cloudinary before calling this endpoint. The API does not accept raw file uploads — provide the
src URL and publicId returned by Cloudinary after a direct or server-side upload.PUT /api/carousel/:id
Replaces the fields of an existing slide with the values provided in the request body. Partial updates are supported — only the fields present in the body are overwritten (standardfindByIdAndUpdate behaviour).
Auth: Admin
| Path parameter | Type | Description |
|---|---|---|
id | string | MongoDB ObjectId of the slide to update. |
Updated tag label.
Updated heading text.
Updated subtitle text.
Updated Cloudinary image URL.
Updated Cloudinary public ID (if the image was replaced).
Updated alt text.
Updated visibility flag.
Updated sort position. Prefer using the
/reorder endpoint for bulk reordering.Updated intrinsic width hint.
Updated intrinsic height hint.
true on success."Slide actualizado correctamente".The updated
CarouselSlide document (returned with { new: true }).DELETE /api/carousel/:id
Deletes a carousel slide from the database. If the slide has apublicId, the corresponding Cloudinary asset is also deleted automatically.
Auth: Admin
| Path parameter | Type | Description |
|---|---|---|
id | string | MongoDB ObjectId of the slide to delete. |
true on success."Slide eliminado correctamente".PATCH /api/carousel/reorder
Reorders all carousel slides in a single batch operation. The request body should contain an array of slide MongoDB ObjectIds in the desired display order. Each slide is assigned anorder value equal to its index position in the array (0-based), using a MongoDB bulkWrite for efficiency.
Auth: Admin
An ordered array of MongoDB ObjectId strings representing all slides in the desired display sequence. The first ID in the array will have
order: 0, the second order: 1, and so on.true on success."Slides reordenados correctamente".