Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix types & eslint errors

Smaug6739c74bcff9a1a6
diff --git a/frontend/app/components/AppSelect.vue b/frontend/app/components/AppSelect.vue
index c6c176a3..911ba1a8 100644
--- a/frontend/app/components/AppSelect.vue
+++ b/frontend/app/components/AppSelect.vue
@@ -32,6 +32,7 @@ const props = withDefaults(
items: ANode[];
placeholder?: string;
modelValue?: string | number;
+ // eslint-disable-next-line vue/require-default-prop
size?: string;
disabled?: (i: ANode) => boolean;
nullable?: boolean;
diff --git a/frontend/app/components/ModalManager.vue b/frontend/app/components/ModalManager.vue
index 12057cd9..60907131 100644
--- a/frontend/app/components/ModalManager.vue
+++ b/frontend/app/components/ModalManager.vue
@@ -7,8 +7,8 @@
<Icon name="close" :big="true" />
</button>
<component
- :style="{ padding: modal.options.noPadding ? '0' : '16px 22px' }"
:is="modal.component"
+ :style="{ padding: modal.options.noPadding ? '0' : '16px 22px' }"
v-bind="modal.options.props"
class="modal"
:class="modal.options.size"
diff --git a/frontend/app/composables/Sidebar.ts b/frontend/app/composables/Sidebar.ts
index c1a1f40a..37093436 100644
--- a/frontend/app/composables/Sidebar.ts
+++ b/frontend/app/composables/Sidebar.ts
@@ -8,6 +8,7 @@ const active_id = ref<string | null>(null);
const toggleSidebar = () => (isOpened.value = !isOpened.value);
const filtered = computed(() => {
+ const { tree } = useSidebarTree();
const found = tree.value.find(i => i.id === workspaceId.value);
if (found) return found.childrens || [];
if (workspaceId.value === 'shared') return tree.value.filter(i => i.data && i.data.shared);
diff --git a/frontend/app/composables/useNodesTree.ts b/frontend/app/composables/useNodesTree.ts
index ec962863..be5dee6b 100644
--- a/frontend/app/composables/useNodesTree.ts
+++ b/frontend/app/composables/useNodesTree.ts
@@ -1,4 +1,3 @@
-// useSidebarTree.ts
import type { Node } from '~/stores';
const preferencesStore = usePreferences();
@@ -33,9 +32,7 @@ const tree = computed(() => {
}
}
- const tree = structure.value.generateTree();
-
- return tree;
+ return structure.value.generateTree();
});
const collapseAll = () => {
@@ -129,4 +126,4 @@ function useSidebarTree() {
};
}
-export { useSidebarTree, tree };
+export { useSidebarTree };
diff --git a/frontend/app/pages/(public)/doc/[id]/index.vue b/frontend/app/pages/(public)/doc/[id]/index.vue
index 11a405e3..02868612 100644
--- a/frontend/app/pages/(public)/doc/[id]/index.vue
+++ b/frontend/app/pages/(public)/doc/[id]/index.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-v-html -->
<template>
<div style="width: 100%; padding: 1rem 0">
<!-- ⬇️ Remplace le wrapper inline flex par une classe .reader + style dynamique -->
diff --git a/frontend/app/pages/dashboard/docs/[id].vue b/frontend/app/pages/dashboard/docs/[id].vue
index a7e6a84e..accae416 100644
--- a/frontend/app/pages/dashboard/docs/[id].vue
+++ b/frontend/app/pages/dashboard/docs/[id].vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-v-html -->
<template>
<div style="width: 100%; padding: 1rem 0">
<div v-if="!error" style="display: flex; justify-content: space-between">
diff --git a/frontend/app/pages/dashboard/docs/_components/DocumentCardFooter.vue b/frontend/app/pages/dashboard/docs/_components/DocumentCardFooter.vue
index 0c95b938..0a9e3737 100644
--- a/frontend/app/pages/dashboard/docs/_components/DocumentCardFooter.vue
+++ b/frontend/app/pages/dashboard/docs/_components/DocumentCardFooter.vue
@@ -2,7 +2,7 @@
<footer v-if="document">
<div class="infos">
<NuxtLink :to="`/dashboard/docs/edit/${document.id}`" :prefetch="false"><Icon name="edit_page" /> Edit this page</NuxtLink>
- <p>Last update: {{ new Date(parseInt(document.updated_timestamp)).toLocaleDateString() }}</p>
+ <p>Last update: {{ new Date(document.updated_timestamp).toLocaleDateString() }}</p>
</div>
<div class="items">
<NuxtLink v-if="previous" :to="`/dashboard/docs/${previous.id}`" class="item left">
diff --git a/frontend/app/pages/dashboard/docs/_components/DocumentHeaderIllustration.vue b/frontend/app/pages/dashboard/docs/_components/DocumentHeaderIllustration.vue
index 3513c26c..fef2f563 100644
--- a/frontend/app/pages/dashboard/docs/_components/DocumentHeaderIllustration.vue
+++ b/frontend/app/pages/dashboard/docs/_components/DocumentHeaderIllustration.vue
@@ -1,5 +1,6 @@
<template>
<div class="illustration">
+ <!-- eslint-disable-next-line vue/no-v-html -->
<div v-if="document?.thumbnail" style="width: 100%; height: 100%" v-html="document.thumbnail"></div>
<svg v-else height="150" viewBox="0 0 297 205" fill="none" xmlns="http://www.w3.org/2000/svg">
<g style="mix-blend-mode: multiply">
diff --git a/frontend/app/pages/dashboard/home.vue b/frontend/app/pages/dashboard/home.vue
index d4c230d1..ed028590 100644
--- a/frontend/app/pages/dashboard/home.vue
+++ b/frontend/app/pages/dashboard/home.vue
@@ -68,11 +68,7 @@ const results = computed(() => {
});
const category = (id?: string) => nodesStore.getById(id || '');
const recentDocuments = computed(() => {
- return nodesStore.getAll
- .toSorted((a, b) => {
- return parseInt(b.updated_timestamp) - parseInt(a.updated_timestamp);
- })
- .slice(0, 3);
+ return nodesStore.getAll.toSorted((a, b) => b.updated_timestamp - a.updated_timestamp).slice(0, 3);
});
</script>
<style scoped lang="scss">
diff --git a/frontend/app/pages/dashboard/settings/_views/profile.vue b/frontend/app/pages/dashboard/settings/_views/profile.vue
index 9596946a..b955ad65 100644
--- a/frontend/app/pages/dashboard/settings/_views/profile.vue
+++ b/frontend/app/pages/dashboard/settings/_views/profile.vue
@@ -27,8 +27,8 @@
<AppButton type="primary">Update profile</AppButton>
</form>
<hr style="margin: 10px 0" />
- <p><strong>Account creation:</strong> {{ formatDate(parseInt(userStore.user?.created_timestamp || '0')) }}</p>
- <p><strong>Last update:</strong> {{ formatDate(parseInt(userStore.user?.updated_timestamp || '0')) }}</p>
+ <p><strong>Account creation:</strong> {{ formatDate(userStore.user?.created_timestamp) }}</p>
+ <p><strong>Last update:</strong> {{ formatDate(userStore.user?.updated_timestamp) }}</p>
</div>
</template>
diff --git a/frontend/app/stores/db_strustures.d.ts b/frontend/app/stores/db_strustures.d.ts
index 95efa714..58fb89b9 100644
--- a/frontend/app/stores/db_strustures.d.ts
+++ b/frontend/app/stores/db_strustures.d.ts
@@ -5,31 +5,7 @@ export interface DB_Node {
name: string;
description?: string;
tags?: string;
- role: -1 | 1 | 2 | 3 | 4; // 1: Workspace; 2: Category; 3: Document; 4: Ressource
- color?: number; // -1: Default; 0: None; 1-7: App colors
- icon?: string;
- thumbnail?: string;
- theme?: string;
- accessibility?: number; // 1 Visible; 2 Draft; 3 Archived;
- display?: number; // 1 List; 2 Grid;
- order?: number; // -1 for pinned and -2 for bookmark
- content?: string;
- content_compiled?: string;
- size?: number; // in bytes
- metadata?: Record<string, unknown>;
- created_timestamp: number;
- updated_timestamp: number;
-
- permissions?: Permission[];
-}
-export interface DB_Node {
- id: string;
- user_id: string;
- parent_id?: string;
- name: string;
- description?: string;
- tags?: string;
- role: 4; // 1: Workspace; 2: Category; 3: Document; 4: Ressource
+ role: -1 | 1 | 2 | 3 | 4; // 1: Workspace; 2: Category; 3: Document; 4: Ressource; -1: Internal (frontend use only)
color?: number; // -1: Default; 0: None; 1-7: App colors
icon?: string;
thumbnail?: string;
@@ -46,8 +22,10 @@ export interface DB_Node {
original_path?: string;
transformed_path?: string;
};
- created_timestamp: string;
- updated_timestamp: string;
+ created_timestamp: number;
+ updated_timestamp: number;
+
+ permissions?: Permission[];
}
export interface Permission {
@@ -55,7 +33,7 @@ export interface Permission {
user_id: string;
node_id: string;
permission: number; // 1: Read; 2: Write; 3: Admin;
- created_timestamp: string;
+ created_timestamp: number;
}
export interface Node extends DB_Node {
@@ -73,8 +51,8 @@ export interface User {
avatar?: string;
password?: string;
email: string;
- created_timestamp: string;
- updated_timestamp: string;
+ created_timestamp: number;
+ updated_timestamp: number;
}
export interface PublicUser {
@@ -82,8 +60,8 @@ export interface PublicUser {
username: string;
avatar?: string;
email: string;
- created_timestamp: string;
- updated_timestamp: string;
+ created_timestamp: number;
+ updated_timestamp: number;
}
export interface ConnectionLog {
@@ -93,5 +71,5 @@ export interface ConnectionLog {
user_agent?: string;
location?: string;
type: string;
- timestamp: string; // BIGINT converted to string
+ timestamp: number;
}
diff --git a/frontend/app/stores/user.store.ts b/frontend/app/stores/user.store.ts
index 83a8bbb7..b7d2d0d8 100644
--- a/frontend/app/stores/user.store.ts
+++ b/frontend/app/stores/user.store.ts
@@ -30,7 +30,7 @@ export const useUserStore = defineStore('user', {
}
},
- async register(user: Omit<User, 'id' | 'created_timestamp'>) {
+ async register(user: Omit<User, 'id' | 'created_timestamp' | 'updated_timestamp'>): Promise<boolean> {
const request = await makeRequest('users', 'POST', user);
if (request.status === 'success') return true;
throw request.message;
@@ -44,9 +44,9 @@ export const useUserStore = defineStore('user', {
return this.user;
} else throw responce.message;
},
- async fetchPublicUser(id: string): Promise<PublicUser | undefined> {
+ async fetchPublicUser(id: string): Promise<PublicUser | null> {
if (this.users[id]) return this.users[id];
- if (this.current_fetching.includes(id)) return;
+ if (this.current_fetching.includes(id)) return null;
this.current_fetching.push(id);
const response = await makeRequest<PublicUser[]>(`users/public/${id}`, 'GET', {});
if (response.status === 'success' && response.result?.length) {