mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 10:37:11 -04:00 
			
		
		
		
	rebase: convert string ids to byte uuids
This commit is contained in:
		
							parent
							
								
									3dc25406a7
								
							
						
					
					
						commit
						1fdb78b05d
					
				| @ -1,3 +1,7 @@ | ||||
| import 'dart:typed_data'; | ||||
| 
 | ||||
| import 'package:uuid/parsing.dart'; | ||||
| 
 | ||||
| extension StringExtension on String { | ||||
|   String capitalize() { | ||||
|     return split(" ") | ||||
| @ -29,3 +33,7 @@ extension DurationExtension on String { | ||||
|     return int.parse(this); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| extension UUIDExtension on String { | ||||
|   Uint8List toUuidByte() => UuidParsing.parseAsByteList(this); | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| import 'package:drift/drift.dart'; | ||||
| import 'package:immich_mobile/domain/interfaces/sync_stream.interface.dart'; | ||||
| import 'package:immich_mobile/extensions/string_extensions.dart'; | ||||
| import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'; | ||||
| import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'; | ||||
| import 'package:immich_mobile/infrastructure/repositories/db.repository.dart'; | ||||
| @ -17,7 +18,7 @@ class DriftSyncStreamRepository extends DriftDatabaseRepository | ||||
|   Future<bool> deleteUsersV1(SyncUserDeleteV1 data) async { | ||||
|     try { | ||||
|       await _db.managers.userEntity | ||||
|           .filter((row) => row.id.equals(data.userId)) | ||||
|           .filter((row) => row.id.equals(data.userId.toUuidByte())) | ||||
|           .delete(); | ||||
|       return true; | ||||
|     } catch (e, s) { | ||||
| @ -35,7 +36,7 @@ class DriftSyncStreamRepository extends DriftDatabaseRepository | ||||
| 
 | ||||
|     try { | ||||
|       await _db.userEntity.insertOne( | ||||
|         companion.copyWith(id: Value(data.id)), | ||||
|         companion.copyWith(id: Value(data.id.toUuidByte())), | ||||
|         onConflict: DoUpdate((_) => companion), | ||||
|       ); | ||||
|       return true; | ||||
| @ -51,8 +52,8 @@ class DriftSyncStreamRepository extends DriftDatabaseRepository | ||||
|       await _db.managers.partnerEntity | ||||
|           .filter( | ||||
|             (row) => | ||||
|                 row.sharedById.id.equals(data.sharedById) & | ||||
|                 row.sharedWithId.id.equals(data.sharedWithId), | ||||
|                 row.sharedById.id.equals(data.sharedById.toUuidByte()) & | ||||
|                 row.sharedWithId.id.equals(data.sharedWithId.toUuidByte()), | ||||
|           ) | ||||
|           .delete(); | ||||
|       return true; | ||||
| @ -70,14 +71,14 @@ class DriftSyncStreamRepository extends DriftDatabaseRepository | ||||
|     try { | ||||
|       await _db.partnerEntity.insertOne( | ||||
|         companion.copyWith( | ||||
|           sharedById: Value(data.sharedById), | ||||
|           sharedWithId: Value(data.sharedWithId), | ||||
|           sharedById: Value(data.sharedById.toUuidByte()), | ||||
|           sharedWithId: Value(data.sharedWithId.toUuidByte()), | ||||
|         ), | ||||
|         onConflict: DoUpdate((_) => companion), | ||||
|       ); | ||||
|       return true; | ||||
|     } catch (e, s) { | ||||
|       _logger.severe('Error while processing SyncUserV1', e, s); | ||||
|       _logger.severe('Error while processing SyncPartnerV1', e, s); | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @ -1798,7 +1798,7 @@ packages: | ||||
|     source: hosted | ||||
|     version: "3.1.4" | ||||
|   uuid: | ||||
|     dependency: transitive | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: uuid | ||||
|       sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff | ||||
|  | ||||
| @ -60,6 +60,7 @@ dependencies: | ||||
|   thumbhash: 0.1.0+1 | ||||
|   timezone: ^0.9.4 | ||||
|   url_launcher: ^6.3.1 | ||||
|   uuid: ^4.5.1 | ||||
|   wakelock_plus: ^1.2.10 | ||||
| 
 | ||||
|   native_video_player: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user