168 lines
4.5 KiB
TypeScript
168 lines
4.5 KiB
TypeScript
// AUTO-GENERATED - DO NOT EDIT
|
|
// Source: .workflow/versions/vXXX/contracts/api_contract.yml
|
|
// Generated: 2025-12-20T22:10:36.433721
|
|
|
|
// ============================================================================
|
|
// Shared API Types
|
|
// Both frontend and backend MUST import from this file
|
|
// ============================================================================
|
|
|
|
// === Error Types ===
|
|
|
|
export interface ApiError {
|
|
error: string;
|
|
message?: string;
|
|
code?: string;
|
|
}
|
|
|
|
export interface ValidationError {
|
|
error: string;
|
|
details: string[];
|
|
}
|
|
|
|
// === Domain Types ===
|
|
|
|
export interface RefreshToken {
|
|
/** Unique identifier */
|
|
id: string;
|
|
/** Refresh token value */
|
|
token: string;
|
|
/** User who owns this token */
|
|
userId: string;
|
|
/** Token expiration time */
|
|
expiresAt: Date;
|
|
/** When token was created */
|
|
createdAt: Date;
|
|
/** Whether token has been revoked */
|
|
isRevoked?: boolean;
|
|
}
|
|
|
|
export interface Session {
|
|
/** Unique session identifier */
|
|
id: string;
|
|
/** User who owns this session */
|
|
userId: string;
|
|
/** Session token */
|
|
token: string;
|
|
/** Device information (browser, OS) */
|
|
deviceInfo?: Record<string, unknown>;
|
|
/** Client IP address */
|
|
ipAddress?: string;
|
|
/** Browser user agent */
|
|
userAgent?: string;
|
|
/** Last activity timestamp */
|
|
lastActivity?: Date;
|
|
/** When session was created */
|
|
createdAt: Date;
|
|
}
|
|
|
|
export interface PlayHistory {
|
|
/** Unique identifier */
|
|
id: string;
|
|
/** User who played the song */
|
|
userId: string;
|
|
/** Song that was played */
|
|
songId: string;
|
|
/** When playback started */
|
|
playedAt: Date;
|
|
/** Seconds actually played */
|
|
playedDuration?: number;
|
|
/** Did user listen to completion */
|
|
completed?: boolean;
|
|
/** Where playback was initiated */
|
|
source?: string;
|
|
}
|
|
|
|
export interface Queue {
|
|
/** Unique queue identifier */
|
|
id: string;
|
|
/** User who owns this queue */
|
|
userId: string;
|
|
/** Array of song IDs in order */
|
|
songIds: Record<string, unknown>;
|
|
/** Current playing index */
|
|
currentIndex?: number;
|
|
/** Whether queue is shuffled */
|
|
isShuffled?: boolean;
|
|
/** Repeat mode: none, one, all */
|
|
repeatMode?: string;
|
|
/** When queue was created */
|
|
createdAt: Date;
|
|
/** Last update time */
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface UploadSession {
|
|
/** Unique upload session ID */
|
|
id: string;
|
|
/** User uploading the file */
|
|
userId: string;
|
|
/** Original file name */
|
|
fileName: string;
|
|
/** Total file size in bytes */
|
|
fileSize: number;
|
|
/** File MIME type */
|
|
mimeType: string;
|
|
/** Size of each chunk */
|
|
chunkSize: number;
|
|
/** Total number of chunks */
|
|
totalChunks: number;
|
|
/** Array of uploaded chunk numbers */
|
|
uploadedChunks?: Record<string, unknown>;
|
|
/** Upload status */
|
|
status?: string;
|
|
/** Associated file ID when complete */
|
|
fileId?: string;
|
|
/** Additional file metadata */
|
|
metadata?: Record<string, unknown>;
|
|
/** When upload started */
|
|
createdAt: Date;
|
|
/** When upload session expires */
|
|
expiresAt: Date;
|
|
}
|
|
|
|
export interface SearchIndex {
|
|
/** Unique index entry ID */
|
|
id: string;
|
|
/** Type of entity (song, album, artist) */
|
|
entityType: string;
|
|
/** ID of the indexed entity */
|
|
entityId: string;
|
|
/** Entity title for search */
|
|
title: string;
|
|
/** Full text content */
|
|
content?: string;
|
|
/** Additional searchable metadata */
|
|
metadata?: Record<string, unknown>;
|
|
/** When indexed */
|
|
createdAt: Date;
|
|
/** Last update */
|
|
updatedAt: Date;
|
|
}
|
|
|
|
// === API Paths ===
|
|
|
|
export const API_PATHS = {
|
|
AUTH_REFRESH: '/api/auth/refresh' as const,
|
|
AUTH_LOGOUT: '/api/auth/logout' as const,
|
|
AUTH_SESSIONS: '/api/auth/sessions' as const,
|
|
AUTH_REVOKE_SESSION: '/api/auth/sessions/:id' as const,
|
|
AUTH_VERIFY_EMAIL: '/api/auth/verify-email' as const,
|
|
AUTH_CONFIRM_EMAIL: '/api/auth/confirm-email' as const,
|
|
PLAYER_PLAY: '/api/player/play' as const,
|
|
PLAYER_PAUSE: '/api/player/pause' as const,
|
|
PLAYER_NEXT: '/api/player/next' as const,
|
|
PLAYER_PREVIOUS: '/api/player/previous' as const,
|
|
PLAYER_QUEUE: '/api/player/queue' as const,
|
|
PLAYER_QUEUE_ADD: '/api/player/queue' as const,
|
|
PLAYER_QUEUE_CLEAR: '/api/player/queue' as const,
|
|
PLAYER_HISTORY: '/api/player/history' as const,
|
|
UPLOAD_INIT: '/api/upload/init' as const,
|
|
UPLOAD_CHUNK: '/api/upload/chunk/:uploadId/:chunkIndex' as const,
|
|
UPLOAD_COMPLETE: '/api/upload/complete/:uploadId' as const,
|
|
UPLOAD_PRESIGNED: '/api/upload/presigned-url' as const,
|
|
SEARCH: '/api/search' as const,
|
|
SEARCH_SUGGESTIONS: '/api/search/suggestions' as const,
|
|
SEARCH_INDEX: '/api/search/index' as const,
|
|
} as const;
|