Skip to content

Build your personal knowledge base with Trilium Notes

feat(etapi): resolve suggestions for norms from gemini

perfectra1n0650be664d99
diff --git a/apps/server/etapi.openapi.yaml b/apps/server/etapi.openapi.yaml
index af05bdbe57..2e6f941eb2 100644
--- a/apps/server/etapi.openapi.yaml
+++ b/apps/server/etapi.openapi.yaml
@@ -446,15 +446,16 @@ paths:
schema:
$ref: "#/components/schemas/EntityId"
get:
- description: Returns revision content identified by its ID
+ description: Returns revision content identified by its ID. The Content-Type header will match the revision's MIME type.
operationId: getRevisionContent
responses:
"200":
- description: revision content response
+ description: Revision content. The Content-Type header will be set to the revision's actual MIME type (e.g., text/html, text/plain, image/png).
content:
- text/html:
+ application/octet-stream:
schema:
type: string
+ format: binary
default:
description: unexpected error
content:
@@ -1379,16 +1380,16 @@ components:
title:
type: string
description: Title at the time of the change (may be "[protected]" for protected notes)
- current_title:
+ currentTitle:
type: string
description: Current title of the note (may be "[protected]" for protected notes)
- current_isDeleted:
+ currentIsDeleted:
type: boolean
description: Whether the note is currently deleted
- current_deleteId:
+ currentDeleteId:
type: string
description: Delete ID if the note is deleted
- current_isProtected:
+ currentIsProtected:
type: boolean
description: Whether the note is protected
utcDate:
diff --git a/apps/server/spec/etapi/note-history.spec.ts b/apps/server/spec/etapi/note-history.spec.ts
index 7696c00516..c78e8d359c 100644
--- a/apps/server/spec/etapi/note-history.spec.ts
+++ b/apps/server/spec/etapi/note-history.spec.ts
@@ -42,8 +42,8 @@ describe("etapi/note-history", () => {
expect(entry).toHaveProperty("title");
expect(entry).toHaveProperty("utcDate");
expect(entry).toHaveProperty("date");
- expect(entry).toHaveProperty("current_isDeleted");
- expect(entry).toHaveProperty("current_isProtected");
+ expect(entry).toHaveProperty("currentIsDeleted");
+ expect(entry).toHaveProperty("currentIsProtected");
});
it("filters history by ancestor note", async () => {
@@ -83,7 +83,7 @@ describe("etapi/note-history", () => {
.expect(200);
const deletedEntry = response.body.find(
- (entry: any) => entry.noteId === noteToDeleteId && entry.current_isDeleted === true
+ (entry: any) => entry.noteId === noteToDeleteId && entry.currentIsDeleted === true
);
// Deleted entries should have canBeUndeleted property
diff --git a/apps/server/src/etapi/revisions.ts b/apps/server/src/etapi/revisions.ts
index 6451b18a15..e76877ddc5 100644
--- a/apps/server/src/etapi/revisions.ts
+++ b/apps/server/src/etapi/revisions.ts
@@ -21,10 +21,10 @@ function register(router: Router) {
recentChanges = sql.getRows<RecentChangeRow>(`
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
revisions.title,
revisions.utcDateCreated AS utcDate,
revisions.dateCreated AS date
@@ -33,10 +33,10 @@ function register(router: Router) {
UNION ALL
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
notes.title,
notes.utcDateCreated AS utcDate,
notes.dateCreated AS date
@@ -44,10 +44,10 @@ function register(router: Router) {
UNION ALL
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
notes.title,
notes.utcDateModified AS utcDate,
notes.dateModified AS date
@@ -68,10 +68,10 @@ function register(router: Router) {
)
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
revisions.title,
revisions.utcDateCreated AS utcDate,
revisions.dateCreated AS date
@@ -81,10 +81,10 @@ function register(router: Router) {
UNION ALL
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
notes.title,
notes.utcDateCreated AS utcDate,
notes.dateCreated AS date
@@ -93,10 +93,10 @@ function register(router: Router) {
UNION ALL
SELECT
notes.noteId,
- notes.isDeleted AS current_isDeleted,
- notes.deleteId AS current_deleteId,
- notes.title AS current_title,
- notes.isProtected AS current_isProtected,
+ notes.isDeleted AS currentIsDeleted,
+ notes.deleteId AS currentDeleteId,
+ notes.title AS currentTitle,
+ notes.isProtected AS currentIsProtected,
notes.title,
notes.utcDateModified AS utcDate,
notes.dateModified AS date
@@ -107,17 +107,17 @@ function register(router: Router) {
}
for (const change of recentChanges) {
- if (change.current_isProtected) {
+ if (change.currentIsProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
change.title = protectedSessionService.decryptString(change.title) || "[protected]";
- change.current_title = protectedSessionService.decryptString(change.current_title) || "[protected]";
+ change.currentTitle = protectedSessionService.decryptString(change.currentTitle) || "[protected]";
} else {
- change.title = change.current_title = "[protected]";
+ change.title = change.currentTitle = "[protected]";
}
}
- if (change.current_isDeleted) {
- const deleteId = change.current_deleteId;
+ if (change.currentIsDeleted) {
+ const deleteId = change.currentDeleteId;
const undeletedParentBranchIds = noteService.getUndeletedParentBranchIds(change.noteId, deleteId);
diff --git a/packages/commons/src/lib/server_api.ts b/packages/commons/src/lib/server_api.ts
index a15192fd28..7c197a7614 100644
--- a/packages/commons/src/lib/server_api.ts
+++ b/packages/commons/src/lib/server_api.ts
@@ -56,10 +56,10 @@ export interface RevisionPojo {
export interface RecentChangeRow {
noteId: string;
- current_isDeleted: boolean;
- current_deleteId: string;
- current_title: string;
- current_isProtected: boolean;
+ currentIsDeleted: boolean;
+ currentDeleteId: string;
+ currentTitle: string;
+ currentIsProtected: boolean;
title: string;
utcDate: string;
date: string;