pub trait EntityDescriptor: Send + Sync {
// Required methods
fn entity_type(&self) -> &str;
fn plural(&self) -> &str;
fn build_routes(&self) -> Router;
}Expand description
Trait that describes how to build routes for an entity
Each entity (Order, Invoice, Payment, etc.) should implement this trait to provide its CRUD routes.
Required Methods§
Sourcefn entity_type(&self) -> &str
fn entity_type(&self) -> &str
The entity type name (singular, e.g., “order”)
Sourcefn build_routes(&self) -> Router
fn build_routes(&self) -> Router
Build the CRUD routes for this entity
Should return a Router with routes like:
- GET /{plural}
- POST /{plural}
- GET /{plural}/:id