types.ts200 lines, 3.7 KB
| 1 | export interface User { |
| 2 | id: number; |
| 3 | email: string; |
| 4 | name: string; |
| 5 | isEmailVerified: boolean; |
| 6 | lastLoginAt: string; |
| 7 | createdAt: string; |
| 8 | updatedAt: string; |
| 9 | } |
| 10 | |
| 11 | export interface AuthResponse { |
| 12 | user: User; |
| 13 | token: string; |
| 14 | } |
| 15 | |
| 16 | export interface ApiResponse<T> { |
| 17 | status: string; |
| 18 | data: T; |
| 19 | } |
| 20 | |
| 21 | export interface LoginRequest { |
| 22 | email: string; |
| 23 | password: string; |
| 24 | } |
| 25 | |
| 26 | export interface RegisterRequest extends LoginRequest { |
| 27 | name: string; |
| 28 | } |
| 29 | |
| 30 | export interface ApiError { |
| 31 | message: string; |
| 32 | code?: string; |
| 33 | status?: number; |
| 34 | } |
| 35 | |
| 36 | export interface VideoInfo { |
| 37 | title: string; |
| 38 | description: string; |
| 39 | duration: number; |
| 40 | author: string; |
| 41 | videoUrl: string; |
| 42 | url: string; |
| 43 | } |
| 44 | |
| 45 | export interface JobData { |
| 46 | url: string; |
| 47 | userId: number; |
| 48 | videoInfo?: VideoInfo; |
| 49 | } |
| 50 | |
| 51 | export interface VideoStatus { |
| 52 | id: number; |
| 53 | status: string; |
| 54 | hasTranscription: boolean; |
| 55 | hasAnalysis: boolean; |
| 56 | } |
| 57 | |
| 58 | export interface JobStatus { |
| 59 | id: string; |
| 60 | state: "waiting" | "active" | "completed" | "failed" | "delayed"; |
| 61 | progress: number; |
| 62 | timestamp: number; |
| 63 | processedOn?: number | null; |
| 64 | finishedOn?: number | null; |
| 65 | data?: JobData; |
| 66 | result?: { |
| 67 | videoInfo?: VideoInfo; |
| 68 | transcription?: { |
| 69 | text: string; |
| 70 | segments: Array<{ |
| 71 | start: number; |
| 72 | end: number; |
| 73 | text: string; |
| 74 | }>; |
| 75 | }; |
| 76 | analysis?: { |
| 77 | summary: string; |
| 78 | keyPoints: string[]; |
| 79 | topics: string[]; |
| 80 | suggestedTags: string[]; |
| 81 | }; |
| 82 | error?: string; |
| 83 | final?: boolean; |
| 84 | }; |
| 85 | failedReason?: string; |
| 86 | attemptsMade: number; |
| 87 | videoStatus?: VideoStatus; |
| 88 | final?: boolean; |
| 89 | thumbnail?: string | null; |
| 90 | } |
| 91 | |
| 92 | export interface VideoSubmissionRequest { |
| 93 | url: string; |
| 94 | } |
| 95 | |
| 96 | export interface VideoSubmissionResponse { |
| 97 | jobId: string; |
| 98 | videoInfo: VideoInfo; |
| 99 | message: string; |
| 100 | } |
| 101 | |
| 102 | export interface JobsListResponse { |
| 103 | jobs: JobStatus[]; |
| 104 | } |
| 105 | |
| 106 | // TODO: Consider creating separate types for word/chapter data if needed elsewhere |
| 107 | export interface WordTimestamp { |
| 108 | word: string; |
| 109 | startTime: number; |
| 110 | endTime: number; |
| 111 | } |
| 112 | |
| 113 | export interface Chapter { |
| 114 | title: string; |
| 115 | startTime: number; |
| 116 | endTime: number; |
| 117 | } |
| 118 | |
| 119 | export interface VideoTranscription { |
| 120 | text: string; |
| 121 | confidence: number; |
| 122 | isMusic: boolean; |
| 123 | createdAt: string; |
| 124 | wordTimestamps?: WordTimestamp[]; // Added optional word timestamps |
| 125 | } |
| 126 | |
| 127 | export interface VideoAnalysis { |
| 128 | summary: string; |
| 129 | keyPoints: string[]; |
| 130 | sentiment: string; |
| 131 | topics: string[]; |
| 132 | suggestedTags: string[]; |
| 133 | createdAt: string; |
| 134 | chapters?: Chapter[]; // Added optional chapters |
| 135 | } |
| 136 | |
| 137 | export interface Video { |
| 138 | id: number; |
| 139 | url: string; |
| 140 | title: string; |
| 141 | description: string; |
| 142 | duration: number; |
| 143 | author: string; |
| 144 | status: string; |
| 145 | createdAt: string; |
| 146 | updatedAt: string; |
| 147 | transcription: VideoTranscription | null; |
| 148 | analysis: VideoAnalysis | null; |
| 149 | } |
| 150 | |
| 151 | // Subscription Types |
| 152 | export interface SubscriptionPlan { |
| 153 | id: string; |
| 154 | name: string; |
| 155 | description: string; |
| 156 | price: number; |
| 157 | currency: string; |
| 158 | billingInterval: "monthly" | "yearly"; |
| 159 | stripePriceId: string; |
| 160 | videoLimit: number; |
| 161 | minutesLimit: number; |
| 162 | isActive: boolean; |
| 163 | createdAt: string; |
| 164 | updatedAt: string; |
| 165 | } |
| 166 | |
| 167 | export interface UserSubscription { |
| 168 | id: string; |
| 169 | status: |
| 170 | | "active" |
| 171 | | "canceled" |
| 172 | | "past_due" |
| 173 | | "unpaid" |
| 174 | | "incomplete" |
| 175 | | "trial"; |
| 176 | stripeCustomerId: string | null; |
| 177 | stripeSubscriptionId: string | null; |
| 178 | currentPeriodStart: string; |
| 179 | currentPeriodEnd: string; |
| 180 | cancelAt: string | null; |
| 181 | canceledAt: string | null; |
| 182 | videosUsed: number; |
| 183 | minutesUsed: number; |
| 184 | createdAt: string; |
| 185 | updatedAt: string; |
| 186 | plan: SubscriptionPlan; |
| 187 | } |
| 188 | |
| 189 | export interface CheckoutSessionRequest { |
| 190 | planId: string; |
| 191 | } |
| 192 | |
| 193 | export interface CheckoutSessionResponse { |
| 194 | url: string; |
| 195 | } |
| 196 | |
| 197 | export interface UserSubscriptionResponse { |
| 198 | isSubscribed: boolean; |
| 199 | subscription?: UserSubscription; |
| 200 | } |