-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtypes.ts
More file actions
207 lines (188 loc) · 4.99 KB
/
types.ts
File metadata and controls
207 lines (188 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
export enum UserRole {
ADMIN = 'admin',
USER = 'user',
GUEST = 'guest',
}
export enum InvitationStatus {
CONFIRMED = 'confirmed',
PENDING = 'pending',
DECLINED = 'declined',
}
export enum PaymentStatus {
PAID = 'paid',
NOT_PAID = 'not_paid',
}
export interface UserProfile {
id: string; // UUID
name: string;
username: string;
email?: string; // Made optional for mobile-only signup
phone: string;
role: UserRole;
profile_pic_url?: string;
location: string;
date_of_birth?: string;
password?: string;
mission_count?: number; // Number of spots attended
// Fields for mock OTP flow
isVerified?: boolean;
otp?: string;
otpExpiry?: string;
latitude?: number;
longitude?: number;
is_sponsor?: boolean;
sponsor_count?: number;
}
export interface SpotSponsor {
id: string;
spot_id: string;
sponsor_id: string;
amount_covered: number;
message?: string;
created_at?: string;
sponsor?: UserProfile;
org_code?: string;
management_name?: string;
}
export interface Spot {
id: string; // UUID
date: string; // ISO String
day: string;
timing: string;
budget: number;
location: string;
created_by: string; // User ID
feedback?: string;
description?: string;
latitude?: number;
longitude?: number;
members?: UserProfile[];
is_sponsored?: boolean;
sponsored_by?: string;
sponsor?: SpotSponsor;
org_code?: string;
}
export interface Drink {
id: string; // UUID
spot_id: string; // UUID
name: string;
image_url: string;
votes: number;
suggested_by: string; // User's ID
voted_by: string[]; // Array of User IDs
price?: number; // Price set by admin
profiles?: { name: string }; // Joined data for suggester's name
}
export interface Cigarette {
id: string; // UUID
spot_id: string; // UUID
name: string;
image_url: string;
added_by: string; // User's ID
price?: number; // Price set by admin
created_at: string; // ISO String
profiles?: { name: string; profile_pic_url?: string }; // Joined data for adder's name
}
export interface Food {
id: string; // UUID
spot_id: string; // UUID
name: string;
image_url: string;
added_by: string; // User's ID
price?: number; // Price set by admin
created_at: string; // ISO String
profiles?: { name: string; profile_pic_url?: string }; // Joined data for adder's name
}
export interface Invitation {
id: string; // UUID
spot_id: string; // UUID
user_id: string; // UUID
profiles: UserProfile; // Joined data from profiles table
status: InvitationStatus;
}
export interface Payment {
id: string; // UUID
spot_id: string; // UUID
user_id: string; // UUID
profiles: UserProfile; // Joined data from profiles table
status: PaymentStatus;
drink_total_amount?: number; // Total amount for selected drinks
}
export interface Transaction {
id: string; // UUID
user_id: string; // UUID
spot_id: string; // UUID
amount: number;
payment_method: string;
status: PaymentStatus;
created_at: string; // ISO String
profiles?: UserProfile; // Joined data from profiles table
spots?: Spot; // Joined data from spots table
}
export interface DrinkBrand {
id: string; // UUID
name: string;
category: 'beer' | 'whiskey' | 'vodka' | 'rum' | 'wine' | 'cocktail' | 'soft_drink' | 'other';
image_url?: string;
base_price: number;
description?: string;
is_available: boolean;
created_at: string;
updated_at: string;
}
export interface UserDrinkSelection {
id: string; // UUID
spot_id: string; // UUID
user_id: string; // UUID
drink_brand_id: string; // UUID
quantity: number;
unit_price: number;
total_price: number;
created_at: string;
updated_at: string;
drink_brand?: DrinkBrand; // Joined data
profiles?: UserProfile; // Joined data
}
export interface Notification {
id: string; // UUID
title: string;
message: string;
timestamp: string; // ISO String
read: boolean;
}
export interface Moment {
id: string; // UUID
user_id: string; // UUID
image_url: string;
caption?: string;
intel?: string; // Intel information (can be same as caption or separate)
created_at: string; // ISO String
}
export interface ChatMessage {
id: string; // UUID
user_id: string; // UUID
content_text?: string;
content_image_urls?: string[];
created_at: string; // ISO String
profiles: Pick<UserProfile, 'name' | 'profile_pic_url' | 'is_sponsor' | 'sponsor_count'>; // Joined data
reactions?: Record<string, string[]>; // e.g. { '👍': ['user_id_1', 'user_id_2'] }
}
export interface Attendance {
id: string; // UUID
spot_id: string; // UUID
user_id: string; // UUID
attended: boolean;
created_at: string; // ISO String
updated_at: string; // ISO String
profiles?: UserProfile; // Joined data from profiles table
}
// FIX: Add Supabase User type definition to resolve import errors
// in other files, as it seems to be missing from the project's dependency.
export interface User {
id: string;
email?: string;
app_metadata: { [key: string]: any };
user_metadata: { [key: string]: any };
aud: string;
created_at: string;
}