Skip to content

armgit / ente

Public Imported from GitHub
0

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

Sketch

Manav Rathi432d44f4af0d
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index 977ec602be..16cd248b1e 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -425,6 +425,51 @@ export const decryptRemoteCollection = (
user: CollectionDecryptionUser,
): Promise<Collection> => {};
+/**
+ * Additional context stored as part of the collection's magic metadata to
+ * augment the {@link type} associated with a {@link Collection}.
+ */
+export const CollectionSubType = {
+ default: 0,
+ defaultHidden: 1,
+ quicklink: 2,
+} as const;
+
+export type CollectionSubType =
+ (typeof CollectionSubType)[keyof typeof CollectionSubType];
+
+/**
+ * Mutable private metadata associated with an {@link Collection}.
+ *
+ * - Unlike {@link CollectionPublicMagicMetadata} this is only available to the
+ * owner of the file.
+ *
+ * See: [Note: Private magic metadata is called magic metadata on remote]
+ */
+export interface CollectionPrivateMagicMetadata {
+ /**
+ * The (owner specific) visibility of the collection.
+ *
+ * and independently edit its visibility without revealing their visibility
+ * preference to the other people with whom they have shared the file.
+ */
+ visibility?: ItemVisibility;
+ /**
+ * The {@link CollectionSubType}, if applicable.
+ */
+ subType?: CollectionSubType;
+ /**
+ * An overrride to the sort ordering used for the collection.
+ *
+ * - For pinned collections, this will be set to `1`. Pinned collections
+ * will be moved to the beginning of the sort order.
+ *
+ * - Otherwise, the collection is a normal (unpinned) collection, and will
+ * retain its natural sort position.
+ */
+ order?: number;
+}
+
export interface UpdatePublicURL {
collectionID: number;
disablePassword?: boolean;
@@ -449,15 +494,6 @@ export interface RemoveFromCollectionRequest {
fileIDs: number[];
}
-export const CollectionSubType = {
- default: 0,
- defaultHidden: 1,
- quicklink: 2,
-} as const;
-
-export type CollectionSubType =
- (typeof CollectionSubType)[keyof typeof CollectionSubType];
-
export interface CollectionMagicMetadataProps {
visibility?: ItemVisibility;
subType?: CollectionSubType;
diff --git a/web/packages/media/file-metadata.ts b/web/packages/media/file-metadata.ts
index 4c2e25bf12..9c1c3f5f82 100644
--- a/web/packages/media/file-metadata.ts
+++ b/web/packages/media/file-metadata.ts
@@ -200,11 +200,17 @@ export interface PrivateMagicMetadata {
* The visibility of an Ente file or collection.
*/
export const ItemVisibility = {
- /** The normal state - The item is visible. */
+ /**
+ * The normal state - The item is visible.
+ */
visible: 0,
- /** The item has been archived. */
+ /**
+ * The item has been archived.
+ */
archived: 1,
- /** The item has been hidden. */
+ /**
+ * The item has been hidden.
+ */
hidden: 2,
} as const;
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.ts
index da2d4b647b..6697850801 100644
--- a/web/packages/new/photos/services/collection.ts
+++ b/web/packages/new/photos/services/collection.ts
@@ -6,6 +6,8 @@ import {
CollectionSubType,
type Collection,
type CollectionNewParticipantRole,
+ type CollectionPrivateMagicMetadata,
+ type CollectionType,
} from "ente-media/collection";
import { type EnteFile } from "ente-media/file";
import { ItemVisibility } from "ente-media/file-metadata";
@@ -93,9 +95,11 @@ export const getCollectionUserFacingName = (collection: Collection) => {
* @param magicMetadata Optional metadata to use as the collection's private
* mutable metadata when creating the new collection.
*/
-export const createCollection => {
-
-}
+export const createCollection = (
+ name: string,
+ type: CollectionType,
+ magicMetadata?: CollectionPrivateMagicMetadata,
+): Promise<Collection> => {};
/**
* Return a map of the (user-facing) collection name, indexed by collection ID.