Skip to content

Commit

Permalink
feat: refactor resource page
Browse files Browse the repository at this point in the history
  • Loading branch information
blinko-space committed Dec 20, 2024
1 parent 798e68d commit cda450a
Show file tree
Hide file tree
Showing 33 changed files with 1,617 additions and 144 deletions.
3 changes: 3 additions & 0 deletions prisma/migrations/20241219062514_0_27_7/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "attachments" ADD COLUMN "depth" INTEGER,
ADD COLUMN "perfixPath" VARCHAR DEFAULT '';
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ model attachments {
sortOrder Int @default(0)
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @updatedAt @db.Timestamptz(6)
perfixPath String? @default("") @db.VarChar // folder1,folder2,folder3
depth Int?
note notes @relation(fields: [noteId], references: [id])
}
Expand Down
25 changes: 25 additions & 0 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,31 @@ async function main() {
break
}
}

// 更新 attachments 的 perfixPath 和 depth
const attachmentsWithoutDepth = await prisma.attachments.findMany({
where: {
OR: [
{ depth: null },
{ perfixPath: null }
]
}
});

for (const attachment of attachmentsWithoutDepth) {
const pathParts = attachment.path
.replace('/api/file/', '')
.replace('/api/s3file/', '')
.split('/');

await prisma.attachments.update({
where: { id: attachment.id },
data: {
depth: pathParts.length - 1,
perfixPath: pathParts.slice(0, -1).join(',')
}
});
}
}

main()
Expand Down
15 changes: 14 additions & 1 deletion public/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,18 @@
"upload-failed": "فشل التحميل",
"import-from-bko-tip": "تحميل إلى s3 للإسترداد غير مدعوم في الوقت الحالي. يُرجى تعطيل الخيار s3 مؤقتًا عند رغبتك في الاسترداد.",
"edit-time": "وقت التحرير",
"ai-write": "الذكاء الاصطناعي"
"ai-write": "الذكاء الاصطناعي",
"download": "تحميل",
"rename": "إعادة تسمية",
"move-up": "تحرك لأعلى",
"cut": "قطع",
"paste": "لصق",
"confirm-delete": "تأكيد الحذف",
"confirm-delete-content": "هل أنت متأكد أنك تريد حذف {{name}}؟ لا يمكن التراجع عن هذا الإجراء.",
"folder-name": "اسم المجلد",
"file-name": "اسم الملف",
"operation-success": "نجاح العملية",
"cloud-file": "ملف سحابي",
"move-to-parent": "الانتقال إلى الوالد",
"no-resources-found": "لم يتم العثور على موارد"
}
15 changes: 14 additions & 1 deletion public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,18 @@
"upload-failed": "Upload fehlgeschlagen",
"import-from-bko-tip": "Das Hochladen zur Wiederherstellung auf S3 wird derzeit nicht unterstützt. Deaktivieren Sie die S3-Option vorübergehend, wenn Sie eine Wiederherstellung durchführen möchten.",
"edit-time": "Bearbeitungszeit",
"ai-write": "AI Write\n\nAI schreiben"
"ai-write": "AI Write\n\nAI schreiben",
"download": "Herunterladen",
"rename": "Umbenennen",
"move-up": "Nach oben verschieben",
"cut": "Schneiden",
"paste": "Einfügen",
"confirm-delete": "Bestätigen Löschen",
"confirm-delete-content": "Sind Sie sicher, dass Sie {{name}} löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
"folder-name": "Ordnername",
"file-name": "Dateiname",
"operation-success": "Operation erfolgreich",
"cloud-file": "Cloud-Datei",
"move-to-parent": "Zum übergeordneten Element wechseln",
"no-resources-found": "Keine Ressourcen gefunden"
}
15 changes: 14 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,5 +349,18 @@
"upload-failed": "Upload Failed",
"import-from-bko-tip": "Uploading to s3 for recovery is not supported at this time. Please disable the s3 option temporarily when you want to recover.",
"edit-time": "Edit Time",
"ai-write": "AI Write"
"ai-write": "AI Write",
"download": "Download",
"rename": "Rename",
"move-up": "Move Up",
"cut": "Cut",
"paste": "Paste",
"confirm-delete-content": "Are you sure you want to delete {{name}}? This action cannot be undone.",
"confirm-delete": "Confirm Delete",
"folder-name": "Folder Name",
"file-name": "File Name",
"operation-success": "Operation Successful",
"cloud-file": "Cloud File",
"move-to-parent": "Move To Parent",
"no-resources-found": "No Resources Found"
}
15 changes: 14 additions & 1 deletion public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,18 @@
"upload-failed": "Error al subir",
"import-from-bko-tip": "La carga a s3 para recuperación no está soportada en este momento. Por favor, deshabilite temporalmente la opción s3 cuando desee recuperar.",
"edit-time": "Tiempo de edición",
"ai-write": "IA Escribir"
"ai-write": "IA Escribir",
"download": "Descargar",
"rename": "Rebautizar",
"move-up": "Subir",
"cut": "Cortar",
"paste": "Pegar",
"confirm-delete": "Confirmar Eliminar",
"confirm-delete-content": "¿Estás seguro de que deseas eliminar {{name}}? Esta acción no se puede deshacer.",
"folder-name": "Nombre de la carpeta",
"file-name": "Nombre del archivo",
"operation-success": "Operación exitosa",
"cloud-file": "Archivo en la nube",
"move-to-parent": "Mover al padre",
"no-resources-found": "No se encontraron recursos."
}
15 changes: 14 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,18 @@
"upload-failed": "Téléchargement échoué",
"import-from-bko-tip": "Le téléversement vers s3 pour la récupération n'est pas pris en charge actuellement. Veuillez désactiver temporairement l'option s3 lorsque vous souhaitez récupérer.",
"edit-time": "Modifier l'heure",
"ai-write": "Écrire en IA"
"ai-write": "Écrire en IA",
"download": "Télécharger",
"rename": "Renommer",
"move-up": "Monter",
"cut": "Couper",
"paste": "Coller",
"confirm-delete": "Confirmer la suppression",
"confirm-delete-content": "Êtes-vous sûr de vouloir supprimer {{name}} ? Cette action est irréversible.",
"folder-name": "Nom du dossier",
"file-name": "Nom du fichier",
"operation-success": "Opération réussie",
"cloud-file": "Fichier en nuage",
"move-to-parent": "Déplacer vers le parent",
"no-resources-found": "Aucune ressource trouvée"
}
15 changes: 14 additions & 1 deletion public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,18 @@
"upload-failed": "アップロードに失敗しました",
"import-from-bko-tip": "この時点では、S3 へのアップロードによるリカバリはサポートされていません。リカバリを行う際には一時的に S3 オプションを無効にしてください。",
"edit-time": "編集時間",
"ai-write": "AIライト"
"ai-write": "AIライト",
"download": "ダウンロードします。",
"rename": "名前を変更",
"move-up": "上に移動する",
"cut": "切る",
"paste": "ペースト",
"confirm-delete": "削除を確認します。",
"confirm-delete-content": "「{{name}}」を削除しますか?この操作は取り消すことができません。",
"folder-name": "フォルダー名",
"file-name": "ファイル名",
"operation-success": "手術が成功しました",
"cloud-file": "クラウドファイル",
"move-to-parent": "親に移動",
"no-resources-found": "リソースが見つかりません"
}
15 changes: 14 additions & 1 deletion public/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,18 @@
"upload-failed": "업로드 실패",
"import-from-bko-tip": "현재 s3로의 업로드는 복구되지 않습니다. 복구를 원할 경우 s3 옵션을 일시적으로 비활성화하십시오.",
"edit-time": "편집 시간",
"ai-write": "인공지능 작성"
"ai-write": "인공지능 작성",
"download": "다운로드",
"rename": "이름 바꾸기",
"move-up": "위로 이동",
"cut": "잘라 내다",
"paste": "붙여 넣다",
"confirm-delete": "삭제 확인",
"confirm-delete-content": "{{name}}을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
"folder-name": "폴더 이름",
"file-name": "파일 이름",
"operation-success": "작업 성공적입니다.",
"cloud-file": "클라우드 파일",
"move-to-parent": "부모로 이동",
"no-resources-found": "자원을 찾을 수 없습니다"
}
15 changes: 14 additions & 1 deletion public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,18 @@
"upload-failed": "Falha ao Carregar",
"import-from-bko-tip": "O envio para o s3 para recuperação não é suportado neste momento. Por favor, desative temporariamente a opção s3 quando desejar recuperar.",
"edit-time": "Tempo de Edição",
"ai-write": "IA Escreva"
"ai-write": "IA Escreva",
"download": "Baixar",
"rename": "Renomear",
"move-up": "Subir",
"cut": "Corte",
"paste": "Colar",
"confirm-delete": "Confirmar Excluir",
"confirm-delete-content": "Tem certeza de que deseja excluir {{name}}? Essa ação não pode ser desfeita.",
"folder-name": "Nome da Pasta",
"file-name": "Nome do arquivo",
"operation-success": "Operação bem-sucedida",
"cloud-file": "Arquivo na Nuvem",
"move-to-parent": "Mover Para o Pai",
"no-resources-found": "Recursos não encontrados"
}
15 changes: 14 additions & 1 deletion public/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,18 @@
"upload-failed": "Не удалось загрузить",
"import-from-bko-tip": "Загрузка в s3 для восстановления в настоящее время не поддерживается. Пожалуйста, временно отключите опцию s3, когда планируете выполнить восстановление.",
"edit-time": "Время редактирования",
"ai-write": "Искусственный интеллект."
"ai-write": "Искусственный интеллект.",
"download": "Скачать",
"rename": "Переименовать",
"move-up": "Двигаться вверх",
"cut": "Порезать",
"paste": "Вставить",
"confirm-delete": "Подтвердить удаление",
"confirm-delete-content": "Вы уверены, что хотите удалить {{name}}? Это действие нельзя отменить.",
"folder-name": "Имя папки",
"file-name": "Имя файла",
"operation-success": "Операция успешно выполнена",
"cloud-file": "Облачный файл",
"move-to-parent": "Переместиться к родительскому элементу",
"no-resources-found": "Ресурсы не найдены"
}
15 changes: 14 additions & 1 deletion public/locales/tr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,18 @@
"upload-failed": "Yükleme Başarısız oldu",
"import-from-bko-tip": "Bu zamanda s3'e yükleme yapılmamaktadır. Kurtarma işlemi gerçekleştirmek istediğinizde lütfen geçici olarak s3 seçeneğini devre dışı bırakın.",
"edit-time": "Zamanı Düzenle",
"ai-write": "Yapay Zeka Yazısı"
"ai-write": "Yapay Zeka Yazısı",
"download": "İndir",
"rename": "Yeniden adlandırma",
"move-up": "Yukarı taşı.",
"cut": "kesmek",
"paste": "Yapıştır",
"confirm-delete": "Silme işlemini onayla",
"confirm-delete-content": "{{name}}'i silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.",
"folder-name": "Klasör Adı",
"file-name": "Dosya Adı",
"operation-success": "Operasyon Başarılı",
"cloud-file": "Bulut Dosyası",
"move-to-parent": "Ebeveyn Düzeyine Taşı",
"no-resources-found": "Kaynak Bulunamadı"
}
15 changes: 14 additions & 1 deletion public/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,18 @@
"upload-failed": "上傳失敗",
"import-from-bko-tip": "目前不支援上傳至 s3 進行還原。當您想要進行恢復操作時,請暫時停用 s3 選項。",
"edit-time": "編輯時間",
"ai-write": "AI 寫"
"ai-write": "AI 寫",
"download": "下載",
"rename": "重新命名",
"move-up": "提升",
"cut": "剪辑",
"paste": "貼上",
"confirm-delete": "確認刪除",
"confirm-delete-content": "您確定要刪除{{name}}嗎?此操作無法撤銷。",
"folder-name": "資料夾名稱",
"file-name": "檔案名稱",
"operation-success": "操作成功",
"cloud-file": "雲端檔案",
"move-to-parent": "移至上層目錄",
"no-resources-found": "找不到資源"
}
21 changes: 17 additions & 4 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"api-endpoint": "接口地址",
"must-start-with-http-s-or-use-api-openai-as-default": "必须以 http(s):// 开头,或默认使用 /api/openai",
"user-custom-openai-api-key": "用户自定义 OpenAI Api 密钥",
"user-custom-azureopenai-api-instance": "Azure OpenAI 虚拟实例名称",
"user-custom-azureopenai-api-instance": "Azure OpenAI 虚拟实例名��",
"user-custom-azureopenai-api-deployment": "Azure OpenAI 部署名称",
"user-custom-azureopenai-api-version": "API 版本",
"ai-model": "人工智能模型",
Expand Down Expand Up @@ -165,7 +165,7 @@
"ai-tag": "AI标签",
"article": "文章",
"embedding-model": "嵌入式模型",
"if-you-have-a-lot-of-notes-you-may-consume-a-certain-number-of-tokens": "如果您有大量笔记,可能会消耗一定数量的代币",
"if-you-have-a-lot-of-notes-you-may-consume-a-certain-number-of-tokens": "如果您有大量���记,可能会消耗一定数量的代币",
"force-rebuild": "强制重建",
"force-rebuild-embedding-index": "强制重建将完全重建已索引的所有数据",
"embedding-model-description": "切换嵌入式模型后必须重建索引",
Expand All @@ -192,7 +192,7 @@
"reference": "引用",
"reference-note": "参考说明",
"source-code-mode": "源码模式",
"heading": "标题",
"heading": "标��",
"paragraph": "段落",
"quote": "引用",
"bold": "粗体",
Expand Down Expand Up @@ -363,5 +363,18 @@
"upload-failed": "上传失败",
"import-from-bko-tip": "目前不支持将上传到S3进行恢复。当您想要恢复时,请暂时禁用S3选项。",
"edit-time": "编辑时间",
"ai-write": "AI写作"
"ai-write": "AI写作",
"download": "下载",
"rename": "重命名",
"move-up": "向上移动",
"cut": "剪切",
"paste": "粘贴",
"confirm-delete": "确认删除",
"confirm-delete-content": "您确定要删除{{name}}吗?此操作无法撤销。",
"folder-name": "文件夹名称",
"file-name": "文件名",
"operation-success": "操作成功",
"cloud-file": "云文件",
"move-to-parent": "移至上级",
"no-resources-found": "未找到资源"
}
Loading

0 comments on commit cda450a

Please sign in to comment.