update method

Future<TEntity> update(
  1. TEntity entity, {
  2. RepositoryTransaction? transaction,
})

Implementation

Future<TEntity> update(
  TEntity entity, {
  RepositoryTransaction? transaction,
}) async {
  validator.validateThrowing(entity);

  var map = mapMapper.toMap(entity);

  try {
    map = await repository.update(
      map,
      principal,
      transaction: transaction,
    );
  } on NotFound {
    throw GrpcError.notFound();
  } on Unauthorized {
    throwUnauthorized();
  }
  entity = mapMapper.fromMap(map);

  return entity;
}