87 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

// DB Types
import { KNOWN_PLATFORMS } from "./constants"
export type User = {
2024-10-21 13:57:45 -06:00
id: string
name: string
email: string
username: string
avatarUrl: string | null
createdAt: Date
2024-10-21 13:57:45 -06:00
generations: number
bio: string | null
personalWebsite: string | null
links: UserLink[]
tier: "FREE" | "PRO" | "ENTERPRISE"
tierExpiresAt: Date
lastResetDate: number
sandbox: Sandbox[]
usersToSandboxes: UsersToSandboxes[]
}
export type KnownPlatform = (typeof KNOWN_PLATFORMS)[number]
export type UserLink = {
url: string
platform: KnownPlatform
2024-10-21 13:57:45 -06:00
}
export type Sandbox = {
2024-10-21 13:57:45 -06:00
id: string
name: string
type: string
visibility: "public" | "private"
createdAt: Date
userId: string
2024-11-11 22:02:34 +01:00
likeCount: number
viewCount: number
2024-10-21 13:57:45 -06:00
usersToSandboxes: UsersToSandboxes[]
}
export type SandboxWithLiked = Sandbox & {
liked: boolean
}
2024-05-01 01:53:49 -04:00
export type UsersToSandboxes = {
2024-10-21 13:57:45 -06:00
userId: string
sandboxId: string
sharedOn: Date
}
2024-04-26 00:10:53 -04:00
export type R2Files = {
2024-10-21 13:57:45 -06:00
objects: R2FileData[]
truncated: boolean
delimitedPrefixes: any[]
}
2024-04-26 00:10:53 -04:00
export type R2FileData = {
2024-10-21 13:57:45 -06:00
storageClass: string
uploaded: string
checksums: any
httpEtag: string
etag: string
size: number
version: string
key: string
}
export type TFolder = {
2024-10-21 13:57:45 -06:00
id: string
type: "folder"
name: string
children: (TFile | TFolder)[]
}
export type TFile = {
2024-10-21 13:57:45 -06:00
id: string
type: "file"
name: string
}
export type TTab = TFile & {
2024-10-21 13:57:45 -06:00
saved: boolean
}
export type TFileData = {
2024-10-21 13:57:45 -06:00
id: string
data: string
}