Skip to content

Commit 3abe305

Browse files
committed
feat: migrate to Upstash Redis and Piston code execution
1 parent f9506e2 commit 3abe305

File tree

10 files changed

+306
-258
lines changed

10 files changed

+306
-258
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
"@sentry/node": "^10.20.0",
4646
"@sentry/profiling-node": "^10.20.0",
4747
"@types/ws": "^8.18.1",
48+
"@upstash/redis": "^1.35.6",
4849
"dotenv": "^17.0.1",
4950
"dotenv-flow": "^4.1.0",
5051
"drizzle-orm": "^0.44.2",
5152
"hono": "^4.8.3",
52-
"ioredis": "^5.8.1",
5353
"postgres": "^3.4.7",
5454
"ws": "^8.18.3",
5555
"zod": "^4.1.12"

pnpm-lock.yaml

Lines changed: 18 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/integration.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,45 @@ describe("Test Infrastructure Integration", () => {
232232

233233
expect(updatedNote.type).toBe("diagram");
234234
});
235+
236+
it("should create a code note when type is specified", async () => {
237+
const user = await createTestUser();
238+
const note = await createTestNote(user.id, null, {
239+
type: "code",
240+
title: "Code Snippet",
241+
content: '{"language":"javascript","code":"console.log(\'Hello\');"}',
242+
});
243+
244+
expect(note.type).toBe("code");
245+
expect(note.title).toBe("Code Snippet");
246+
expect(note.content).toContain("javascript");
247+
});
248+
249+
it("should query notes by code type", async () => {
250+
const user = await createTestUser();
251+
const folder = await createTestFolder(user.id);
252+
253+
// Create mixed note types including code
254+
await createTestNote(user.id, folder.id, { type: "note", title: "Regular Note" });
255+
await createTestNote(user.id, folder.id, { type: "diagram", title: "Diagram" });
256+
await createTestNote(user.id, folder.id, {
257+
type: "code",
258+
title: "Code 1",
259+
content: '{"language":"python"}',
260+
});
261+
await createTestNote(user.id, folder.id, {
262+
type: "code",
263+
title: "Code 2",
264+
content: '{"language":"typescript"}',
265+
});
266+
267+
// Query only code notes
268+
const codeNotes = await db.query.notes.findMany({
269+
where: eq(notes.type, "code"),
270+
});
271+
272+
expect(codeNotes).toHaveLength(2);
273+
expect(codeNotes.every((n) => n.type === "code")).toBe(true);
274+
});
235275
});
236276
});

src/db/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const notes = pgTable(
4444

4545
title: text("title").notNull(),
4646
content: text("content").default(""),
47-
type: text("type", { enum: ["note", "diagram"] })
47+
type: text("type", { enum: ["note", "diagram", "code"] })
4848
.default("note")
4949
.notNull(),
5050

0 commit comments

Comments
 (0)