You've already forked obsidian-visualiser
Starting to put back the server part. Currently the registration and login are almost ready.
This commit is contained in:
87
types/api.d.ts
vendored
Normal file
87
types/api.d.ts
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
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[];
|
||||
}
|
||||
71
types/auth.d.ts
vendored
Normal file
71
types/auth.d.ts
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import type { ComputedRef, Ref } from 'vue'
|
||||
|
||||
import 'vue-router';
|
||||
declare module 'vue-router'
|
||||
{
|
||||
interface RouteMeta
|
||||
{
|
||||
requiresAuth?: boolean;
|
||||
guestsGoesTo?: string;
|
||||
usersGoesTo?: string;
|
||||
}
|
||||
}
|
||||
|
||||
import 'nuxt';
|
||||
declare module 'nuxt'
|
||||
{
|
||||
interface RuntimeConfig
|
||||
{
|
||||
session: SessionConfig;
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserRawData {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
state: number;
|
||||
}
|
||||
|
||||
export interface UserExtendedData {
|
||||
signin: Date;
|
||||
}
|
||||
|
||||
export type User = UserRawData & UserExtendedData;
|
||||
|
||||
export interface UserSession {
|
||||
user?: User;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface UserSessionRequired extends UserSession {
|
||||
user: User;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UserSessionComposable {
|
||||
/**
|
||||
* Computed indicating if the auth session is ready
|
||||
*/
|
||||
ready: ComputedRef<boolean>
|
||||
/**
|
||||
* Computed indicating if the user is logged in.
|
||||
*/
|
||||
loggedIn: ComputedRef<boolean>
|
||||
/**
|
||||
* The user object if logged in, null otherwise.
|
||||
*/
|
||||
user: ComputedRef<User | null>
|
||||
/**
|
||||
* The session object.
|
||||
*/
|
||||
session: Ref<UserSession>
|
||||
/**
|
||||
* Fetch the user session from the server.
|
||||
*/
|
||||
fetch: () => Promise<void>
|
||||
/**
|
||||
* Clear the user session and remove the session cookie.
|
||||
*/
|
||||
clear: () => Promise<void>
|
||||
}
|
||||
34
types/canvas.d.ts
vendored
Normal file
34
types/canvas.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export interface CanvasContent {
|
||||
nodes: CanvasNode[];
|
||||
edges: CanvasEdge[];
|
||||
groups: CanvasGroup[];
|
||||
}
|
||||
export type CanvasColor = {
|
||||
class?: string;
|
||||
} & {
|
||||
hex?: string;
|
||||
}
|
||||
export interface CanvasNode {
|
||||
type: 'group' | 'text';
|
||||
id: string;
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color?: CanvasColor;
|
||||
label?: string;
|
||||
text?: any;
|
||||
};
|
||||
export interface CanvasEdge {
|
||||
id: string;
|
||||
fromNode: string;
|
||||
fromSide: 'bottom' | 'top' | 'left' | 'right';
|
||||
toNode: string;
|
||||
toSide: 'bottom' | 'top' | 'left' | 'right';
|
||||
color?: CanvasColor;
|
||||
label?: string;
|
||||
};
|
||||
export interface CanvasGroup {
|
||||
name: string;
|
||||
nodes: string[];
|
||||
}
|
||||
Reference in New Issue
Block a user