Exemple #1
0
def remove_allocation_from_read_model(event: events.Deallocated,
                                      uow: unit_of_work.SqlAlchemyUnitOfWork):
    with uow:
        uow.session.execute(
            'DELETE FROM allocations_view'
            ' WHERE orderid = :orderid AND sku = :sku',
            dict(orderid=event.orderid, sku=event.sku))
        uow.commit()
Exemple #2
0
def remove_allocation_from_read_model(event: events.Deallocated,
                                      uow: unit_of_work.SqlAlchemyUnitOfWork):
    with uow:
        uow.session.execute(
            'delete from allocations_view'
            ' where orderid=:orderid and sku=:sku',
            dict(orderid=event.orderid, sku=event.sku))
        uow.commit()
Exemple #3
0
def add_allocation_to_read_model(event: events.Allocated,
                                 uow: unit_of_work.SqlAlchemyUnitOfWork):
    with uow:
        uow.session.execute(
            'INSERT INTO allocations_view (orderid, sku, batchref)'
            ' VALUES (:orderid, :sku, :batchref)',
            dict(orderid=event.orderid, sku=event.sku,
                 batchref=event.batchref))
        uow.commit()