Overview
TheRecordRepository class handles all database operations for Record entities. It provides methods for creating, reading, updating, and soft-deleting records in the SQLite database.
Location: src/infraestructure/repositories/RecordRepository.ts
Methods
create
Creates a new record in the database.Record
required
The record object to create
Promise<void>
Resolves when the record is successfully created
findAll
Retrieves all non-deleted records from the database.Promise<Record[]>
Array of all active (non-deleted) records. The
isDeleted field is converted from numeric (0/1) to boolean.isDeleted field from integer to boolean.
update
Updates an existing record in the database.Record
required
The record object with updated values. The
id field is used to identify which record to update.Promise<void>
Resolves when the record is successfully updated
createdAt and isDeleted fields are not updated by this method.
softDelete
Marks a record as deleted without removing it from the database.string
required
The unique identifier of the record to soft delete
Promise<void>
Resolves when the record is successfully marked as deleted
findAll() results but remain in the database for potential recovery or audit purposes.
Usage Example
Database Schema
The repository interacts with therecords table with the following structure: