Skip to content

How to manage rollback when need to call two repository method from a service #612

Open
@MahmudulHassan5809

Description

@MahmudulHassan5809

Here suppose deposit updated successfully but user balance not updated because of error. in that case how to rollback

def status_change(self,id: int, entity: DepositUpdate) -> Deposit:
    # first call the deposit repository 
    self._deposit_repository.update(id, entity)

    # then call user repository to update balance
    self._user_repository.update(id, amount)


Framework : FastAPI
DB : postgres
ORM : sqlalchemy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions