From bd4c506fdd16615fda274b1fed30e9009583e08c Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 5 Apr 2024 07:50:03 +0530 Subject: [PATCH] [mob] Remove fields & code related to person table --- mobile/lib/face/db.dart | 3 --- mobile/lib/face/db_fields.dart | 16 ---------------- mobile/lib/face/db_model_mappers.dart | 26 -------------------------- 3 files changed, 45 deletions(-) diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index 617d81bdb8..eaf90962b3 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -49,7 +49,6 @@ class FaceMLDataDB { Future _onCreate(Database db, int version) async { await db.execute(createFacesTable); - await db.execute(createPersonTable); await db.execute(createClusterPersonTable); await db.execute(createClusterSummaryTable); await db.execute(createNotPersonFeedbackTable); @@ -637,7 +636,6 @@ class FaceMLDataDB { await db.execute(dropClusterSummaryTable); await db.execute(dropNotPersonFeedbackTable); - await db.execute(createPersonTable); await db.execute(createClusterPersonTable); await db.execute(createNotPersonFeedbackTable); await db.execute(createClusterSummaryTable); @@ -651,7 +649,6 @@ class FaceMLDataDB { await db.execute(dropClusterPersonTable); await db.execute(dropNotPersonFeedbackTable); await db.execute(dropClusterSummaryTable); - await db.execute(createPersonTable); await db.execute(createClusterPersonTable); await db.execute(createNotPersonFeedbackTable); await db.execute(createClusterSummaryTable); diff --git a/mobile/lib/face/db_fields.dart b/mobile/lib/face/db_fields.dart index a3dcba3236..a6f28542a8 100644 --- a/mobile/lib/face/db_fields.dart +++ b/mobile/lib/face/db_fields.dart @@ -48,22 +48,6 @@ const dropFaceClustersTable = 'DROP TABLE IF EXISTS $faceClustersTable'; // People Table Fields & Schema Queries const personTable = 'person'; -const idColumn = 'id'; -const nameColumn = 'name'; -const enteUserIdColumn = 'ente_user_id'; -const personHiddenColumn = 'hidden'; -const clusterToFaceIdJson = 'clusterToFaceIds'; -const coverFaceIDColumn = 'cover_face_id'; - -const createPersonTable = '''CREATE TABLE IF NOT EXISTS $personTable ( - $idColumn TEXT NOT NULL UNIQUE, - $nameColumn TEXT NOT NULL DEFAULT '', - $personHiddenColumn INTEGER NOT NULL DEFAULT 0, - $clusterToFaceIdJson TEXT NOT NULL DEFAULT '{}', - $coverFaceIDColumn TEXT, - PRIMARY KEY($idColumn) - ); - '''; const deletePersonTable = 'DROP TABLE IF EXISTS $personTable'; //End People Table Fields & Schema Queries diff --git a/mobile/lib/face/db_model_mappers.dart b/mobile/lib/face/db_model_mappers.dart index 4f0f4fa4c1..a85cd750a2 100644 --- a/mobile/lib/face/db_model_mappers.dart +++ b/mobile/lib/face/db_model_mappers.dart @@ -3,7 +3,6 @@ import "dart:convert"; import 'package:photos/face/db_fields.dart'; import "package:photos/face/model/detection.dart"; import "package:photos/face/model/face.dart"; -import "package:photos/face/model/person.dart"; import "package:photos/generated/protos/ente/common/vector.pb.dart"; import "package:photos/models/ml/ml_versions.dart"; @@ -25,31 +24,6 @@ bool sqlIntToBool(int? value, {bool defaultValue = false}) { } } -Map mapPersonToRow(PersonEntity p) { - return { - idColumn: p.remoteID, - nameColumn: p.data.name, - personHiddenColumn: boolToSQLInt(p.data.isHidden), - coverFaceIDColumn: p.data.avatarFaceId, - clusterToFaceIdJson: - p.data.assigned != null ? jsonEncode(p.data.assigned!.toList()) : '{}', - }; -} - -PersonEntity mapRowToPerson(Map row) { - return PersonEntity( - row[idColumn] as String, - PersonData( - name: row[nameColumn] as String, - isHidden: sqlIntToBool(row[personHiddenColumn] as int), - avatarFaceId: row[coverFaceIDColumn] as String?, - assigned: (json.decode(row[clusterToFaceIdJson] as String) as List) - .map((e) => ClusterInfo.fromJson(e as Map)) - .toList(), - ), - ); -} - Map mapRemoteToFaceDB(Face face) { return { faceIDColumn: face.faceID,