Appearance
Store Types ​
File Information ​
- Path:
app/types/stores.ts - Purpose: TypeScript interfaces for Pinia stores
- Exported From:
~/types(viaindex.ts)
Overview ​
This file contains TypeScript interfaces for Pinia store state structures including auth store, app data store, and download store. These types ensure type safety for store state and actions.
Type Definitions ​
App Data Store ​
CacheOptions ​
Cache configuration options.
typescript
interface CacheOptions {
force?: boolean
ttlMs?: number
}Properties:
force?: boolean- Force refresh (bypass cache)ttlMs?: number- Time-to-live in milliseconds
Usage:
typescript
import type { CacheOptions } from '~/types'
const options: CacheOptions = {
force: true,
ttlMs: 5 * 60 * 1000 // 5 minutes
}Auth Store ​
User ​
User data structure.
typescript
interface User {
id: number
email?: string
name?: string
workspace_id?: string | number
dealer_user_id?: number
instance_id?: number
is_slider?: boolean
is_backend_user?: number
brand_name?: string
url?: string
accessibleInstances?: any[]
settings?: Record<string, any>
[key: string]: any
}Properties:
id: number- User IDemail?: string- User emailname?: string- User nameworkspace_id?: string | number- Workspace identifierdealer_user_id?: number- Dealer user IDinstance_id?: number- Instance IDis_slider?: boolean- Slider preferenceis_backend_user?: number- Backend user flagbrand_name?: string- Brand nameurl?: string- User URLaccessibleInstances?: any[]- Accessible workspace instancessettings?: Record<string, any>- User settings[key: string]: any- Additional properties
Usage:
typescript
import type { User } from '~/types'
const user: User = {
id: 1,
email: '[email protected]',
name: 'John Doe',
workspace_id: 123,
accessibleInstances: []
}App Data Store ​
Banner ​
Banner data structure.
typescript
interface Banner {
id: number
title: string
description: string
image: string
url: string
position: number
}Properties:
id: number- Banner IDtitle: string- Banner titledescription: string- Banner descriptionimage: string- Banner image URLurl: string- Banner link URLposition: number- Display position
Tile ​
Dashboard tile data structure.
typescript
interface Tile {
id: number
title: string
icon: string
url: string
position: number
image: string
}Properties:
id: number- Tile IDtitle: string- Tile titleicon: string- Tile icon identifierurl: string- Tile link URLposition: number- Display positionimage: string- Tile image URL
File ​
File data structure.
typescript
interface File {
id: number
name: string
type: string
thumbnail: string
download_url: string
size?: number
}Properties:
id: number- File IDname: string- File nametype: string- File typethumbnail: string- Thumbnail URLdownload_url: string- Download URLsize?: number- File size in bytes
DashboardData ​
Dashboard metrics data structure.
typescript
interface DashboardData {
trending_data: File[]
recent_uploads: {
images: File[]
documents: File[]
videos: File[]
audios: File[]
}
total_images: number
total_documents: number
total_videos: number
total_audios: number
}Properties:
trending_data: File[]- Trending assetsrecent_uploads- Recent uploads by typetotal_images: number- Total images counttotal_documents: number- Total documents counttotal_videos: number- Total videos counttotal_audios: number- Total audios count
AppDataState ​
App data store state structure.
typescript
interface AppDataState {
bannerData: Banner[]
tileData: Tile[]
dashboardData: DashboardData | null
folders: any[]
leftMenuOpen: boolean
scrollTo: string
scrollToRecent: boolean
logo: string
brand: any
subscriptionFeatures: any
}Properties:
bannerData: Banner[]- Banner carousel datatileData: Tile[]- Dashboard tilesdashboardData: DashboardData | null- Dashboard metricsfolders: any[]- Folder listleftMenuOpen: boolean- Sidebar open statescrollTo: string- Scroll targetscrollToRecent: boolean- Scroll to recent flaglogo: string- Brand logo URLbrand: any- Brand datasubscriptionFeatures: any- Subscription features
Download Store ​
DownloadItem ​
Download item structure.
typescript
interface DownloadItem {
url: string
name: string
progress: number
loaded: number
total: number
downloading: boolean
source?: unknown
errorMessage?: string
[key: string]: unknown // extras
}Properties:
url: string- Download URLname: string- File nameprogress: number- Download progress (0-100)loaded: number- Bytes loadedtotal: number- Total bytesdownloading: boolean- Download in progresssource?: unknown- Abort controller sourceerrorMessage?: string- Error message if failed[key: string]: unknown- Additional properties
DownloaderState ​
Download store state structure.
typescript
interface DownloaderState {
pinned: boolean
expanded: boolean
count: number
files: Record<string, DownloadItem>
}Properties:
pinned: boolean- Download panel pinned stateexpanded: boolean- Download panel expanded statecount: number- Number of active downloadsfiles: Record<string, DownloadItem>- Download items by ID
Usage Examples ​
User Type ​
typescript
import type { User } from '~/types'
const user: User = {
id: 1,
email: '[email protected]',
name: 'John Doe',
workspace_id: 123,
accessibleInstances: [
{ workspace_id: '123', brand_name: 'Brand 1' },
{ workspace_id: '456', brand_name: 'Brand 2' }
],
settings: {
is_slider: true,
is_trading: true
}
}Dashboard Data ​
typescript
import type { DashboardData, File } from '~/types'
const dashboardData: DashboardData = {
trending_data: [
{ id: 1, name: 'file1.jpg', type: 'jpg', thumbnail: '/thumb1.jpg', download_url: '/download/1' }
],
recent_uploads: {
images: [],
documents: [],
videos: [],
audios: []
},
total_images: 100,
total_documents: 50,
total_videos: 25,
total_audios: 10
}Download Item ​
typescript
import type { DownloadItem } from '~/types'
const downloadItem: DownloadItem = {
url: '/api/files/download/123',
name: 'document.pdf',
progress: 50,
loaded: 1024,
total: 2048,
downloading: true
}Cache Options ​
typescript
import type { CacheOptions } from '~/types'
// Force refresh
const forceOptions: CacheOptions = {
force: true
}
// Custom TTL
const customTTLOptions: CacheOptions = {
ttlMs: 10 * 60 * 1000 // 10 minutes
}Related Types ​
- Used by Pinia stores
- Used by store composables
Import Example ​
typescript
import type {
User,
Banner,
Tile,
File,
DashboardData,
AppDataState,
DownloadItem,
DownloaderState,
CacheOptions
} from '~/types'Notes ​
- All store types are exported from
~/types - Types match Pinia store state structures
Usertype supports flexible propertiesDownloadItemsupports additional properties via index signatureCacheOptionsused for store caching configuration
Related Documentation ​
- Auth Store - Authentication store
- App Data Store - Application data store
- Download Store - Download store