Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

1.3 KB
Raw Blame
import type { TvFile, TvFileKindFilter, TvFileQuota } from 'taskview-api'

export type FileKind = 'image' | 'pdf' | 'video' | 'audio' | 'text' | 'other'

export type FileUploadStatus = 'uploading' | 'error'

export type FileUploadItem = {
  id: string
  goalId: number
  taskId: number | null
  file: File
  name: string
  sizeBytes: number
  progress: number
  status: FileUploadStatus
  errorKey: string | null
  controller: AbortController
}

export type FilesProjectListState = {
  goalId: number | null
  items: TvFile[]
  nextCursor: string | null
  search: string
  type: TvFileKindFilter
  loading: boolean
}

export type FilesStorageState = {
  enabled: boolean | null
  maxFileSizeBytes: number | null
}

export type FilesStoreState = {
  byTask: Record<number, TvFile[]>
  loadingTasks: Record<number, boolean>
  project: FilesProjectListState
  uploads: FileUploadItem[]
  storage: FilesStorageState
  quotaByGoal: Record<number, TvFileQuota>
}

export type FilesUploadArgs = {
  goalId: number
  taskId: number | null
  files: File[]
}

export type FilesFetchForGoalArgs = {
  goalId: number
  search?: string
  type?: TvFileKindFilter
  append?: boolean
}

export type FilesRemoteChangeArgs = {
  goalId: number
  taskIds: number[]
}

export type FilesOpenArgs = {
  file: TvFile
  inline: boolean
}