-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed workspace management on postgres
- Loading branch information
1 parent
7d31689
commit 8a86046
Showing
25 changed files
with
286 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { WorkspaceResourceMetadata } from '@notespace/shared/src/workspace/types/resource'; | ||
import { WorkspaceResource } from '@notespace/shared/src/workspace/types/resource'; | ||
|
||
export type TreeNode = { | ||
node: WorkspaceTreeNode; | ||
children: TreeNode[]; | ||
}; | ||
|
||
export type WorkspaceTreeNode = WorkspaceResourceMetadata; | ||
export type WorkspaceTreeNode = WorkspaceResource; | ||
|
||
export type WorkspaceTreeNodes = Map<string, WorkspaceTreeNode>; | ||
export type WorkspaceTreeNodes = Record<string, WorkspaceTreeNode>; |
69 changes: 34 additions & 35 deletions
69
code/client/src/domain/workspaces/tree/useWorkspaceTree.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
begin; | ||
|
||
-- Create the pgcrypto extension if it doesn't already exist | ||
create extension if not exists "pgcrypto"; | ||
|
||
-- Create the enum type for resource_type | ||
create type resource_type as enum ('D', 'F'); | ||
|
||
-- Create the workspace table | ||
create table if not exists workspace ( | ||
id char(12) primary key default encode(gen_random_bytes(8), 'base64'), | ||
name text not null, | ||
created_at timestamp not null default now(), | ||
updated_at timestamp not null default now() | ||
); | ||
|
||
-- Create the resource table | ||
create table if not exists resource ( | ||
id char(12) primary key default encode(gen_random_bytes(8), 'base64'), | ||
workspace varchar not null references workspace(id) on delete cascade, | ||
workspace char(12) not null references workspace(id) on delete cascade, | ||
name text not null, | ||
type resource_type not null, | ||
created_at timestamp not null default now(), | ||
updated_at timestamp not null default now(), | ||
children char(12)[] not null default '{}', | ||
parent char(12) references resource(id) on delete cascade | ||
parent char(12) default null references resource(id) on delete cascade, | ||
children char(12)[] not null default '{}'::char(12)[] -- Array of resource ids | ||
); | ||
|
||
commit; | ||
commit; |
Oops, something went wrong.