diff --git a/memento-note/app/api/ai/echo/connections/route.ts b/memento-note/app/api/ai/echo/connections/route.ts index 326b7b7..60ae816 100644 --- a/memento-note/app/api/ai/echo/connections/route.ts +++ b/memento-note/app/api/ai/echo/connections/route.ts @@ -77,6 +77,7 @@ export async function GET(req: NextRequest) { }) } catch (error) { + console.error('[/api/ai/echo/connections] error:', error) return NextResponse.json( { error: 'Failed to fetch connections' }, { status: 500 } diff --git a/memento-note/app/api/ai/echo/route.ts b/memento-note/app/api/ai/echo/route.ts index 208a8f2..80d014c 100644 --- a/memento-note/app/api/ai/echo/route.ts +++ b/memento-note/app/api/ai/echo/route.ts @@ -32,6 +32,7 @@ export async function GET(req: NextRequest) { return NextResponse.json({ insight }) } catch (error) { + console.error('[/api/ai/echo] GET error:', error) return NextResponse.json( { error: 'Failed to fetch Memory Echo insight' }, { status: 500 } @@ -84,6 +85,7 @@ export async function POST(req: NextRequest) { } } catch (error) { + console.error('[/api/ai/echo] POST error:', error) return NextResponse.json( { error: 'Failed to process request' }, { status: 500 } diff --git a/memento-note/middleware.ts b/memento-note/middleware.ts index d409bb3..9158636 100644 --- a/memento-note/middleware.ts +++ b/memento-note/middleware.ts @@ -7,5 +7,5 @@ export default NextAuth(authConfig).auth; export const config = { // https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher - matcher: ['/((?!api|_next/static|_next/image|.*\.png$).*)'], + matcher: ['/((?!api|_next/static|_next/image|uploads|.*\.(png|json|svg|ico|jpg|jpeg|webp|woff2?)$).*)'], }; \ No newline at end of file diff --git a/memento-note/prisma/migrations/20260428150000_add_note_history/migration.sql b/memento-note/prisma/migrations/20260428150000_add_note_history/migration.sql new file mode 100644 index 0000000..6b29101 --- /dev/null +++ b/memento-note/prisma/migrations/20260428150000_add_note_history/migration.sql @@ -0,0 +1,43 @@ +-- CreateTable +CREATE TABLE "NoteHistory" ( + "id" TEXT NOT NULL, + "noteId" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "version" INTEGER NOT NULL, + "reason" TEXT, + "title" TEXT, + "content" TEXT NOT NULL, + "color" TEXT NOT NULL, + "isPinned" BOOLEAN NOT NULL, + "isArchived" BOOLEAN NOT NULL, + "type" TEXT NOT NULL, + "checkItems" TEXT, + "labels" TEXT, + "images" TEXT, + "links" TEXT, + "isMarkdown" BOOLEAN NOT NULL, + "size" TEXT NOT NULL, + "notebookId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "NoteHistory_pkey" PRIMARY KEY ("id") +); + +-- AlterTable +ALTER TABLE "UserAISettings" +ADD COLUMN "noteHistory" BOOLEAN NOT NULL DEFAULT false; + +-- CreateIndex +CREATE UNIQUE INDEX "NoteHistory_noteId_version_key" ON "NoteHistory"("noteId", "version"); + +-- CreateIndex +CREATE INDEX "NoteHistory_noteId_createdAt_idx" ON "NoteHistory"("noteId", "createdAt" DESC); + +-- CreateIndex +CREATE INDEX "NoteHistory_userId_noteId_createdAt_idx" ON "NoteHistory"("userId", "noteId", "createdAt" DESC); + +-- AddForeignKey +ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;