caio-imperial / caio-imperial/PHOTO-SITE-API

Refactor User Repository and API to Use Transactions

Open
#11 0 comments 0 reactions 1 assignee Claimed by @caio-imperial View on GitHub
enhancement
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

# Description

Currently, our rollback mechanism is limited to the repository layer. To ensure data consistency, we need to refactor the API and use case logic to leverage transactions effectively. This will allow rollbacks to occur not only at the repository level but also within the broader use case scope.

## Task

1. Implement Transactions in Use Case Layer

- Modify the use case to start and manage transactions.
- Ensure that a rollback occurs when an error is encountered at any step of the process.

2. Refactor User Repository

- Adapt repository methods to work within an explicit transaction context rather than managing transactions individually.
- Ensure repository methods can participate in a shared transaction.

3. Update API Layer

- Ensure the API correctly initializes transactions when calling the use case.
- Handle errors properly to trigger a rollback when necessary.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.