First reworks

This commit is contained in:
2024-10-28 17:49:46 +01:00
parent fef8c092a9
commit 1b2472bc1a
155 changed files with 536 additions and 4281 deletions

87
types/api.d.ts vendored
View File

@@ -1,87 +0,0 @@
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
View File

@@ -1,71 +0,0 @@
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_timestamp: number;
}
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
View File

@@ -1,34 +0,0 @@
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[];
}