Skip to content

Mini Farm Manager: design, implementation and README - #1

Merged
wangxiaoxiang5599 merged 8 commits into
mainfrom
dev
Sep 12, 2026
Merged

wangxiaoxiang5599 merged 8 commits into
mainfrom
dev

Conversation

@wangxiaoxiang5599

Copy link
Copy Markdown
Owner

Summary

Complete implementation of the Laravel + Vue developer exercise, built in reviewed stages on top of the laravel new --vue starter kit.

  • Design first — docs/design.md committed before any code
  • Stage 1 — schema, enums, models, factories, public app shell
  • Stage 2 — paddocks CRUD with the capacity-warning feature (ok / warning ≥80% / full)
  • Stage 3 — animals CRUD, MoveAnimal (transactional, row-locked capacity enforcement) and ChangeAnimalStatus
  • Stage 4 — move dialog, movement endpoint, health records
  • Stage 5 — dashboard and a demo seeder that goes through the actions; fixed a stale-instance bug the seeder exposed
  • Stage 6 — README (run instructions, assumptions, decisions, left out, production notes, additional feature, AI usage)

Merge with a merge commit to keep the stage history.

Verification

  • php artisan test — 82 tests, 458 assertions, all passing
  • vue-tsc --noEmit clean, vendor/bin/pint clean, npm run build succeeds
  • Walked through in the browser as a guest: create paddock → add animals with initial placement → warning at 80% → full at 100% → 6th move rejected inline → mark sold frees the place → health record listed

🤖 Generated with Claude Code

wangxiaoxiang5599 and others added 8 commits September 12, 2026 15:08
Covers domain model, business rules (capacity, movements, status),
application layer, routes, frontend pages, testing strategy and the
chosen additional feature (paddock capacity warning).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Migrations for paddocks, animals, animal_movements, health_records
- String-backed enums (Species, Sex, AnimalStatus, HealthRecordType,
  OccupancyState) with a shared HasOptions trait
- Eloquent models with relationships, casts and paddock occupancy helpers
- Factories with states for tests and seeding
- config/farm.php with the capacity warning threshold
- Farm routes are public: / redirects to /dashboard, dashboard moved out
  of the auth group, sidebar shows Animals/Paddocks and a Log in link
  for guests, Welcome page removed

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- PaddockController with index/create/store/show/edit/update
- Store/Update form requests; capacity may not drop below occupancy
- PaddockResource and AnimalSummaryResource for Inertia props
- Vue pages under paddocks/ plus shared farm components
  (PaddockForm, OccupancyBar, OccupancyBadge, EmptyState) and a
  Textarea UI primitive
- Occupancy state (ok / warning / full) drives badge and bar colours
- Feature tests for CRUD, validation and occupancy thresholds

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- MoveAnimal action: transactional, locks the target paddock, enforces
  active-only / different-paddock / has-room rules, records history and
  is the sole writer of animals.current_paddock_id
- ChangeAnimalStatus action: leaving the active state removes the animal
  from its paddock with a departure movement
- AnimalController with filtered, paginated index, create with optional
  initial placement, show with movement history, edit/update
- Store/Update form requests with enum and date validation
- AnimalResource and AnimalMovementResource
- Vue pages under animals/ plus AnimalForm, FormSelect and
  AnimalStatusBadge components; paddock page links to animals
- Feature tests for CRUD, filters, placement, capacity rules and status
  changes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- POST animals/{animal}/movements backed by MoveAnimal; validation
  errors surface on the destination field
- POST animals/{animal}/health-records with date/type/description rules
- MoveAnimalDialog marks the current and full paddocks as unavailable
- HealthRecordForm and health history on the animal page
- Endpoint tests for movements and health records

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- DashboardController: stats, species/status breakdowns, paddock
  occupancy, capacity warnings and recent movements
- Dashboard page replaces the starter placeholder
- FarmSeeder builds a demo farm through MoveAnimal/ChangeAnimalStatus
  with warning and full paddocks, an unplaced animal and health records
- Fix: MoveAnimal now syncs the caller's model instance with the locked
  row, and ChangeAnimalStatus refreshes before deciding whether to
  record a departure (stale instances previously skipped it)
- Paddock factory names are no longer limited to 12 unique values
- Dashboard tests; ExampleTest folded into DashboardTest

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- README covering how to run, assumptions, technical decisions, what
  was left out, production improvements, the capacity-warning feature
  and how AI tools were used
- Prettier formatting for project-authored Vue/TS and docs
- Ignore the local .claude/launch.json dev-server config

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- vp check failed on 41 files written by Laravel Boost (.agents/,
  .claude/, .codex/, .junie/, AGENTS.md, CLAUDE.md, boost.json,
  .mcp.json); they are tool-generated and rewritten by boost:update,
  so exclude them from formatting instead of reformatting them
- PHPStan level 7: narrow findOrFail() arguments to int, type the
  after() hook and route parameter in UpdatePaddockRequest, add
  Attribute generics on Paddock::occupancy(), and build the factory
  enum via from() so the match is exhaustive
- Give phpstan a 512M memory limit in the composer script

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wangxiaoxiang5599
wangxiaoxiang5599 merged commit 2cb7da8 into main Sep 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant