Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Rename person_v2 as cgroup

Neeraj Gupta1ca1967ec297
diff --git a/mobile/lib/models/api/entity/type.dart b/mobile/lib/models/api/entity/type.dart
index 05de5c7826..2114dc2c5b 100644
--- a/mobile/lib/models/api/entity/type.dart
+++ b/mobile/lib/models/api/entity/type.dart
@@ -3,7 +3,7 @@ import "package:flutter/foundation.dart";
enum EntityType {
location,
person,
- personV2,
+ cgroup,
unknown,
}
@@ -13,12 +13,10 @@ EntityType typeFromString(String type) {
return EntityType.location;
case "person":
return EntityType.location;
- case "person_v2":
- return EntityType.personV2;
- case "personV2":
- return EntityType.personV2;
+ case "cgroup":
+ return EntityType.cgroup;
}
- debugPrint("unexpected collection type $type");
+ debugPrint("unexpected entity type $type");
return EntityType.unknown;
}
@@ -36,8 +34,8 @@ extension EntityTypeExtn on EntityType {
return "location";
case EntityType.person:
return "person";
- case EntityType.personV2:
- return "person_v2";
+ case EntityType.cgroup:
+ return "cgroup";
case EntityType.unknown:
return "unknown";
}
diff --git a/mobile/lib/services/entity_service.dart b/mobile/lib/services/entity_service.dart
index e979d4fd9e..22089e7737 100644
--- a/mobile/lib/services/entity_service.dart
+++ b/mobile/lib/services/entity_service.dart
@@ -101,7 +101,7 @@ class EntityService {
Future<void> syncEntities() async {
try {
await _remoteToLocalSync(EntityType.location);
- await _remoteToLocalSync(EntityType.personV2);
+ await _remoteToLocalSync(EntityType.cgroup);
} catch (e) {
_logger.severe("Failed to sync entities", e);
}
diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
index fd676b8980..e8a0b78fc6 100644
--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
@@ -37,7 +37,7 @@ class PersonService {
}
Future<List<PersonEntity>> getPersons() async {
- final entities = await entityService.getEntities(EntityType.personV2);
+ final entities = await entityService.getEntities(EntityType.cgroup);
return entities
.map(
(e) => PersonEntity(e.id, PersonData.fromJson(json.decode(e.data))),
@@ -46,7 +46,7 @@ class PersonService {
}
Future<PersonEntity?> getPerson(String id) {
- return entityService.getEntity(EntityType.personV2, id).then((e) {
+ return entityService.getEntity(EntityType.cgroup, id).then((e) {
if (e == null) {
return null;
}
@@ -55,7 +55,7 @@ class PersonService {
}
Future<Map<String, PersonEntity>> getPersonsMap() async {
- final entities = await entityService.getEntities(EntityType.personV2);
+ final entities = await entityService.getEntities(EntityType.cgroup);
final Map<String, PersonEntity> map = {};
for (var e in entities) {
final person =
@@ -95,7 +95,7 @@ class PersonService {
)
.toList();
entityService
- .addOrUpdate(EntityType.personV2, personData.toJson(), id: personID)
+ .addOrUpdate(EntityType.cgroup, personData.toJson(), id: personID)
.ignore();
personData.logStats();
}
@@ -163,7 +163,7 @@ class PersonService {
isHidden: isHidden,
);
final result = await entityService.addOrUpdate(
- EntityType.personV2,
+ EntityType.cgroup,
data.toJson(),
);
await faceMLDataDB.assignClusterToPerson(
@@ -181,7 +181,7 @@ class PersonService {
final personData = person.data;
personData.assigned!.removeWhere((element) => element.id != clusterID);
await entityService.addOrUpdate(
- EntityType.personV2,
+ EntityType.cgroup,
personData.toJson(),
id: personID,
);
@@ -216,7 +216,7 @@ class PersonService {
}
await entityService.addOrUpdate(
- EntityType.personV2,
+ EntityType.cgroup,
personData.toJson(),
id: person.remoteID,
);
@@ -232,7 +232,7 @@ class PersonService {
final PersonEntity justName =
PersonEntity(personID, PersonData(name: entity.data.name));
await entityService.addOrUpdate(
- EntityType.personV2,
+ EntityType.cgroup,
justName.data.toJson(),
id: personID,
);
@@ -249,7 +249,7 @@ class PersonService {
Future<void> fetchRemoteClusterFeedback() async {
await entityService.syncEntities();
- final entities = await entityService.getEntities(EntityType.personV2);
+ final entities = await entityService.getEntities(EntityType.cgroup);
entities.sort((a, b) => a.updatedAt.compareTo(b.updatedAt));
final Map<String, String> faceIdToClusterID = {};
final Map<String, String> clusterToPersonID = {};
@@ -307,7 +307,7 @@ class PersonService {
Future<void> _updatePerson(PersonEntity updatePerson) async {
await entityService.addOrUpdate(
- EntityType.personV2,
+ EntityType.cgroup,
updatePerson.data.toJson(),
id: updatePerson.remoteID,
);