Skip to main content

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.
Represents a single sensor attached to a greenhouse.
Represents a controllable actuator (pump, fan, LED, etc.).
A single timestamped measurement from a sensor.
A crop profile with acceptable environmental ranges.
A system-generated or rule-triggered alert.
A user account.
An automation rule that triggers actuator actions based on sensor conditions.
An audit log entry recording a user or system action.
A generated report record.
A support ticket.
Full device configuration returned by GET /api/device/config/:id.
Available GPIO pins for a greenhouse device, returned by GET /api/device/gpios/:id.
Threshold and anomaly detection configuration for a sensor.
A contact who receives alert notifications for a greenhouse.

List response wrappers

The API wraps list responses in a resource-keyed object. Each wrapper type is defined alongside its corresponding DTO:
TypeShape
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[] }

Pagination

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.

Build docs developers (and LLMs) love