feat(mobile): people sync (#19777)

* feat(mobile): drift people sync

* merge main

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Daimolean
2025-07-18 22:21:39 +08:00
committed by GitHub
parent 2e63b9d951
commit 7bae49ebd5
30 changed files with 2197 additions and 63 deletions
@@ -34,6 +34,7 @@ class AuthRepository extends DatabaseRepository {
_drift.userMetadataEntity.deleteAll(),
_drift.partnerEntity.deleteAll(),
_drift.stackEntity.deleteAll(),
_drift.personEntity.deleteAll(),
]);
// Drift deletions - parent entities
await Future.wait([
@@ -13,19 +13,19 @@ class PersonApiRepository extends ApiRepository {
PersonApiRepository(this._api);
Future<List<Person>> getAll() async {
Future<List<PersonDto>> getAll() async {
final dto = await checkNull(_api.getAllPeople());
return dto.people.map(_toPerson).toList();
}
Future<Person> update(String id, {String? name}) async {
Future<PersonDto> update(String id, {String? name}) async {
final dto = await checkNull(
_api.updatePerson(id, PersonUpdateDto(name: name)),
);
return _toPerson(dto);
}
static Person _toPerson(PersonResponseDto dto) => Person(
static PersonDto _toPerson(PersonResponseDto dto) => PersonDto(
birthDate: dto.birthDate,
id: dto.id,
isHidden: dto.isHidden,