mirror of
https://github.com/immich-app/immich
synced 2025-06-10 10:38:24 +00:00

* refactor: user entity * fix: add users to album & user profile url * chore: rebase fixes * generate files * fix(mobile): timeline not reset on login * fix: test stub * refactor: rename user model (#16813) * refactor: rename user model * simplify import --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com> * chore: generate files * fix: use getAllAccessible instead of getAll --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
42 lines
1.2 KiB
Dart
42 lines
1.2 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:http/http.dart';
|
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
|
import 'package:immich_mobile/infrastructure/utils/user.converter.dart';
|
|
import 'package:immich_mobile/interfaces/user_api.interface.dart';
|
|
import 'package:immich_mobile/providers/api.provider.dart';
|
|
import 'package:immich_mobile/repositories/api.repository.dart';
|
|
import 'package:openapi/api.dart';
|
|
|
|
final userApiRepositoryProvider = Provider(
|
|
(ref) => UserApiRepository(
|
|
ref.watch(apiServiceProvider).usersApi,
|
|
),
|
|
);
|
|
|
|
class UserApiRepository extends ApiRepository implements IUserApiRepository {
|
|
final UsersApi _api;
|
|
|
|
UserApiRepository(this._api);
|
|
|
|
@override
|
|
Future<List<UserDto>> getAll() async {
|
|
final dto = await checkNull(_api.searchUsers());
|
|
return dto.map(UserConverter.fromSimpleUserDto).toList();
|
|
}
|
|
|
|
@override
|
|
Future<({String profileImagePath})> createProfileImage({
|
|
required String name,
|
|
required Uint8List data,
|
|
}) async {
|
|
final response = await checkNull(
|
|
_api.createProfileImage(
|
|
MultipartFile.fromBytes('file', data, filename: name),
|
|
),
|
|
);
|
|
return (profileImagePath: response.profileImagePath);
|
|
}
|
|
}
|