From bf107ca4a83e7de4892a1720963351f10cf767e4 Mon Sep 17 00:00:00 2001 From: programmingPug <36635276+programmingPug@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:37:40 -0500 Subject: [PATCH] Readme updates --- SoilMoistureAPI/README.md | 43 ++++++++++++++++++++++ plant-browser/README.md | 77 +++++++++++++++------------------------ 2 files changed, 73 insertions(+), 47 deletions(-) create mode 100644 SoilMoistureAPI/README.md diff --git a/SoilMoistureAPI/README.md b/SoilMoistureAPI/README.md new file mode 100644 index 0000000..d0cca25 --- /dev/null +++ b/SoilMoistureAPI/README.md @@ -0,0 +1,43 @@ + +
+
+ +Logo + +

PlantPal

+

+Because knowing when to water your plants is hard +

+
+ +## API features + +### Flattened Data Model: + +- The API uses a single, flat model (e.g., SoilMoistureFlat) that contains all necessary information, thereby avoiding nested or circular references. +- The model includes fields such as: + - deviceId: A unique identifier for the sensor (such as its BLE address). + - moistureLevel: The current moisture reading (as a float). + - timestamp: The time the record was created or updated (set to UTC on the server). + - deviceNickname: A friendly name for the device (e.g., "SoilSensor"). + +### Combined Insert/Update Logic (Upsert): + +- The PostSoilMoisture method accepts a flattened JSON payload. +- If a record for a given deviceId already exists, the API updates its moistureLevel and timestamp (and updates the deviceNickname if provided). +- If no record exists for that deviceId, a new record is inserted with the given information. + +### Validation: + +- The API validates incoming data and ensures required fields are present (such as deviceId and moistureLevel). +- It returns detailed error messages if validation fails, helping clients correct their payloads. + +### Simplified Data Handling: + +- With a flattened model, there is no need for complex navigation properties or sub-object mapping; all relevant data is stored in one entity. +- This design simplifies both the client payload construction and server-side processing. + +### Timestamp Management: + +- The API sets (or updates) the timestamp (using the current UTC time) whenever a record is created or modified. +- This provides a reliable audit trail for when sensor data was recorded or updated. \ No newline at end of file diff --git a/plant-browser/README.md b/plant-browser/README.md index 4f5f234..cba7664 100644 --- a/plant-browser/README.md +++ b/plant-browser/README.md @@ -1,59 +1,42 @@ -# PlantBrowser -This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.0.6. +
+
+ +Logo + +

PlantPal

+

+Because knowing when to water your plants is hard +

+
-## Development server +## Client features -To start a local development server, run: +### Modern Standalone Components: +- The client is built (e.g., in Angular) using standalone components to simplify development, improve reusability, and ensure easier integration with the REST API. -```bash -ng serve -``` +### Dashboard Overview: +- The UI provides a comprehensive dashboard displaying key sensor data such as soil moisture levels, battery percentages, and timestamps for the latest readings. -Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files. +### Real-Time & Historical Data: -## Code scaffolding +- Real-Time Updates: The client periodically (or via WebSockets, if implemented) fetches the latest sensor data from the API for immediate display. +- Historical Visualization: Graphs and charts can illustrate trends over time (if historical data is supported by the backend). -Angular CLI includes powerful code scaffolding tools. To generate a new component, run: +### Device Management: -```bash -ng generate component component-name -``` +- Editing: Users can click on a device’s name to open a dialog (styled consistently with the parent application) and update its nickname. +- Removal: The interface provides an endpoint for removing devices from the monitoring system. +- Configuration: The client is set up to use environment-specific settings (e.g., pointing to a production API endpoint over CORS-friendly URLs). -For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: +### REST API Integration: +- The application communicates with the backend API seamlessly, handling CORS policies appropriately. It uses Angular’s HttpClient (or similar libraries) to manage GET/POST requests to retrieve and update soil moisture data. -```bash -ng generate --help -``` +### Swagger and Documentation: +- The client (and possibly the developer portal) references Swagger documentation available for the API, ensuring that API changes are clearly documented and easily testable. -## Building +### Responsive Design: +- The application is responsive and designed for both mobile and desktop use—making it easy for users in the field or in the office to quickly assess sensor status and history. -To build the project run: - -```bash -ng build -``` - -This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. - -## Running unit tests - -To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: - -```bash -ng test -``` - -## Running end-to-end tests - -For end-to-end (e2e) testing, run: - -```bash -ng e2e -``` - -Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. - -## Additional Resources - -For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. +### Customizable & Environment-Aware: +- Configuration for connecting to the API (base URL, API key) is managed via environment variables or configuration files so that the client can be adapted between development, staging, and production without code changes. \ No newline at end of file