Skip to content

Commit ab187ac

Browse files
Merge pull request Gerome-Elassaad#36 from Testmn23/main
Update database.types.ts to including missing but querried types
2 parents b4cc211 + 5da5a18 commit ab187ac

1 file changed

Lines changed: 277 additions & 0 deletions

File tree

lib/database.types.ts

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,203 @@ export interface UserSecuritySettings {
6060
updated_at: string
6161
}
6262

63+
export interface Project {
64+
id: string
65+
user_id: string
66+
team_id?: string
67+
title: string
68+
description?: string
69+
template_id?: string
70+
status: 'active' | 'archived' | 'deleted'
71+
is_public: boolean
72+
metadata?: Json
73+
created_at: string
74+
updated_at: string
75+
deleted_at?: string
76+
}
77+
78+
export interface Fragment {
79+
id: string
80+
user_id: string
81+
project_id?: string
82+
title: string
83+
description?: string
84+
code: string
85+
language: string
86+
template_id?: string
87+
is_public: boolean
88+
tags?: string[]
89+
metadata?: Json
90+
created_at: string
91+
updated_at: string
92+
}
93+
94+
export interface FragmentExecution {
95+
id: string
96+
fragment_id: string
97+
user_id: string
98+
execution_status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'
99+
sandbox_id?: string
100+
input_data?: Json
101+
output_data?: Json
102+
error_message?: string
103+
execution_time_ms?: number
104+
created_at: string
105+
updated_at: string
106+
}
107+
108+
export interface DbMessage {
109+
id: string
110+
project_id: string
111+
role: 'user' | 'assistant'
112+
content: Json
113+
object_data?: Json
114+
result_data?: Json
115+
sequence_number: number
116+
created_at: string
117+
}
118+
119+
export interface Team {
120+
id: string
121+
name: string
122+
email?: string
123+
tier: 'free' | 'pro' | 'enterprise'
124+
stripe_customer_id?: string
125+
stripe_subscription_id?: string
126+
subscription_status: 'active' | 'canceled' | 'past_due' | 'unpaid' | 'incomplete'
127+
current_period_start?: string
128+
current_period_end?: string
129+
cancel_at_period_end: boolean
130+
}
131+
132+
export interface UsersTeams {
133+
user_id: string
134+
team_id: string
135+
is_default: boolean
136+
}
137+
138+
export interface TeamUsageLimit {
139+
team_id: string
140+
usage_type: 'github_imports' | 'storage_mb' | 'execution_time_seconds' | 'api_calls'
141+
limit_value: number
142+
current_usage: number
143+
period_start: string
144+
period_end: string
145+
}
146+
147+
export interface UserUsage {
148+
id: string
149+
user_id: string
150+
team_id: string
151+
usage_type: 'github_imports' | 'storage_mb' | 'execution_time_seconds' | 'api_calls'
152+
usage_count: number
153+
metadata?: Json
154+
created_at: string
155+
}
156+
157+
export interface ConversationThread {
158+
id: string
159+
title: string
160+
description?: string
161+
created_by: string
162+
project_id?: string
163+
is_public: boolean
164+
metadata?: Json
165+
created_at: string
166+
updated_at: string
167+
}
168+
169+
export interface ThreadMessage {
170+
id: string
171+
thread_id: string
172+
sender_id: string
173+
content: string
174+
message_type: 'text' | 'code' | 'file' | 'image'
175+
metadata?: Json
176+
created_at: string
177+
updated_at: string
178+
}
179+
180+
export interface ThreadSummary {
181+
id: string
182+
thread_id: string
183+
title: string
184+
description?: string
185+
participant_count: number
186+
message_count: number
187+
last_message_id?: string
188+
last_activity_at: string
189+
created_at: string
190+
updated_at: string
191+
}
192+
193+
export interface ChatSession {
194+
id: string
195+
session_id: string
196+
user_id: string
197+
team_id?: string
198+
created_at: string
199+
last_activity: string
200+
message_count: number
201+
title?: string
202+
tags?: string[]
203+
model?: string
204+
template?: string
205+
status: 'active' | 'archived' | 'deleted'
206+
updated_at: string
207+
}
208+
209+
export interface ChatMessageCache {
210+
id: string
211+
session_id: string
212+
message_id: string
213+
role: 'user' | 'assistant' | 'system'
214+
content: string
215+
created_at: string
216+
model?: string
217+
template?: string
218+
token_count?: number
219+
execution_time_ms?: number
220+
}
221+
222+
export interface ApiKey {
223+
id: string
224+
user_id: string
225+
name: string
226+
key_hash: string
227+
key_prefix: string
228+
permissions: string[]
229+
last_used_at?: string
230+
expires_at?: string
231+
is_active: boolean
232+
created_at: string
233+
updated_at: string
234+
}
235+
236+
export interface FileUpload {
237+
id: string
238+
user_id: string
239+
project_id?: string
240+
filename: string
241+
file_path: string
242+
file_url: string
243+
file_size: number
244+
mime_type: string
245+
description?: string
246+
upload_status: 'pending' | 'uploading' | 'completed' | 'failed'
247+
created_at: string
248+
updated_at: string
249+
}
250+
251+
export interface SubscriptionEvent {
252+
id: string
253+
team_id: string
254+
stripe_event_id: string
255+
event_type: string
256+
event_data: Json
257+
processed_at: string
258+
}
259+
63260
export type Database = {
64261
public: {
65262
Tables: {
@@ -83,6 +280,86 @@ export type Database = {
83280
Insert: Omit<UserSecuritySettings, 'id' | 'created_at' | 'updated_at'>;
84281
Update: Partial<UserSecuritySettings>;
85282
};
283+
projects: {
284+
Row: Project;
285+
Insert: Omit<Project, 'id' | 'created_at' | 'updated_at'>;
286+
Update: Partial<Project>;
287+
};
288+
fragments: {
289+
Row: Fragment;
290+
Insert: Omit<Fragment, 'id' | 'created_at' | 'updated_at'>;
291+
Update: Partial<Fragment>;
292+
};
293+
fragment_executions: {
294+
Row: FragmentExecution;
295+
Insert: Omit<FragmentExecution, 'id' | 'created_at' | 'updated_at'>;
296+
Update: Partial<FragmentExecution>;
297+
};
298+
messages: {
299+
Row: DbMessage;
300+
Insert: Omit<DbMessage, 'id' | 'created_at'>;
301+
Update: Partial<DbMessage>;
302+
};
303+
teams: {
304+
Row: Team;
305+
Insert: Omit<Team, 'id'>;
306+
Update: Partial<Team>;
307+
};
308+
users_teams: {
309+
Row: UsersTeams;
310+
Insert: UsersTeams;
311+
Update: Partial<UsersTeams>;
312+
};
313+
team_usage_limits: {
314+
Row: TeamUsageLimit;
315+
Insert: TeamUsageLimit;
316+
Update: Partial<TeamUsageLimit>;
317+
};
318+
user_usage: {
319+
Row: UserUsage;
320+
Insert: Omit<UserUsage, 'id' | 'created_at'>;
321+
Update: Partial<UserUsage>;
322+
};
323+
conversation_threads: {
324+
Row: ConversationThread;
325+
Insert: Omit<ConversationThread, 'id' | 'created_at' | 'updated_at'>;
326+
Update: Partial<ConversationThread>;
327+
};
328+
thread_messages: {
329+
Row: ThreadMessage;
330+
Insert: Omit<ThreadMessage, 'id' | 'created_at' | 'updated_at'>;
331+
Update: Partial<ThreadMessage>;
332+
};
333+
thread_summaries: {
334+
Row: ThreadSummary;
335+
Insert: Omit<ThreadSummary, 'id' | 'created_at' | 'updated_at'>;
336+
Update: Partial<ThreadSummary>;
337+
};
338+
chat_sessions: {
339+
Row: ChatSession;
340+
Insert: Omit<ChatSession, 'id' | 'created_at' | 'updated_at'>;
341+
Update: Partial<ChatSession>;
342+
};
343+
chat_message_cache: {
344+
Row: ChatMessageCache;
345+
Insert: Omit<ChatMessageCache, 'id' | 'created_at'>;
346+
Update: Partial<ChatMessageCache>;
347+
};
348+
file_uploads: {
349+
Row: FileUpload;
350+
Insert: Omit<FileUpload, 'id' | 'created_at' | 'updated_at'>;
351+
Update: Partial<FileUpload>;
352+
};
353+
api_keys: {
354+
Row: ApiKey;
355+
Insert: Omit<ApiKey, 'id' | 'created_at' | 'updated_at'>;
356+
Update: Partial<ApiKey>;
357+
};
358+
subscription_events: {
359+
Row: SubscriptionEvent;
360+
Insert: Omit<SubscriptionEvent, 'id' | 'processed_at'>;
361+
Update: Partial<SubscriptionEvent>;
362+
};
86363
};
87364
Views: {
88365
[_ in never]: never

0 commit comments

Comments
 (0)