Conversation
…ork table discovery
… + documentation cleanup
- Added `only_researched` query parameter to `GET /api/v1/buildings/recipes` to filter by currently available research.
- BillController.yml: Created new file detailing bill endpoints
|
Nice work @inqus637 — this is a solid addition. We'll definitely use the bill endpoints in RLE for automated crafting management. A few things I noticed while reading through: Material filter does a double DefDatabase lookup —
Bruno YAML trailing spaces for route disambiguation ( Everything else looks clean. Error handling is thorough, bounds checking on reorder is good, and the |
4d5e590 to
ecd6d5d
Compare
|
@inqus637 fixed the branch by removing "Merge branch 'IlyaChichkov:master' into feat/bill-control" and force-pushing it |
|
Thanks for your review! |
Summary
This PR introduces complete Bill management functionality to RIMAPI, including CRUD operations, reordering capabilities, material filtering, and work table discovery. The implementation includes full test coverage via Bruno API collections.
Changes Overview
1️⃣ feat: Add Bill management API (61ec3c2)
New Controller: BillController.cs - REST endpoints for bill operations
Service Layer: BillService.cs - Business logic with 320 lines of implementation
DTOs: Complete data transfer objects in BillDto.cs
Helper: BillHelper.cs - Game object to DTO conversion utilities
Endpoints Added:
Method Endpoint Description
GET /api/v1/buildings/bills?building_id={id} List all bills for a building
POST /api/v1/buildings/bills?building_id={id} Create new bill with full configuration
GET /api/v1/buildings/bill?building_id={id}&bill_id={id} Get specific bill details
PUT /api/v1/buildings/bill?building_id={id}&bill_id={id} Update existing bill
DELETE /api/v1/buildings/bills?building_id={id} Clear all bills from building
PUT /api/v1/buildings/bill/reorder Reorder recipes in queue
GET /api/v1/map/work-tables?map_id={id} Discover work tables on map
2️⃣ feat(bill-control): Add material management (ddcd694)
Added allowed_materials filter to bill creation/update operations
Supports filtering by specific material definitions (e.g., "Cloth", "WoolBison")
Enables precise control over which materials bills will use
3️⃣ fix(bill-control): NRE and reorder bounds checking (b88c8f2)
Fixed NullReferenceException in bill operations
Added proper bounds validation for reorder offset values
Updated configuration settings for stability
4️⃣ feat: Add Bruno API test collection (1eca554)
Complete test suite with 10+ endpoints covering all bill operations
Technical Details
Files Modified:
Source/RIMAPI/RimworldRestApi/BaseControllers/BillController.cs (+118 lines)
Source/RIMAPI/RimworldRestApi/Services/BillService.cs (+320 lines)
Source/RIMAPI/RimworldRestApi/Models/BillDto.cs (+126 lines)
Source/RIMAPI/RimworldRestApi/Helpers/BillHelper.cs (+117 lines)
tests/bruno_api_collection/Bills/*.yml (10 test files)
Total New Code: ~700+ lines of production code + comprehensive test coverage
Testing Notes
All endpoints have been tested via Bruno API collections located in:
Apply
tests/bruno_api_collection/Bills/
├── Create Bill.yml
├── Delete Bill.yml
├── Get Bill.yml
├── List Bills.yml
├── Update Bill.yml
├── Suspend Bill.yml
├── Reorder Bill.yml
├── Clear Bills.yml
├── Available Recipes.yml
└── Work Tables.yml
Related Documentation
API conventions remain consistent with existing patterns (snake_case, response envelopes)
No breaking changes to existing endpoints
All new endpoints follow established error handling and validation rules