feat: MVP-5 Sprint 1 - Backup/Restore system
- Add backup types and RecallBackup format - Create backup snapshot engine (createBackupSnapshot) - Add IndexedDB storage for local backups - Implement retention policy (max 10, 30-day cleanup) - Add backup validation and restore logic (merge/replace modes) - Add backup restore UI dialog with preview and confirmation - Add unsaved changes guard hook - Integrate backups section in Settings - Add backup endpoint to export-import API
This commit is contained in:
@@ -3,9 +3,18 @@ import { prisma } from '@/lib/prisma'
|
||||
import { noteSchema, NoteInput } from '@/lib/validators'
|
||||
import { createErrorResponse, createSuccessResponse, ValidationError } from '@/lib/errors'
|
||||
import { syncBacklinks } from '@/lib/backlinks'
|
||||
import { createBackupSnapshot } from '@/lib/backup'
|
||||
|
||||
export async function GET() {
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(req.url)
|
||||
const format = searchParams.get('format')
|
||||
|
||||
if (format === 'backup') {
|
||||
const backup = await createBackupSnapshot('manual')
|
||||
return createSuccessResponse(backup)
|
||||
}
|
||||
|
||||
const notes = await prisma.note.findMany({
|
||||
include: { tags: { include: { tag: true } } },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user