Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Rename a query

Hakan Shehuc40522fccbf0
diff --git a/apps/desktop/src/main/handlers/queries/index.ts b/apps/desktop/src/main/handlers/queries/index.ts
index 90dbc255..30f786f8 100644
--- a/apps/desktop/src/main/handlers/queries/index.ts
+++ b/apps/desktop/src/main/handlers/queries/index.ts
@@ -11,7 +11,7 @@ import { RecordListQueryHandler } from '@/main/handlers/queries/record-list';
import { FileListQueryHandler } from '@/main/handlers/queries/file-list';
import { EmojisGetQueryHandler } from '@/main/handlers/queries/emojis-get';
import { IconsGetQueryHandler } from '@/main/handlers/queries/icons-get';
-import { NodeWithAncestorsGetQueryHandler } from '@/main/handlers/queries/node-with-ancestors-get';
+import { NodeTreeGetQueryHandler } from '@/main/handlers/queries/node-tree-get';
import { NodeChildrenGetQueryHandler } from '@/main/handlers/queries/node-children-get';
type QueryHandlerMap = {
@@ -30,6 +30,6 @@ export const queryHandlerMap: QueryHandlerMap = {
file_list: new FileListQueryHandler(),
emojis_get: new EmojisGetQueryHandler(),
icons_get: new IconsGetQueryHandler(),
- node_with_ancestors_get: new NodeWithAncestorsGetQueryHandler(),
+ node_tree_get: new NodeTreeGetQueryHandler(),
node_children_get: new NodeChildrenGetQueryHandler(),
};
diff --git a/apps/desktop/src/main/handlers/queries/node-with-ancestors-get.ts b/apps/desktop/src/main/handlers/queries/node-tree-get.ts
similarity index 79%
rename from apps/desktop/src/main/handlers/queries/node-with-ancestors-get.ts
rename to apps/desktop/src/main/handlers/queries/node-tree-get.ts
index 57e73b01..35a85572 100644
--- a/apps/desktop/src/main/handlers/queries/node-with-ancestors-get.ts
+++ b/apps/desktop/src/main/handlers/queries/node-tree-get.ts
@@ -8,15 +8,15 @@ import {
QueryResult,
} from '@/main/types';
import { isEqual } from 'lodash-es';
-import { NodeWithAncestorsGetQueryInput } from '@/operations/queries/node-with-ancestors-get';
+import { NodeTreeGetQueryInput } from '@/operations/queries/node-tree-get';
import { fetchNodeAncestors } from '@/main/utils';
-export class NodeWithAncestorsGetQueryHandler
- implements QueryHandler<NodeWithAncestorsGetQueryInput>
+export class NodeTreeGetQueryHandler
+ implements QueryHandler<NodeTreeGetQueryInput>
{
public async handleQuery(
- input: NodeWithAncestorsGetQueryInput
- ): Promise<QueryResult<NodeWithAncestorsGetQueryInput>> {
+ input: NodeTreeGetQueryInput
+ ): Promise<QueryResult<NodeTreeGetQueryInput>> {
const rows = await this.fetchNodes(input);
return {
@@ -29,9 +29,9 @@ export class NodeWithAncestorsGetQueryHandler
public async checkForChanges(
changes: MutationChange[],
- input: NodeWithAncestorsGetQueryInput,
+ input: NodeTreeGetQueryInput,
state: Record<string, any>
- ): Promise<ChangeCheckResult<NodeWithAncestorsGetQueryInput>> {
+ ): Promise<ChangeCheckResult<NodeTreeGetQueryInput>> {
if (
!changes.some(
(change) =>
@@ -64,7 +64,7 @@ export class NodeWithAncestorsGetQueryHandler
}
private async fetchNodes(
- input: NodeWithAncestorsGetQueryInput
+ input: NodeTreeGetQueryInput
): Promise<SelectNode[]> {
const workspaceDatabase = await databaseManager.getWorkspaceDatabase(
input.userId
diff --git a/apps/desktop/src/operations/queries/node-with-ancestors-get.ts b/apps/desktop/src/operations/queries/node-tree-get.ts
similarity index 52%
rename from apps/desktop/src/operations/queries/node-with-ancestors-get.ts
rename to apps/desktop/src/operations/queries/node-tree-get.ts
index 263ae5e4..96741dbb 100644
--- a/apps/desktop/src/operations/queries/node-with-ancestors-get.ts
+++ b/apps/desktop/src/operations/queries/node-tree-get.ts
@@ -1,15 +1,15 @@
import { Node } from '@colanode/core';
-export type NodeWithAncestorsGetQueryInput = {
- type: 'node_with_ancestors_get';
+export type NodeTreeGetQueryInput = {
+ type: 'node_tree_get';
nodeId: string;
userId: string;
};
declare module '@/operations/queries' {
interface QueryMap {
- node_with_ancestors_get: {
- input: NodeWithAncestorsGetQueryInput;
+ node_tree_get: {
+ input: NodeTreeGetQueryInput;
output: Node[];
};
}
diff --git a/apps/desktop/src/renderer/components/channels/channel-container.tsx b/apps/desktop/src/renderer/components/channels/channel-container.tsx
index 254b6d28..fd894765 100644
--- a/apps/desktop/src/renderer/components/channels/channel-container.tsx
+++ b/apps/desktop/src/renderer/components/channels/channel-container.tsx
@@ -11,7 +11,7 @@ interface ChannelContainerProps {
export const ChannelContainer = ({ nodeId }: ChannelContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});
diff --git a/apps/desktop/src/renderer/components/databases/database-container.tsx b/apps/desktop/src/renderer/components/databases/database-container.tsx
index da22e8b0..b8b046f2 100644
--- a/apps/desktop/src/renderer/components/databases/database-container.tsx
+++ b/apps/desktop/src/renderer/components/databases/database-container.tsx
@@ -11,7 +11,7 @@ interface DatabaseContainerProps {
export const DatabaseContainer = ({ nodeId }: DatabaseContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});
diff --git a/apps/desktop/src/renderer/components/files/file-container.tsx b/apps/desktop/src/renderer/components/files/file-container.tsx
index 25376a1f..ca276ab3 100644
--- a/apps/desktop/src/renderer/components/files/file-container.tsx
+++ b/apps/desktop/src/renderer/components/files/file-container.tsx
@@ -11,7 +11,7 @@ interface FileContainerProps {
export const FileContainer = ({ nodeId }: FileContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});
diff --git a/apps/desktop/src/renderer/components/folders/folder-container.tsx b/apps/desktop/src/renderer/components/folders/folder-container.tsx
index a8f10426..45e301f2 100644
--- a/apps/desktop/src/renderer/components/folders/folder-container.tsx
+++ b/apps/desktop/src/renderer/components/folders/folder-container.tsx
@@ -12,7 +12,7 @@ export const FolderContainer = ({ nodeId }: FolderContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});
diff --git a/apps/desktop/src/renderer/components/pages/page-container.tsx b/apps/desktop/src/renderer/components/pages/page-container.tsx
index 94791069..bc15266c 100644
--- a/apps/desktop/src/renderer/components/pages/page-container.tsx
+++ b/apps/desktop/src/renderer/components/pages/page-container.tsx
@@ -11,7 +11,7 @@ interface PageContainerProps {
export const PageContainer = ({ nodeId }: PageContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});
diff --git a/apps/desktop/src/renderer/components/records/record-container.tsx b/apps/desktop/src/renderer/components/records/record-container.tsx
index cc1d66c2..1f5102ef 100644
--- a/apps/desktop/src/renderer/components/records/record-container.tsx
+++ b/apps/desktop/src/renderer/components/records/record-container.tsx
@@ -11,7 +11,7 @@ interface RecordContainerProps {
export const RecordContainer = ({ nodeId }: RecordContainerProps) => {
const workspace = useWorkspace();
const { data, isPending } = useQuery({
- type: 'node_with_ancestors_get',
+ type: 'node_tree_get',
nodeId,
userId: workspace.userId,
});