Repository class
Generic repository for CRUD operations.
Constructors
constructor constructor
Signature
Type Parameters
- T
The entity type
- ID
The identifier type (string or number)
Methods
create method
abstract
Signature
(data: Omit<T, "id">): Promise<T>
Create a new entity.
Parameters
- data
Entity data (without ID)
Returns
The created entity
delete method
abstract
Signature
(id: ID): Promise<boolean>
Delete an entity.
Parameters
- id
Entity ID
Returns
true if deleted, false if not found
find method
abstract
Signature
(id: ID): Promise<T>
Find an entity by ID.
Parameters
- id
The entity ID
Returns
The entity, or null if not found