Skip to content

armgit / ente

Public Imported from GitHub
0

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

Footprint

Manav Rathi2c0739e1d145
diff --git a/web/packages/new/photos/services/migrations.ts b/web/packages/new/photos/services/migrations.ts
index 0c4e18d9cf..eb1e07230c 100644
--- a/web/packages/new/photos/services/migrations.ts
+++ b/web/packages/new/photos/services/migrations.ts
@@ -75,4 +75,10 @@ const m1 = () =>
localForage.removeItem("location_tags"),
localForage.removeItem("location_tags_key"),
localForage.removeItem("location_tags_time"),
+
+ // Remove data from an intermediate format that stored user-entities
+ // piecewise instead of as generic, verbatim, entities.
+ removeKV("locationTags"),
+ removeKV("entityKey/locationTags"),
+ removeKV("latestUpdatedAt/locationTags"),
]);
diff --git a/web/packages/new/photos/services/user-entity/db.ts b/web/packages/new/photos/services/user-entity/db.ts
index 336277ce67..be1d4cd276 100644
--- a/web/packages/new/photos/services/user-entity/db.ts
+++ b/web/packages/new/photos/services/user-entity/db.ts
@@ -2,6 +2,14 @@ import { getKV, getKVN, setKV } from "@/base/kv";
import { LocalLocationTag, type EntityType, type LocationTag } from ".";
import { RemoteUserEntityKey } from "./remote";
+// Our DB footprint ---v
+
+const entityKey = (type: EntityType) => `entity/${type}`;
+const entityKeyKey = (type: EntityType) => `entity/${type}/key`;
+const latestUpdatedAtKey = (type: EntityType) => `entity/${type}/time`;
+
+// ^---
+
export const saveLocationTags = (tags: LocationTag[]) =>
setKV("locationTags", JSON.stringify(tags));
@@ -15,8 +23,6 @@ export const savedLocationTags = async () =>
JSON.parse((await getKV("locationTags")) ?? "[]"),
);
-const entityKeyKey = (type: EntityType) => `entityKey/${type}`;
-
/**
* Return the locally persisted {@link RemoteUserEntityKey}, if any,
* corresponding the given {@link type}.
@@ -29,15 +35,13 @@ export const savedRemoteUserEntityKey = (
);
/**
- * Setter for {@link entityKey}.
+ * Setter for {@link savedRemoteUserEntityKey}.
*/
export const saveRemoteUserEntityKey = (
type: EntityType,
entityKey: RemoteUserEntityKey,
) => setKV(entityKeyKey(type), JSON.stringify(entityKey));
-const latestUpdatedAtKey = (type: EntityType) => `latestUpdatedAt/${type}`;
-
/**
* Return the locally persisted value for the latest `updatedAt` time for the
* given entity {@link type}.