obsidian-visualiser/types/api.d.ts

87 lines
1.6 KiB
TypeScript

export interface SuccessHandler
{
success: true;
session: UserSession;
}
export interface ErrorHandler
{
success: false;
error: Error | ZodError;
}
export type Return = SuccessHandler | ErrorHandler;
export interface Project {
id: number;
name: string;
owner: number;
home: string;
summary: string;
}
export interface Navigation {
title: string;
path: string;
type: string;
order: number;
private: boolean;
children?: Navigation[];
}
export type FileMetadata = Record<string, boolean | string | number>;
export type FileType = 'Markdown' | 'Canvas' | 'File' | 'Folder';
export interface File {
project: number;
path: string;
owner: number;
title: string;
order: number;
type: FileType;
content: string;
navigable: boolean;
private: boolean;
metadata: FileMetadata;
}
export interface Comment {
project: number;
path: number;
user_id: number;
sequence: number;
position: number;
length: number;
content: string;
}
export interface User {
id: number;
username: string;
}
export interface Tag {
tag: string;
project: number;
description: string;
}
export type ProjectSearch = Project &
{
pages: number;
username: string;
}
export type FileSearch = Omit<File, 'content'> &
{
comments: number;
username: string;
}
export type CommentSearch = Comment &
{
username: string;
}
export type UserSearch = User &
{
}
export type CommentedFile = File &
{
comments: CommentSearch[];
}
export interface Search {
projects: ProjectSearch[];
files: FileSearch[];
users: UserSearch[];
}