2021-09-08 12:44:14 +02:00
|
|
|
import 'package:equatable/equatable.dart';
|
|
|
|
import 'package:nc_photos/account.dart';
|
2022-12-08 16:39:13 +01:00
|
|
|
import 'package:to_string/to_string.dart';
|
2021-09-08 12:44:14 +02:00
|
|
|
|
2022-12-08 16:39:13 +01:00
|
|
|
part 'person.g.dart';
|
|
|
|
|
|
|
|
@toString
|
2021-09-08 12:44:14 +02:00
|
|
|
class Person with EquatableMixin {
|
2022-08-05 11:14:03 +02:00
|
|
|
const Person({
|
2021-09-10 19:10:26 +02:00
|
|
|
required this.name,
|
|
|
|
required this.thumbFaceId,
|
|
|
|
required this.count,
|
2021-09-08 12:44:14 +02:00
|
|
|
});
|
|
|
|
|
2021-09-10 19:10:26 +02:00
|
|
|
@override
|
2022-12-08 16:39:13 +01:00
|
|
|
String toString() => _$toString();
|
2021-09-10 19:10:26 +02:00
|
|
|
|
2021-09-08 12:44:14 +02:00
|
|
|
@override
|
|
|
|
get props => [
|
|
|
|
name,
|
2021-09-10 19:10:26 +02:00
|
|
|
thumbFaceId,
|
|
|
|
count,
|
2021-09-08 12:44:14 +02:00
|
|
|
];
|
|
|
|
|
2021-09-10 19:10:26 +02:00
|
|
|
final String name;
|
|
|
|
final int thumbFaceId;
|
|
|
|
final int count;
|
2021-09-08 12:44:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class PersonRepo {
|
|
|
|
const PersonRepo(this.dataSrc);
|
|
|
|
|
|
|
|
/// See [PersonDataSource.list]
|
2021-09-15 08:58:06 +02:00
|
|
|
Future<List<Person>> list(Account account) => dataSrc.list(account);
|
2021-09-08 12:44:14 +02:00
|
|
|
|
|
|
|
final PersonDataSource dataSrc;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class PersonDataSource {
|
|
|
|
/// List all people for this account
|
|
|
|
Future<List<Person>> list(Account account);
|
|
|
|
}
|