Skip to content

armgit / ente

Public Imported from GitHub
0

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

Temp scaffold and cast

Manav Rathi9fde80593fc7
diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts
index a2ef44a624..d4c49bbcc0 100644
--- a/web/apps/photos/src/services/collectionService.ts
+++ b/web/apps/photos/src/services/collectionService.ts
@@ -59,10 +59,13 @@ const FAVORITE_COLLECTION_NAME = "Favorites";
const REQUEST_BATCH_SIZE = 1000;
export const createAlbum = (albumName: string) => {
+ // TODO(C2):
if (isDevBuild && process.env.NEXT_PUBLIC_ENTE_WIP_NEWIMPL) {
- // TODO: WIP
- console.log(createCollection2);
- // return createCollection2(albumName, "album");
+ // TODO(C2):
+ // In general this cast would not necessarily be correct, but we still
+ // need to add it as temporary scaffolding as part of the migration to
+ // the new type.
+ return createCollection2(albumName, "album") as Promise<Collection>;
}
return createCollection(albumName, "album");
};
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index 120b313e5c..32b658401f 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -116,6 +116,10 @@ export interface Collection2 {
* See: [Note: Metadatum]
*/
sharedMagicMetadata?: MagicMetadata<CollectionShareeMagicMetadataData>;
+ // TODO(C2): Temporarily forwarded for compatilibity with the existing
+ // collection type.
+ isDeleted: boolean;
+ attributes: unknown;
}
/**
@@ -318,9 +322,9 @@ export interface EncryptedCollection {
publicURLs?: PublicURL[];
updationTime: number;
isDeleted: boolean;
- magicMetadata: EncryptedMagicMetadata;
- pubMagicMetadata: EncryptedMagicMetadata;
- sharedMagicMetadata: EncryptedMagicMetadata;
+ magicMetadata?: EncryptedMagicMetadata;
+ pubMagicMetadata?: EncryptedMagicMetadata;
+ sharedMagicMetadata?: EncryptedMagicMetadata;
}
export interface Collection
@@ -423,6 +427,9 @@ export const decryptRemoteCollection = async (
magicMetadata,
pubMagicMetadata,
sharedMagicMetadata,
+ // TODO(C2):
+ isDeleted: !!collection.isDeleted,
+ attributes: {},
};
};
@@ -590,13 +597,14 @@ export interface RemoveFromCollectionRequest {
}
export interface CollectionMagicMetadataProps {
- visibility?: ItemVisibility;
- subType?: CollectionSubType;
+ visibility?: number; // ItemVisibility;
+ subType?: number; // CollectionSubType;
order?: number;
}
export type CollectionMagicMetadata =
- MagicMetadataCore<CollectionMagicMetadataProps>;
+ // TODO(C2):
+ Omit<MagicMetadataCore<CollectionMagicMetadataProps>, "header">;
export interface CollectionShareeMetadataProps {
visibility?: ItemVisibility;