refactor: directory path handling
intsead of storing path as field in directories table, it is derived on demand, because it makes moving directories a heck lot eaiser Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
17
packages/convex/model/filesystem.ts
Normal file
17
packages/convex/model/filesystem.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Id } from "../_generated/dataModel"
|
||||
|
||||
export type DirectoryPathComponent = {
|
||||
id: Id<"directories">
|
||||
name: string
|
||||
}
|
||||
|
||||
export type FilePathComponent = {
|
||||
id: Id<"files">
|
||||
name: string
|
||||
}
|
||||
|
||||
export type PathComponent = FilePathComponent | DirectoryPathComponent
|
||||
|
||||
export type FilePath = [...DirectoryPathComponent[], PathComponent]
|
||||
|
||||
export type ReverseFilePath = [PathComponent, ...DirectoryPathComponent[]]
|
Reference in New Issue
Block a user