diff --git a/README.md b/README.md index c8800fb..eeb9bfb 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,185 @@ -# Nature In Pots β Modular Flask Plant Management App +# πΏ Nature In Pots β Ultra Plant Tracker Platform -This project is a modular, plugin-driven Flask application for tracking plants, their health, lineage, pricing, media, and more. +> Modular, collaborative, end-to-end plant tracking and pricing platform with QR+barcode IDs, propagation logs, resale tools, and role-based management. --- -## π¦ Core Features +## π§© Overview -- π User Authentication (`auth`) -- π± Plant Identity Profiles (`plant`) -- π Grow Logs with Events (`growlog`) -- πΌ Media Upload & Attachments (`media`) -- π Tag-based and name-based Search (`search`) -- π CLI Tools for Preloading and Seeding (`cli`) -- π¨ UI Macros and Shared Layout (`core_ui`) +This is a full-feature, plugin-driven Flask 2+ web application for managing and tracking plant ownership, propagation, pricing, and growth. It supports dynamic plant attributes, collaboration groups, trade logs, QR/barcode labeling, resale workflows, offline sync, moderator tools, and future AI/ML modules. + +Built for hobbyists, businesses, breeders, and community gardens. --- -## π§± Plugin System +## π Core Features -Each feature is implemented as a plugin under the `plugins/` directory. Each plugin is self-contained and includes: +### π± Plant Profiles +- Add, edit, and log plants with full propagation and ownership history +- Each plant is assigned a permanent, scannable **QR code** and **barcode** +- Plants can be marked as `Public`, `Unlisted`, or `Folder-only` +- All pricing, logs, and lineage are tied to a plant ID and user -- `models.py` -- `routes.py` -- `forms.py` *(if applicable)* -- `templates/` -- `plugin.json` +### π§Ύ Grow Logs +- Add logs with images, notes, and growth metrics +- Track success/failure events, mutation events, pest/disease sightings +- Link logs to substrate recipes and fertilizers -Plugins are auto-loaded via `app/__init__.py`. +### π Verified Lineage Tracking +- Lineage links are created by the new owner +- Parent plant's owner must **approve** the linkage +- Verified lineage is marked with a badge and shown in plant lineage tree +- Pending links are visible only to the creator + +### π° Pricing Logic +- Only the current owner and admins can see pricing +- On transfer, original price is retained but hidden from the buyer +- Buyer must submit their own price for tracking resale data +- Admins see full price history; mods and others do not + +### π§ͺ Substrate + Fertilizer Tracking +- Track custom mixes by ingredient (e.g., βFine Pumiceβ, βLarge Barkβ) +- Store cost per ingredient and auto-calculate total mix cost +- Recipes can be reused across plants +- Fertilizer schedules can be attached to logs and outcomes tracked + +### π¦ Shipping Tracker +- When a plant is sold, sellers can add: + - Carrier, tracking number, est. delivery date +- Ownership updates post buyer confirmation +- Shipping logs are attached to the plant transfer log + +### π Plant Folders +- Organize plants into folders (e.g., βFor Saleβ, β2025 Spring Batchβ) +- Each folder gets its own QR code: + `https://domain.com/{username}/folder/{id}|{slug}` +- Folders can be public, private, or unlisted --- -## π Installation +## π§ββοΈ Users, Roles, and Groups -### Prerequisites +### π€ User Roles +- **User** β default +- **Moderator** β can manage flags, notes +- **Admin** β full backend, plugin, pricing, banning control +- Roles are extensible via admin UI -- Python 3.11+ -- MySQL server -- Virtualenv or Docker +### π‘ Moderator Panel +- View and resolve reports +- Add private notes to users or plants (e.g., warnings, suspicion) +- Ban users + - Banned users' plants become read-only + - Cannot add new plants + - Buyers can request transfer via email approval from banned seller -### Setup +### π₯ Collaboration Groups +- Users can form groups to share: + - Logs + - Images + - Pricing (opt-in) +- Groups have role-based permissions (manager, editor, viewer) +- Useful for stores, teams, or shared collections + +--- + +## π·οΈ Labeling System: QR + Barcode + +### QR Code +- Generated on server after initial sync +- Unique to plant, never changes +- SVG and PNG available + +### Barcode Fallback +- CODE-128 format +- If data too long, split into stacked barcodes +- Same encoded info: plant ID, owner ID, visibility, timestamp +- Printable as label from dashboard + +--- + +## π Permissions Matrix + +| Feature | Owner | Group Member | Moderator | Admin | +|--------------------------|-------|---------------|-----------|--------| +| View Logs | β | β (if shared) | β | β | +| Edit Logs | β | π* | π« | β | +| View Pricing | β | β (opt-in) | π« | β | +| Ban User / Flag Review | π« | π« | β | β | +| Approve Lineage | π« | π« | π« | β | +| Confirm Lineage | β | π« | π« | β | + +π* if granted by group manager + +--- + +## π Offline Sync (PWA) +- Full add/log/edit possible offline +- Sync queue uploads on connection +- QR/barcodes generated **after** server confirms sync +- Client-side validation before queue + +--- + +## π§ Smart Tools + +### βοΈ User Reputation System +- Users rated after trades (accuracy, responsiveness, helpfulness) +- βTrusted Growerβ tag auto-assigned above threshold +- Can be revoked via vote or admin action + +### πΏ Inter-Plant Comparison +- Timeline comparison for growth, size, or log outcomes +- Side-by-side charts and event overlays + +--- + +## π§ Admin & Dev Tools + +### π€ Seed Data Generator +- Seeds with common aroids, herbs, and test users +- Covers full range of roles, plant types, and edge cases + +### π Plugin System +- CLI & plugin discovery system +- Admin can toggle plugins +- Plugin types: CLI, UI Panel, API extension, webhook, scheduler + +### π Data Export / Disaster Recovery +- Export: SQL dump, file archive, JSON profile +- Restore: Admin-initiated rollback or full upload restore + +--- + +## π£ API System + +### REST & GraphQL APIs +- REST: OpenAPI-documented endpoints +- GraphQL: Advanced multi-entity queries +- JWT-secured +- Follows role-based access rules + +--- + +## π Internationalization +- Flask-Babel integration +- Language switcher in UI +- Community-managed translation interface (admin toggled) + +--- + +## π Future Enhancements + +- π§ AI Journal Assistant (log suggestions, summarization) +- π Calendar View for logs/reminders +- π§° Visual ERD Generator Tool +- π Live Auctions Plugin (for curated resale events) + +--- + +## π§Ύ License & Contribution + +This project is part of **Nature In Pots** under **High Thyme Ventures**. + +Please contact the repository owner for collaboration, plugin submission, or access requests. -```bash -make install # Install dependencies -make dev # Start Flask development server -make db # Initialize database -make seed # Seed database with test data diff --git a/app/errors.py b/app/errors.py index e7419fb..177089e 100644 --- a/app/errors.py +++ b/app/errors.py @@ -6,6 +6,10 @@ bp = Blueprint('errors', __name__) def bad_request(error): return render_template('400.html'), 400 +@bp.app_errorhandler(404) +def bad_request(error): + return render_template('404.html'), 404 + @bp.app_errorhandler(500) def internal_error(error): return render_template('500.html'), 500 diff --git a/app/templates/400.html b/app/templates/400.html new file mode 100644 index 0000000..27a931e --- /dev/null +++ b/app/templates/400.html @@ -0,0 +1,12 @@ + + +
+ +{{ e.description or "Sorry, we couldnβt understand that request." }}
+ Return home + + diff --git a/docker-compose.yml b/docker-compose.yml index 055d183..dcca79f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,39 +24,6 @@ services: retries: 3 start_period: 30s - command: > - bash -c " - set -e - - echo '[β] Ensuring .env...' - if [ ! -f '.env' ]; then cp .env.example .env; fi - - echo '[β] Waiting for MySQL to be ready...' - until nc -z ${MYSQL_HOST} ${MYSQL_PORT}; do sleep 1; done - - echo '[β] Ensuring migration structure...' - if [ ! -d 'migrations' ]; then - echo '[βΉ] Running flask db init...' - flask db init - fi - - echo '[βΉ] Autogenerating migration...' - flask db migrate -m 'auto' || echo '[βΉ] No changes detected.' - - echo '[β] Running DB migrations...' - flask db upgrade - - if [ \"$ENABLE_DB_SEEDING\" = \"1\" ]; then - echo '[π±] Seeding Data...' - flask preload-data - else - echo '[β οΈ] DB seeding skipped by config.' - fi - - echo '[π] Starting Flask server...' - flask run --host=0.0.0.0 - " - db: image: mysql:8 diff --git a/entrypoint.sh b/entrypoint.sh index 9f7c14d..a15e9cb 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,11 +20,12 @@ echo "[β] Running migrations" flask db migrate -m "auto" flask db upgrade -# Seed database if enabled -if [ "$ENABLE_DB_SEEDING" = "true" ]; then +# Seed database if enabled (accept β1β or βtrueβ) +if [ "$ENABLE_DB_SEEDING" = "true" ] || [ "$ENABLE_DB_SEEDING" = "1" ]; then echo "[π±] Seeding Data" flask preload-data fi + # Start the main process exec "$@" diff --git a/files.zip b/new.zip similarity index 67% rename from files.zip rename to new.zip index cbb41a9..b3f1f81 100644 Binary files a/files.zip and b/new.zip differ diff --git a/plugins/auth/templates/auth/login.html b/plugins/auth/templates/auth/login.html index ef842e8..54bc7c8 100644 --- a/plugins/auth/templates/auth/login.html +++ b/plugins/auth/templates/auth/login.html @@ -1,7 +1,8 @@ {% extends 'core_ui/base.html' %} {% block content %}