Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/FUNDING.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@radix-ui/react-toggle-group": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.7",
"@tanstack/react-query": "^5.66.9",
"@tanstack/react-router": "^1.109.2",
"@tanstack/react-router": "^1.111.3",
"@tiptap/extension-code-block-lowlight": "^2.11.5",
"@tiptap/extension-color": "^2.11.5",
"@tiptap/extension-heading": "^2.11.5",
Expand All @@ -82,7 +82,7 @@
"react-hook-form": "^7.54.2",
"react-medium-image-zoom": "^5.2.14",
"react-resizable-panels": "^2.1.7",
"tailwind-merge": "^3.0.1",
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"tiptap-extension-global-drag-handle": "^0.1.16",
"zod": "^3.24.1",
Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `notes` ADD `favorite` integer DEFAULT false NOT NULL;
123 changes: 123 additions & 0 deletions resources/database/migrations/meta/0006_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"version": "6",
"dialect": "sqlite",
"id": "00186e7f-6619-4cb4-baab-04410aa0e24f",
"prevId": "e0c8c2de-4cdd-4096-8c59-eb8d298b03e5",
"tables": {
"clipboard": {
"name": "clipboard",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": true
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"notes": {
"name": "notes",
"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": true,
"autoincrement": false
},
"favorite": {
"name": "favorite",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"content": {
"name": "content",
"type": "blob",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"labels": {
"name": "labels",
"type": "blob",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updatedAt": {
"name": "updatedAt",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
7 changes: 7 additions & 0 deletions resources/database/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
"when": 1739196843790,
"tag": "0005_volatile_titania",
"breakpoints": true
},
{
"idx": 6,
"version": "6",
"when": 1740400576615,
"tag": "0006_great_supreme_intelligence",
"breakpoints": true
}
]
}
1 change: 1 addition & 0 deletions src/main/drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const notesSchema = sqliteTable('notes', {
id: integer().primaryKey({ autoIncrement: true }),
title: text().notNull(),
description: text().notNull(),
favorite: integer({ mode: 'boolean' }).notNull().default(false),
content: blob().notNull(), // content is going to be JSON
labels: blob(), // content is going to be JSON
createdAt: integer()
Expand Down
2 changes: 2 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
deleteNote,
getAllNotes,
getNoteById,
toggleFavoriteNote,
updateNote
} from './utils/notes-operations'

Expand Down Expand Up @@ -177,6 +178,7 @@ app.whenReady().then(() => {
ipcMain.handle('delete-note', (_, id) => deleteNote(id))
ipcMain.handle('get-note', (_, id) => getNoteById(id))
ipcMain.handle('get-all-notes', getAllNotes)
ipcMain.handle('toggle-favorite-note', (_, values) => toggleFavoriteNote(values))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling to the IPC handler.

Consider adding error handling similar to other IPC handlers in the file to ensure robust operation.

-  ipcMain.handle('toggle-favorite-note', (_, values) => toggleFavoriteNote(values))
+  ipcMain.handle('toggle-favorite-note', async (_, values) => {
+    try {
+      return await toggleFavoriteNote(values)
+    } catch (error) {
+      console.error('Failed to toggle favorite:', error)
+      throw error
+    }
+  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ipcMain.handle('toggle-favorite-note', (_, values) => toggleFavoriteNote(values))
ipcMain.handle('toggle-favorite-note', async (_, values) => {
try {
return await toggleFavoriteNote(values)
} catch (error) {
console.error('Failed to toggle favorite:', error)
throw error
}
})


let previousContent = clipboard.readText()
async function checkClipboard(): Promise<void> {
Expand Down
Loading
Loading