Feat: Replace UUID image identifiers with 8-character base62 short IDs
Short IDs become the canonical identifier in URLs (/i/:short_id), MinIO/R2 storage keys, and all API responses. Hash-based deduplication is preserved. Includes two-phase Alembic migration (003 adds nullable column, 004 enforces NOT NULL) with a backfill script to copy storage objects and populate short_id for existing images. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
|
||||
|
||||
export interface ImageRecord {
|
||||
id: string;
|
||||
short_id: string;
|
||||
hash: string;
|
||||
filename: string;
|
||||
mime_type: string;
|
||||
@@ -50,14 +51,14 @@ export class ImageService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<ImageRecord> {
|
||||
return this.http.get<ImageRecord>(`${this.base}/images/${id}`);
|
||||
return this.http.get<ImageRecord>(`${this.base}/i/${id}`);
|
||||
}
|
||||
|
||||
updateTags(id: string, tags: string[]): Observable<ImageRecord> {
|
||||
return this.http.patch<ImageRecord>(`${this.base}/images/${id}/tags`, { tags });
|
||||
return this.http.patch<ImageRecord>(`${this.base}/i/${id}/tags`, { tags });
|
||||
}
|
||||
|
||||
delete(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`${this.base}/images/${id}`);
|
||||
return this.http.delete<void>(`${this.base}/i/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user