Implement Core Book Management API v1 #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description:
Implement a RESTful API for managing books in our publishing catalog. The system must enforce strict data integrity, secure access, and separation of concerns following our architectural standards.
Technical Requirements
1. Architecture & Separation of Concerns
Controllers: Must be thin; only handle HTTP request/response mapping. No business logic or direct database queries allowed.MediatR Handlers: All business logic (validation, calculations, uniqueness checks) must reside here.DbContext: Only accessed by repositories or MediatR handlers.2. Data Integrity & Validation
Isbnis unique across the database. If a duplicate exists, return409 Conflict.> 0) and not exceed$9,999.99. Return400 Bad Requestfor invalid prices.<Nullable>enable</Nullable>in all projects. All reference types must explicitly indicate nullability.3. Security & Access Control
/api/v1/books/importendpoint must require anX-Api-Keyheader. This key must be read from an environment variableBULK_IMPORT_KEY, NOT hardcoded.4. Performance Standards
AddRange,RemoveRange) followed by a singleSaveChangesAsync. Do not loop individual database calls..Count > 0or.Length > 0instead of.Any().5. Code Quality & Documentation
/// <summary>).BookNotFoundException) for expected failures. Do not throw genericArgumentExceptionfor business logic errors.StringBuilderfor string concatenation in loops.Acceptance Criteria
POST /booksrequest creates a book and enforces ISBN uniqueness via the handler, not the controller.PUT /books/{id}/pricevalidates price constraints in the handler.<Nullable>enable</Nullable>and no warnings.