Pick and add-to-heap were two ways of saying "I want to keep this
one". Merging them: P now toggles the selection's membership in the
active heap. The is_picked flag goes away (orphaned in the DB the
same way is_trashed was).
Backend
- Drop is_picked from PhotoBase / PhotoUpdate / PhotoResponse and
from the photos list filter param.
- Drop the is_picked Column from the Photo model (DB column stays
on legacy installs but is no longer read or written).
- Drop the bulk action 'pick' branch.
- New GET /heaps/{id}/photo_ids returns just the flat string list.
Used by the frontend for fast client-side membership lookups
without fetching full photo records.
Frontend
- New hooks/useActiveHeapMembersQuery.ts → returns
{ activeHeap, memberIds: Set<string> }. Subscribes once at the
Timeline level and passes a derived isInActiveHeap bool down to
each PhotoThumbnail (avoids hundreds of thumbnails subscribing
to the same query).
- PhotoThumbnail: replaces the old check-icon Pick affordance with
a clear basket badge in the bottom-right corner — a small filled
pick-colour pill containing a ShoppingBasket icon — visible only
when the photo belongs to the active heap.
- P shortcut (useKeyboardShortcuts) now toggles membership: if every
selected photo is already a member, it removes them; otherwise it
adds the missing ones. T binding removed (P fully replaces it).
- RightSidebar Pick button is now a Pick / Picked toggle bound to
the active heap. Disabled with a hint when no heap is active.
Shows the heap name in its title attr.
- filterStore drops 'picked' and 'unflagged' from FlagFilter.
FilterBar's flag dropdown is now just Any / Discarded.
- LeftSidebar drops the "Flagged" virtual node (it just set
flag=picked, which no longer exists).
- KeyboardHints: P → "Pick → heap".
- Photo TS type drops is_picked.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
"""
|
|
Pydantic schemas for photos
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List, Dict, Any
|
|
from datetime import datetime
|
|
|
|
class PhotoBase(BaseModel):
|
|
"""Base photo schema"""
|
|
filename: str
|
|
media_type: str
|
|
original_format: Optional[str] = None
|
|
width: Optional[int] = None
|
|
height: Optional[int] = None
|
|
file_size: Optional[int] = None
|
|
taken_at: Optional[datetime] = None
|
|
taken_at_source: Optional[str] = None
|
|
user_title: Optional[str] = None
|
|
user_notes: Optional[str] = None
|
|
rating: int = 0
|
|
color_label: Optional[str] = None
|
|
|
|
class PhotoResponse(PhotoBase):
|
|
"""Photo response schema"""
|
|
id: str
|
|
filepath: str
|
|
folder_id: Optional[str] = None
|
|
file_hash: Optional[str] = None
|
|
added_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
is_discarded: bool = False
|
|
discarded_at: Optional[datetime] = None
|
|
thumb_small: Optional[str] = None
|
|
thumb_medium: Optional[str] = None
|
|
thumb_large: Optional[str] = None
|
|
processing_status: str = 'pending'
|
|
processing_error: Optional[str] = None
|
|
exif_json: Optional[str] = None
|
|
is_duplicate: bool = False
|
|
live_photo_video_id: Optional[str] = None
|
|
# tags: List[Dict[str, Any]] = [] # TODO: Enable when using eager loading
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
from_attributes = True
|
|
|
|
class PhotoUpdate(BaseModel):
|
|
"""Photo update schema"""
|
|
user_title: Optional[str] = None
|
|
user_notes: Optional[str] = None
|
|
rating: Optional[int] = Field(None, ge=0, le=5)
|
|
color_label: Optional[str] = None
|
|
is_discarded: Optional[bool] = None
|
|
taken_at: Optional[datetime] = None
|
|
|
|
class PhotoListResponse(BaseModel):
|
|
"""Photo list response with pagination"""
|
|
photos: List[PhotoResponse]
|
|
total: int
|
|
page: int
|
|
per_page: int
|
|
pages: int
|
|
|
|
class BulkAction(BaseModel):
|
|
"""Bulk action on photos"""
|
|
ids: List[str]
|
|
action: str # 'discard', 'restore', 'delete_permanent', 'move', 'copy', 'add_tag', 'remove_tag', 'set_rating', 'set_color'
|
|
value: Optional[Any] = None # For actions that need a value (rating, color, tag_id, folder_id) |