Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
feat(albums): add album and intra-album photo ordering
Alexander Sysoev470173d0d6ee
diff --git a/app/pages/dashboard/albums.vue b/app/pages/dashboard/albums.vueindex d36e3e05..88936f68 100644--- a/app/pages/dashboard/albums.vue+++ b/app/pages/dashboard/albums.vue@@ -231,6 +231,49 @@ const deleteAlbum = async () => {}}+// Move an album one step up (-1) or down (+1) and persist the new order.+// Optimistic update: revert and toast on failure. Only one reorder request+// runs at a time so a failed revert cannot clobber a later move.+const isReorderingAlbums = ref(false)+const moveAlbum = async (index: number, direction: -1 | 1) => {+ if (isReorderingAlbums.value) return+ const target = index + direction+ if (target < 0 || target >= albums.value.length) return+ isReorderingAlbums.value = true++ const previous = albums.value+ const next = [...albums.value]+ ;[next[index], next[target]] = [next[target]!, next[index]!]+ albums.value = next++ try {+ await $fetch('/api/albums/reorder', {+ method: 'PUT',+ body: { albumIds: next.map((album) => album.id) },+ })+ } catch (error) {+ console.error('Failed to reorder albums:', error)+ albums.value = previous+ useToast().add({+ title: $t('dashboard.albums.messages.reorderError'),+ color: 'error',+ })+ } finally {+ isReorderingAlbums.value = false+ }+}++// Move a selected photo one step up (-1) or down (+1) within the album.+// Persisted on save via PUT /api/albums/:id (order = selectedPhotoIds order).+const movePhoto = (index: number, direction: -1 | 1) => {+ const target = index + direction+ if (target < 0 || target >= selectedPhotoIds.value.length) return++ const next = [...selectedPhotoIds.value]+ ;[next[index], next[target]] = [next[target]!, next[index]!]+ selectedPhotoIds.value = next+}+const togglePhotoSelection = (photoId: string) => {const index = selectedPhotoIds.value.indexOf(photoId)if (index > -1) {@@ -513,6 +556,24 @@ const columns = computed<any[]>(() => [<template #actions-cell="{ row }"><div class="flex gap-1">+ <UButton+ variant="ghost"+ color="neutral"+ size="xs"+ icon="tabler:chevron-up"+ :disabled="row.index === 0 || isReorderingAlbums"+ :aria-label="$t('dashboard.albums.actions.moveUp')"+ @click="moveAlbum(row.index, -1)"+ />+ <UButton+ variant="ghost"+ color="neutral"+ size="xs"+ icon="tabler:chevron-down"+ :disabled="row.index === albums.length - 1 || isReorderingAlbums"+ :aria-label="$t('dashboard.albums.actions.moveDown')"+ @click="moveAlbum(row.index, 1)"+ /><UButtonvariant="ghost"color="primary"@@ -703,7 +764,7 @@ const columns = computed<any[]>(() => [class="grid grid-cols-4 gap-2 p-3 bg-gray-50 dark:bg-neutral-800/50 rounded-lg border border-gray-200 dark:border-neutral-700"><div- v-for="photoId in selectedPhotoIds"+ v-for="(photoId, index) in selectedPhotoIds":key="photoId"class="relative group aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700">@@ -723,15 +784,44 @@ const columns = computed<any[]>(() => [{{ $t('dashboard.albums.modal.setCover') }}</div>- <button- class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"- @click="togglePhotoSelection(photoId)"+ <div+ class="absolute top-1 right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-black/60 px-1 text-[10px] font-semibold text-white">- <Icon- name="tabler:x"- class="text-white"+ {{ index + 1 }}+ </div>++ <div+ class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex flex-wrap items-center justify-center gap-1"+ >+ <UButton+ size="xs"+ color="neutral"+ variant="solid"+ icon="tabler:chevron-up"+ :disabled="index === 0"+ :aria-label="$t('dashboard.albums.form.movePhotoUp')"+ @click="movePhoto(index, -1)"+ />+ <UButton+ size="xs"+ color="neutral"+ variant="solid"+ icon="tabler:chevron-down"+ :disabled="index === selectedPhotoIds.length - 1"+ :aria-label="+ $t('dashboard.albums.form.movePhotoDown')+ "+ @click="movePhoto(index, 1)"/>- </button>+ <UButton+ size="xs"+ color="error"+ variant="solid"+ icon="tabler:x"+ :aria-label="$t('dashboard.albums.form.removePhoto')"+ @click="togglePhotoSelection(photoId)"+ />+ </div></div></div></div>diff --git a/i18n/locales/en.json b/i18n/locales/en.jsonindex 160f7932..b3080285 100644--- a/i18n/locales/en.json+++ b/i18n/locales/en.json@@ -852,7 +852,10 @@"selectedCount": "Selected {count} photos","clearAll": "Clear all","isHidden": "Hide album",- "isHiddenHint": "Photos in hidden albums are not shown on the home page"+ "isHiddenHint": "Photos in hidden albums are not shown on the home page",+ "movePhotoUp": "Move photo up",+ "movePhotoDown": "Move photo down",+ "removePhoto": "Remove photo"},"table": {"columns": {@@ -907,9 +910,14 @@"deleteError": "Failed to delete album","loadError": "Failed to load albums","loadDetailError": "Failed to load album details",- "loadPhotosError": "Failed to load photos"+ "loadPhotosError": "Failed to load photos",+ "reorderError": "Failed to reorder albums"},- "photoCount": "{count} photos"+ "photoCount": "{count} photos",+ "actions": {+ "moveUp": "Move up",+ "moveDown": "Move down"+ }},"overview": {"title": "Overview",diff --git a/i18n/locales/ja.json b/i18n/locales/ja.jsonindex 97dc4108..b8a494f0 100644--- a/i18n/locales/ja.json+++ b/i18n/locales/ja.json@@ -778,7 +778,10 @@"selectedCount": "{count}枚の写真を選択しました","clearAll": "すべてクリア","isHidden": "アルバムを非表示",- "isHiddenHint": "非表示のアルバム内の写真はホームページに表示されません"+ "isHiddenHint": "非表示のアルバム内の写真はホームページに表示されません",+ "movePhotoUp": "写真を上へ移動",+ "movePhotoDown": "写真を下へ移動",+ "removePhoto": "写真を選択から外す"},"table": {"columns": {@@ -833,9 +836,14 @@"deleteError": "アルバムの削除に失敗しました","loadError": "アルバムの読み込みに失敗しました","loadDetailError": "アルバムの詳細の読み込みに失敗しました",- "loadPhotosError": "写真の読み込みに失敗しました"+ "loadPhotosError": "写真の読み込みに失敗しました",+ "reorderError": "アルバムの並べ替えに失敗しました"},- "photoCount": "{count} 枚"+ "photoCount": "{count} 枚",+ "actions": {+ "moveUp": "上へ移動",+ "moveDown": "下へ移動"+ }},"overview": {"title": "概要",diff --git a/i18n/locales/ru.json b/i18n/locales/ru.jsonindex 78a4ccfc..72861ba1 100644--- a/i18n/locales/ru.json+++ b/i18n/locales/ru.json@@ -851,7 +851,10 @@"selectedCount": "Выбрано фотографий: {count}","clearAll": "Очистить всё","isHidden": "Скрыть альбом",- "isHiddenHint": "Фотографии из скрытых альбомов не отображаются на главной странице"+ "isHiddenHint": "Фотографии из скрытых альбомов не отображаются на главной странице",+ "movePhotoUp": "Переместить фотографию вверх",+ "movePhotoDown": "Переместить фотографию вниз",+ "removePhoto": "Убрать фотографию"},"table": {"columns": {@@ -906,9 +909,14 @@"deleteError": "Не удалось удалить альбом","loadError": "Не удалось загрузить альбомы","loadDetailError": "Не удалось загрузить сведения об альбоме",- "loadPhotosError": "Не удалось загрузить фотографии"+ "loadPhotosError": "Не удалось загрузить фотографии",+ "reorderError": "Не удалось изменить порядок альбомов"},- "photoCount": "Фотографий: {count}"+ "photoCount": "Фотографий: {count}",+ "actions": {+ "moveUp": "Переместить вверх",+ "moveDown": "Переместить вниз"+ }},"overview": {"title": "Обзор",diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.jsonindex 0bd541f6..550ff9dc 100644--- a/i18n/locales/zh-Hans.json+++ b/i18n/locales/zh-Hans.json@@ -852,7 +852,10 @@"selectedCount": "已选择 {count} 张照片","clearAll": "全部清除","isHidden": "隐藏相簿",- "isHiddenHint": "隐藏的相簿中的照片不会在首页展示"+ "isHiddenHint": "隐藏的相簿中的照片不会在首页展示",+ "movePhotoUp": "上移照片",+ "movePhotoDown": "下移照片",+ "removePhoto": "移除照片"},"table": {"columns": {@@ -907,9 +910,14 @@"deleteError": "删除相簿失败","loadError": "加载相簿失败","loadDetailError": "加载相簿详情失败",- "loadPhotosError": "加载照片失败"+ "loadPhotosError": "加载照片失败",+ "reorderError": "相簿排序失败"},- "photoCount": "{count} 张"+ "photoCount": "{count} 张",+ "actions": {+ "moveUp": "上移",+ "moveDown": "下移"+ }},"overview": {"title": "仪表板概览",diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.jsonindex 4f4e6b6c..658f5b3f 100644--- a/i18n/locales/zh-Hant-HK.json+++ b/i18n/locales/zh-Hant-HK.json@@ -778,7 +778,10 @@"selectedCount": "已選擇 {count} 張相片","clearAll": "全部清除","isHidden": "隱藏相簿",- "isHiddenHint": "隱藏相簿中的照片不會在首頁顯示"+ "isHiddenHint": "隱藏相簿中的照片不會在首頁顯示",+ "movePhotoUp": "上移相片",+ "movePhotoDown": "下移相片",+ "removePhoto": "移除相片"},"table": {"columns": {@@ -833,9 +836,14 @@"deleteError": "刪除相簿失敗","loadError": "載入相簿失敗","loadDetailError": "載入相簿詳情失敗",- "loadPhotosError": "載入相片失敗"+ "loadPhotosError": "載入相片失敗",+ "reorderError": "相簿排序失敗"},- "photoCount": "{count} 張"+ "photoCount": "{count} 張",+ "actions": {+ "moveUp": "上移",+ "moveDown": "下移"+ }},"overview": {"title": "儀表板概覽",diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.jsonindex 254ab1f0..3b759dde 100644--- a/i18n/locales/zh-Hant-TW.json+++ b/i18n/locales/zh-Hant-TW.json@@ -778,7 +778,10 @@"selectedCount": "已選擇 {count} 張照片","clearAll": "全部清除","isHidden": "隱藏相簿",- "isHiddenHint": "隱藏相簿中的照片不會在首頁顯示"+ "isHiddenHint": "隱藏相簿中的照片不會在首頁顯示",+ "movePhotoUp": "上移照片",+ "movePhotoDown": "下移照片",+ "removePhoto": "移除照片"},"table": {"columns": {@@ -833,9 +836,14 @@"deleteError": "刪除相簿失敗","loadError": "載入相簿失敗","loadDetailError": "載入相簿詳情失敗",- "loadPhotosError": "載入照片失敗"+ "loadPhotosError": "載入照片失敗",+ "reorderError": "相簿排序失敗"},- "photoCount": "{count} 張"+ "photoCount": "{count} 張",+ "actions": {+ "moveUp": "上移",+ "moveDown": "下移"+ }},"overview": {"title": "儀表板總覽",diff --git a/server/api/albums/index.get.ts b/server/api/albums/index.get.tsindex 1aa99845..ad857bd2 100644--- a/server/api/albums/index.get.ts+++ b/server/api/albums/index.get.ts@@ -1,8 +1,13 @@+import { asc, desc } from 'drizzle-orm'+export default eventHandler(async (_event) => {const db = useDB()- // 获取所有相册,按创建时间倒序- const albums = await db.select().from(tables.albums)+ // Fetch all albums ordered by position asc (createdAt desc as secondary sort)+ const albums = await db+ .select()+ .from(tables.albums)+ .orderBy(asc(tables.albums.position), desc(tables.albums.createdAt))// 为每个相册获取照片 ID 列表(避免循环引用)const albumsWithPhotoIds = await Promise.all(@@ -24,8 +29,6 @@ export default eventHandler(async (_event) => {}),)- // 按创建时间倒序排列- return albumsWithPhotoIds.sort(- (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),- )+ // Already ordered by position asc at the SQL layer+ return albumsWithPhotoIds})diff --git a/server/api/albums/index.post.ts b/server/api/albums/index.post.tsindex 4e6d5b10..a7eac77d 100644--- a/server/api/albums/index.post.ts+++ b/server/api/albums/index.post.ts@@ -1,3 +1,4 @@+import { min } from 'drizzle-orm'import z from 'zod'export default eventHandler(async (event) => {@@ -17,6 +18,14 @@ export default eventHandler(async (event) => {const db = useDB()const album = db.transaction((tx) => {+ // Place new album first (min position minus one gap), preserving the+ // default "newest first" order+ const minRow = tx+ .select({ min: min(tables.albums.position) })+ .from(tables.albums)+ .get()+ const position = (minRow?.min ?? 1000) - 1000+const newAlbum = tx.insert(tables.albums).values({@@ -24,6 +33,7 @@ export default eventHandler(async (event) => {description: body.description || null,coverPhotoId: body.coverPhotoId || null,isHidden: body.isHidden || false,+ position,}).returning().get()diff --git a/server/api/albums/reorder.put.ts b/server/api/albums/reorder.put.tsnew file mode 100644index 00000000..e9539b71--- /dev/null+++ b/server/api/albums/reorder.put.ts@@ -0,0 +1,26 @@+import z from 'zod'++export default eventHandler(async (event) => {+ await requireUserSession(event)++ const { albumIds } = await readValidatedBody(+ event,+ z.object({+ albumIds: z.array(z.number().int()),+ }).parse,+ )++ const db = useDB()++ // Reassign position by incoming order (gap of 1000 to ease future inserts)+ db.transaction((tx) => {+ albumIds.forEach((id, index) => {+ tx.update(tables.albums)+ .set({ position: index * 1000 })+ .where(eq(tables.albums.id, id))+ .run()+ })+ })++ return { success: true }+})diff --git a/server/database/migrations/0012_medical_raider.sql b/server/database/migrations/0012_medical_raider.sqlnew file mode 100644index 00000000..cbfe4852--- /dev/null+++ b/server/database/migrations/0012_medical_raider.sql@@ -0,0 +1,8 @@+ALTER TABLE `albums` ADD `position` real DEFAULT 0 NOT NULL;--> statement-breakpoint+-- Backfill positions to preserve the previous display order (newest first, id asc tiebreak).+-- Ordering by `position` ASC reproduces the former `createdAt` DESC sort.+UPDATE `albums` SET `position` = (+ SELECT COUNT(*) FROM `albums` AS a2+ WHERE a2.`created_at` > `albums`.`created_at`+ OR (a2.`created_at` = `albums`.`created_at` AND a2.`id` < `albums`.`id`)+) * 1000;\ No newline at end of filediff --git a/server/database/migrations/meta/0012_snapshot.json b/server/database/migrations/meta/0012_snapshot.jsonnew file mode 100644index 00000000..7792ca83--- /dev/null+++ b/server/database/migrations/meta/0012_snapshot.json@@ -0,0 +1,767 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "d76631f7-d170-408c-b85f-fb3517269420",+ "prevId": "473f7c35-64dc-4089-b157-de72749f215b",+ "tables": {+ "album_photos": {+ "name": "album_photos",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "album_id": {+ "name": "album_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "photo_id": {+ "name": "photo_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "position": {+ "name": "position",+ "type": "real",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 1000000+ },+ "added_at": {+ "name": "added_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "album_photos_album_id_albums_id_fk": {+ "name": "album_photos_album_id_albums_id_fk",+ "tableFrom": "album_photos",+ "tableTo": "albums",+ "columnsFrom": ["album_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "album_photos_photo_id_photos_id_fk": {+ "name": "album_photos_photo_id_photos_id_fk",+ "tableFrom": "album_photos",+ "tableTo": "photos",+ "columnsFrom": ["photo_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "albums": {+ "name": "albums",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "cover_photo_id": {+ "name": "cover_photo_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "real",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "albums_cover_photo_id_photos_id_fk": {+ "name": "albums_cover_photo_id_photos_id_fk",+ "tableFrom": "albums",+ "tableTo": "photos",+ "columnsFrom": ["cover_photo_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "photo_reactions": {+ "name": "photo_reactions",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "photo_id": {+ "name": "photo_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "reaction_type": {+ "name": "reaction_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "fingerprint": {+ "name": "fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "photo_reactions_photo_id_photos_id_fk": {+ "name": "photo_reactions_photo_id_photos_id_fk",+ "tableFrom": "photo_reactions",+ "tableTo": "photos",+ "columnsFrom": ["photo_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "photos": {+ "name": "photos",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "width": {+ "name": "width",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "height": {+ "name": "height",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "aspect_ratio": {+ "name": "aspect_ratio",+ "type": "real",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "date_taken": {+ "name": "date_taken",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "storage_key": {+ "name": "storage_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thumbnail_key": {+ "name": "thumbnail_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "file_size": {+ "name": "file_size",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "last_modified": {+ "name": "last_modified",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "original_url": {+ "name": "original_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thumbnail_url": {+ "name": "thumbnail_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thumbnail_hash": {+ "name": "thumbnail_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tags": {+ "name": "tags",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "exif": {+ "name": "exif",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "latitude": {+ "name": "latitude",+ "type": "real",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "longitude": {+ "name": "longitude",+ "type": "real",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "country": {+ "name": "country",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "city": {+ "name": "city",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "location_name": {+ "name": "location_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_live_photo": {+ "name": "is_live_photo",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "live_photo_video_url": {+ "name": "live_photo_video_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "live_photo_video_key": {+ "name": "live_photo_video_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "photos_id_unique": {+ "name": "photos_id_unique",+ "columns": ["id"],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "pipeline_queue": {+ "name": "pipeline_queue",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "payload": {+ "name": "payload",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'{\"type\":\"photo\",\"storageKey\":\"\"}'"+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "max_attempts": {+ "name": "max_attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 3+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "status_stage": {+ "name": "status_stage",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "error_message": {+ "name": "error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ },+ "completed_at": {+ "name": "completed_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "settings": {+ "name": "settings",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "namespace": {+ "name": "namespace",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'common'"+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "default_value": {+ "name": "default_value",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_public": {+ "name": "is_public",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "is_readonly": {+ "name": "is_readonly",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "is_secret": {+ "name": "is_secret",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "enum": {+ "name": "enum",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ },+ "updated_by": {+ "name": "updated_by",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "idx_namespace_key": {+ "name": "idx_namespace_key",+ "columns": ["namespace", "key"],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "settings_updated_by_users_id_fk": {+ "name": "settings_updated_by_users_id_fk",+ "tableFrom": "settings",+ "tableTo": "users",+ "columnsFrom": ["updated_by"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "settings_storage_providers": {+ "name": "settings_storage_providers",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "config": {+ "name": "config",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(unixepoch())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "is_admin": {+ "name": "is_admin",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ }+ },+ "indexes": {+ "users_name_unique": {+ "name": "users_name_unique",+ "columns": ["name"],+ "isUnique": true+ },+ "users_email_unique": {+ "name": "users_email_unique",+ "columns": ["email"],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}diff --git a/server/database/migrations/meta/_journal.json b/server/database/migrations/meta/_journal.jsonindex 51e4b9bd..782da678 100644--- a/server/database/migrations/meta/_journal.json+++ b/server/database/migrations/meta/_journal.json@@ -85,6 +85,13 @@"when": 1784142342471,"tag": "0011_update_location_language_enum","breakpoints": true+ },+ {+ "idx": 12,+ "version": "6",+ "when": 1789503318512,+ "tag": "0012_medical_raider",+ "breakpoints": true}]}diff --git a/server/database/schema.ts b/server/database/schema.tsindex 8d916a35..2b155d0a 100644--- a/server/database/schema.ts+++ b/server/database/schema.ts@@ -140,6 +140,8 @@ export const albums = sqliteTable('albums', {onDelete: 'set null',}),isHidden: integer('is_hidden', { mode: 'boolean' }).default(false).notNull(),+ // Album sort position (ascending; smaller value appears first)+ position: real('position').notNull().default(0),createdAt: integer('created_at', { mode: 'timestamp' }).notNull().default(sql`(unixepoch())`),