Documentation Index Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/frontend-AgroPulse/llms.txt
Use this file to discover all available pages before exploring further.
All types shared between the frontend and the REST API are defined in src/types/index.ts. The file is organised into domain enums, raw backend DTOs, list response wrappers, and app-level models. This page documents every exported type exactly as declared.
Enums
These union types express the fixed value sets accepted or returned by the API.
export type SensorType =
| 'TEMPERATURE'
| 'TEMPERATURE_INTERNAL'
| 'TEMPERATURE_EXTERNAL'
| 'HUMIDITY'
| 'HUMIDITY_EXTERNAL'
| 'SOIL_MOISTURE'
| 'LIGHT'
| 'CO2'
| 'PRESSURE'
export type ActuatorType = 'PUMP' | 'FAN' | 'LED' | 'SERVO' | 'RELAY' | 'MOTOR'
Sensor communication protocol used by the ESP32 device. export type Protocol = 'DHT22' | 'DHT11' | 'ADC' | 'ANALOG' | 'I2C' | 'DIGITAL' | 'ONE_WIRE'
export type UserRole = 'ADMIN' | 'admin' | 'USER' | 'user'
Both cased variants (ADMIN/admin, USER/user) are accepted for backwards compatibility with older API responses.
export type AlertLevel = 'INFO' | 'WARNING' | 'CRITICAL'
export type RuleConditionType = 'GREATER_THAN' | 'LESS_THAN' | 'EQUALS' | 'NOT_EQUALS'
export type RuleActionType = 'ACTIVATE' | 'DEACTIVATE' | 'ALERT'
DTOs
Each DTO is the raw shape returned by the backend. Optional fields (?) may be absent from API responses.
Represents a physical greenhouse installation. Unique greenhouse identifier.
Human-readable location string.
Optional description or notes.
Whether the greenhouse is currently active.
Identifier of the linked ESP32 device.
GPS latitude for map view.
GPS longitude for map view.
URL of the greenhouse cover photo (stored in Supabase).
Represents a single sensor attached to a greenhouse. Unique sensor identifier.
Sensor measurement category.
Hardware protocol used by the sensor.
GPIO pin number on the ESP32.
Whether the sensor is enabled.
ID of the parent greenhouse.
Source device identifier string.
Physical location within the greenhouse.
Represents a controllable actuator (pump, fan, LED, etc.). Unique actuator identifier.
GPIO pin number on the ESP32.
Whether the actuator is enabled in the system.
Current on/off state of the actuator.
If true, the GPIO pin logic is inverted (active-low relay).
ID of the parent greenhouse.
Source device identifier string.
A single timestamped measurement from a sensor. Unique reading identifier.
ID of the sensor that produced the reading.
Sensor type copied from the sensor at write time.
Measured value in sensor-specific units.
ISO 8601 timestamp of the measurement.
ID of the greenhouse the sensor belongs to.
A crop profile with acceptable environmental ranges. Whether the crop profile is active. Accepts boolean or legacy 0/1.
Greenhouse this crop is assigned to.
Minimum acceptable temperature (°C).
Maximum acceptable temperature (°C).
Minimum acceptable humidity (%).
Maximum acceptable humidity (%).
Minimum soil moisture (%).
Maximum soil moisture (%).
Minimum light level (lux).
Maximum light level (lux).
Minimum CO₂ concentration (ppm).
Maximum CO₂ concentration (ppm).
Optional notes about the crop.
A system-generated or rule-triggered alert. type
SensorType | string
required
The sensor type or custom category that triggered the alert.
Severity level: INFO, WARNING, or CRITICAL.
Alert description message.
ISO 8601 timestamp of when the alert was raised.
Whether the alert has been acknowledged.
Greenhouse the alert originates from.
A user account. Full name (snake_case variant).
Full name (camelCase variant).
User role: ADMIN or USER.
Whether the account is active.
Avatar image URL (Supabase storage).
Auth provider, e.g. google.
List of greenhouse IDs the user has access to.
An automation rule that triggers actuator actions based on sensor conditions. Display name of the rule.
Sensor type the condition is evaluated against.
conditionType
RuleConditionType
required
Comparison operator.
Value the sensor reading is compared to.
Actuator to control when the condition is met.
Action to perform: ACTIVATE, DEACTIVATE, or ALERT.
Whether the rule is currently active.
An audit log entry recording a user or system action. Unique log entry identifier.
Description of the action performed.
Additional context or payload.
ISO 8601 timestamp of the action.
ID of the user who performed the action.
A generated report record. Unique report identifier.
Report type (e.g. daily-csv, weekly-stats).
ISO 8601 creation timestamp.
Download URL for the generated file.
A support ticket. Unique ticket identifier.
One of OPEN, IN_PROGRESS, or CLOSED.
ISO 8601 creation timestamp.
ISO 8601 timestamp of the last update.
ID of the user who created the ticket.
Full device configuration returned by GET /api/device/config/:id. Identifier of the ESP32 device.
List of sensors registered to this device.
List of actuators registered to this device.
Available GPIO pins for a greenhouse device, returned by GET /api/device/gpios/:id. GPIO pins already assigned.
GPIO pins that can be assigned to sensors.
GPIO pins that can be assigned to actuators.
Threshold and anomaly detection configuration for a sensor. Unique threshold record identifier.
ID of the sensor this threshold applies to.
Minimum expected value; readings below this trigger an alert.
Maximum expected value; readings above this trigger an alert.
Minutes of silence before a “no data” alert is raised.
Minutes of identical readings before a “stuck sensor” alert is raised.
Percentage change from the previous reading that counts as a spike.
Whether threshold monitoring is enabled.
A contact who receives alert notifications for a greenhouse. Unique recipient identifier.
Greenhouse this recipient is associated with.
Email address for notifications.
Phone number for SMS notifications.
CallMeBot API key for WhatsApp/Telegram notifications.
Whether notifications are enabled for this recipient.
List response wrappers
The API wraps list responses in a resource-keyed object. Each wrapper type is defined alongside its corresponding DTO:
Type Shape GreenhouseListResponse{ greenhouses: GreenhouseDto[] }SensorListResponse{ sensors: SensorDto[] }ActuatorListResponse{ actuators: ActuatorDto[] }ReadingListResponse{ readings: SensorReadingDto[] }CropListResponse{ crops: CropDto[] }AlertListResponse{ alerts: AlertDto[] }UserListResponse{ users: UserDto[] }RuleListResponse{ rules: RuleDto[] }LogListResponse{ logs: LogDto[] }TicketListResponse{ tickets: TicketDto[] }
Paginated endpoints return a PaginatedResponse<T> envelope:
export interface PaginatedResponse < T > {
data : T []
total ?: number
page ?: number
limit ?: number
}
Not all list endpoints use PaginatedResponse. Most currently return the flat list wrapper (e.g. GreenhouseListResponse). The limit query parameter is supported on /api/readings and /api/logs.