Expand description
Generic CRUD service — one implementation used by all entities.
Generated code emits only a type alias:
ⓘ
// Generated (was ~250 lines, now 1 line):
pub type StoredFileService = GenericCrudService<
StoredFile,
CreateStoredFileDto,
UpdateStoredFileDto,
PostgresStoredFileRepository,
>;Custom services wrap the alias with a decorator:
ⓘ
pub struct StoredFileServiceCustom {
inner: Arc<StoredFileService>,
notifications: Arc<NotificationService>,
}
impl StoredFileServiceCustom {
pub async fn archive(&self, id: &str, reason: String) -> ServiceResult<StoredFile> {
let entity = self.inner.get_by_id(id).await?.ok_or(ServiceError::NotFound)?;
// custom business logic
}
}Structs§
- Generic
Crud Service - A fully generic CRUD service.
- NoOp
Lifecycle - No-op lifecycle — the default used by generated type aliases.
Enums§
- Service
Error - Standard service-layer error type.
Constants§
- MAX_
BATCH_ SIZE - Maximum number of ids / items a single batch operation may contain. Enforced here at the service layer (not only in the HTTP handlers) so every caller — gRPC, background jobs, internal code — gets the same bound.
Traits§
- Apply
Update Dto - Apply an Update DTO’s fields to an existing entity (full update).
- From
Create Dto - Convert a Create DTO into a new entity instance.
- Service
Lifecycle - Optional lifecycle callbacks injected into
GenericCrudService.