docs(arch): add documentation

This commit is contained in:
2023-04-13 23:29:27 +02:00
parent 7a3de79e36
commit e5e0550017
19 changed files with 90 additions and 30 deletions
@@ -36,7 +36,7 @@ class PhotoRepositoryImpl extends PhotoRepository {
@override
FutureOrResult<void> addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
() => _favoriteLocalDataSource.addPhotoToFavorites(photo),
(error) => ClientException('Cannot add photo to favorites.'),
(error) => const ClientException('Cannot add photo to favorites.'),
);
@override
@@ -63,14 +63,14 @@ class PhotoRepositoryImpl extends PhotoRepository {
FutureOrResult<List<Album>> getAllAlbums({int? start, int? limit}) =>
Result.tryCatchAsync(
() => _albumRemoteDataSource.getAllAlbums(start: start, limit: limit),
(error) => ServerException('Cannot retrieve all albums.'),
(error) => const ServerException('Cannot retrieve all albums.'),
);
@override
FutureOrResult<List<Photo>> getAllPhotos({int? start, int? limit}) async =>
Result.tryCatchAsync(
() => _photoRemoteDataSource.getAllPhotos(start: start, limit: limit),
(error) => ServerException('Cannot retrieve all photos.'),
(error) => const ServerException('Cannot retrieve all photos.'),
);
@override
@@ -88,7 +88,7 @@ class PhotoRepositoryImpl extends PhotoRepository {
}
return Ok(response);
} catch (_) {
return Err(
return const Err(
ClientException('Cannot retrieve all photos from favorites.'),
);
}
@@ -33,7 +33,7 @@ class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
@override
FutureOr<void> onStart(Photo? params) {
if (params == null) {
throw ClientException('Photo cannot be null');
throw const ClientException('Photo cannot be null');
}
}
}
@@ -30,7 +30,7 @@ class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw ClientException('id cannot be null');
throw const ClientException('id cannot be null');
}
}
}
@@ -33,7 +33,7 @@ class DisplayPhoto extends AsyncUseCase<int, Photo> {
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw ClientException('id cannot be null');
throw const ClientException('id cannot be null');
}
}
}
@@ -39,7 +39,7 @@ class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
@override
FutureOr<void> onStart(QueryParameters? params) {
if (params == null) {
throw ClientException('params cannot be null');
throw const ClientException('params cannot be null');
}
}
}
@@ -33,7 +33,7 @@ class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw ClientException('id cannot be null');
throw const ClientException('id cannot be null');
}
}
}
@@ -37,7 +37,7 @@ class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
@override
FutureOr<void> onStart(QueryParameters? params) {
if (params == null) {
throw ClientException('params cannot be null');
throw const ClientException('params cannot be null');
}
}
}