refactor: remove pocketbase (#1138)

This commit is contained in:
Jonas Plum
2025-09-02 21:58:08 +02:00
committed by GitHub
parent f28c238135
commit eba2615ec0
435 changed files with 42677 additions and 4730 deletions
-5
View File
@@ -1,5 +0,0 @@
import PocketBase from 'pocketbase'
const pocketbase = new PocketBase('/')
pocketbase.autoCancellation(false)
export const pb = pocketbase
-156
View File
@@ -1,156 +0,0 @@
export interface Type {
id: string
singular: string
plural: string
icon: string
schema: JSONSchema
}
export interface Ticket {
id: string
type: string
name: string
description: string
open: boolean
resolution: string
schema: JSONSchema
state: any
owner: string
created: string
updated: string
expand: {
owner: User
type: Type
comments_via_ticket: Array<Comment>
timeline_via_ticket: Array<TimelineItem>
links_via_ticket: Array<Link>
files_via_ticket: Array<File>
tasks_via_ticket: Array<Task>
}
}
export interface SearchTicket {
id: string
name: string
created: string
description: string
open: boolean
type: string
owner_name: string
}
export interface Task {
id: string
ticket: string
name: string
open: boolean
owner: string
created: string
updated: string
expand: {
ticket: Ticket
owner: User
}
}
export interface Comment {
id: string
ticket: string
author: string
message: string
created: string
updated: string
expand: {
ticket: Ticket
author: User
}
}
export interface TimelineItem {
id: string
ticket: string
message: string
time: string
created: string
updated: string
expand: {
ticket: Ticket
}
}
export interface Link {
id: string
ticket: string
name: string
url: string
created: string
updated: string
expand: {
ticket: Ticket
owner: User
}
}
export interface File {
id: string
ticket: string
name: string
blob: string
size: number
created: string
updated: string
expand: {
ticket: Ticket
owner: User
}
}
export interface User {
id: string
name: string
email: string
created: string
updated: string
}
export interface JSONSchema {
type: 'object'
properties: Record<
string,
{
title: string
type: string
description?: string
enum?: Array<string>
}
>
required?: Array<string>
}
export interface Reaction {
id: string
name: string
trigger: string
triggerdata: any
action: string
actiondata: any
created: string
updated: string
}
+33
View File
@@ -0,0 +1,33 @@
import { cn, human } from '@/lib/utils'
describe('cn utility function', () => {
it('returns merged class names', () => {
expect(cn('class1', 'class2')).toBe('class1 class2')
})
it('handles empty inputs gracefully', () => {
expect(cn()).toBe('')
})
})
describe('human utility function', () => {
it('formats bytes less than 1024 as B', () => {
expect(human(512)).toBe('512 B')
})
it('formats bytes between 1024 and 1048576 as KB', () => {
expect(human(2048)).toBe('2.0 KB')
})
it('formats bytes greater than or equal to 1048576 as MB', () => {
expect(human(2097152)).toBe('2.0 MB')
})
it('handles zero bytes correctly', () => {
expect(human(0)).toBe('0 B')
})
it('handles negative byte values gracefully', () => {
expect(human(-1024)).toBe('-1024 B')
})
})
+27 -6
View File
@@ -3,6 +3,8 @@ import { toast } from '@/components/ui/toast'
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
import type { ModelError } from '@/client'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
@@ -15,10 +17,29 @@ export function human(bytes: number) {
: (bytes / 1048576).toFixed(1) + ' MB'
}
export function handleError(error: Error) {
toast({
title: error.name,
description: error.message,
variant: 'destructive'
})
interface FetchError {
name: string
message: string
response?: Response
}
export function handleError(title: string) {
return function (error: FetchError) {
error.response
?.json()
.then((data: ModelError) => {
toast({
title: title,
description: data.message,
variant: 'destructive'
})
})
.catch(() => {
toast({
title: title,
description: error.message,
variant: 'destructive'
})
})
}
}