mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 09:16:19 +01:00
20 lines
540 B
Dart
20 lines
540 B
Dart
|
import 'package:event_bus/event_bus.dart';
|
||
|
import 'package:kiwi/kiwi.dart';
|
||
|
import 'package:nc_photos/account.dart';
|
||
|
import 'package:nc_photos/entity/album.dart';
|
||
|
import 'package:nc_photos/event/event.dart';
|
||
|
|
||
|
class CreateAlbum {
|
||
|
CreateAlbum(this.albumRepo);
|
||
|
|
||
|
Future<Album> call(Account account, Album album) async {
|
||
|
final newAlbum = await albumRepo.create(account, album);
|
||
|
KiwiContainer()
|
||
|
.resolve<EventBus>()
|
||
|
.fire(AlbumCreatedEvent(account, newAlbum));
|
||
|
return newAlbum;
|
||
|
}
|
||
|
|
||
|
final AlbumRepo albumRepo;
|
||
|
}
|