Overview
TheRecordService class provides a high-level interface for managing records in the Simple Manager Mobile application. It handles all CRUD operations and includes validation logic for record management.
Location: src/application/services/RecordService.ts
Methods
create
Creates a new record with auto-generated ID and timestamps.The title of the record
The type/category of the record
The newly created record object with the following properties:
Auto-generated UUID for the record
The record title
The record type
ISO 8601 timestamp of creation
ISO 8601 timestamp of last update
Soft delete flag (default: false)
list
Retrieves all records from the repository.Array of all record objects in the system
delete
Performs a soft delete on a record by marking it as deleted.The unique identifier of the record to delete
update
Updates an existing record and refreshes theupdatedAt timestamp.
The complete record object with updated values. Must include:
id(string): Record identifiertitle(string): Record titletype(string): Record typecreatedAt(string): Original creation timestampisDeleted(boolean): Deletion statussubtitle(string, optional): Record subtitlemetadata(string, optional): Additional metadatauserId(string, optional): Associated user ID
existsByTitle
Checks if a record with the given title already exists (case-insensitive).The title to check for existence
Returns
true if a record with the given title exists, false otherwiseRecord Entity Structure
TheRecord interface used throughout this service:
Complete Example
Dependencies
- RecordRepository: Handles data persistence layer operations
- expo-crypto: Provides UUID generation functionality
- Record Entity: Domain entity defining the record structure
Notes
- All timestamps are stored in ISO 8601 format
- Delete operations are soft deletes (sets
isDeletedflag) - The service automatically manages
createdAtandupdatedAttimestamps - Title existence checks are case-insensitive