patch method

  1. @override
Future<T> patch({
  1. required String id,
  2. required Map<String, dynamic> delta,
  3. String? userId,
})
override

Apply a partial update ("patch") to an existing entity.

Implementation

@override
Future<T> patch({required String id, required Map<String, dynamic> delta, String? userId}) async {
  final existing = _storage[userId ?? '']?[id];
  if (existing == null) {
    throw EntityNotFoundException(message: 'Entity $id not found for user ${userId ?? ''}.');
  }
  final patched = fromMap(existing.toDatumMap()..addAll(delta));
  await update(patched);
  return patched;
}