The version before this made a collection out of every folder under originals/COLLECTIONS/. It kept the disk and the database in step for free, and it also let whoever last tidied a directory decide the website's structure. A collection is editorial: it exists because somebody made it, named it and put photographs in it. Its photographs are a GALLERY — the feature that already means "a named, ordered set of media", with a picker and an order somebody dragged into place. A collection points at one rather than growing a private copy, so ordering stays maintained in the one screen that owns ordering, and the same set can appear in a collection and on a page without being chosen twice. That is why the grid here is not draggable and has no Add: both belong to Galleries. What is decided HERE is which photograph leads, because that is a fact about the collection rather than about the set. Creating is a name and a button under the list it adds to, and it selects what it made — a dialog for one field is a dialog nobody thanks you for. Deleting removes the collection and never the photographs, which the button says out loud rather than leaving somebody to find out. Changing the gallery clears the cover. The new set is different photographs, so a cover chosen from the old one is a path that may not be there, and falling back silently would be a choice quietly reverting itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
21 lines
698 B
TypeScript
21 lines
698 B
TypeScript
/** A collection, as the site's admin API serialises one. Snake case: it is the wire, not our shape. */
|
|
export type Collection = {
|
|
id: number;
|
|
/** The gallery holding its photographs, or null while nobody has chosen one. */
|
|
gallery_id: number | null;
|
|
title: string;
|
|
slug: string | null;
|
|
/** A media PATH, the same string a gallery item holds — see the site's schema. */
|
|
cover: string | null;
|
|
description: string | null;
|
|
descriptive_text: string | null;
|
|
measurement: string | null;
|
|
material: string | null;
|
|
colors: string | null;
|
|
delivery_time: string | null;
|
|
sort_order: number;
|
|
photo_count: number;
|
|
};
|
|
|
|
export type CollectionPhoto = { path: string; name: string };
|