@devlider001/washlab-backend 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/convex/admin.d.ts +241 -0
- package/convex/attendants.d.ts +100 -0
- package/convex/audit.d.ts +125 -0
- package/convex/clerk.d.ts +52 -0
- package/convex/customers.d.ts +156 -0
- package/convex/http.d.ts +3 -0
- package/convex/lib/audit.d.ts +36 -0
- package/convex/lib/auth.d.ts +92 -0
- package/convex/lib/utils.d.ts +38 -0
- package/convex/loyalty.d.ts +82 -0
- package/convex/orders.d.ts +250 -0
- package/convex/payments.d.ts +89 -0
- package/convex/resources.d.ts +88 -0
- package/convex/schema.d.ts +369 -0
- package/package.json +3 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Id } from "./_generated/dataModel";
|
|
2
|
+
/**
|
|
3
|
+
* Admin Functions
|
|
4
|
+
*
|
|
5
|
+
* Handles admin operations: branch management, attendant management,
|
|
6
|
+
* system-wide order viewing, analytics, and customer management.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Get current admin profile (from authenticated Clerk session)
|
|
10
|
+
*/
|
|
11
|
+
export declare const getCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
12
|
+
_id: import("convex/values").GenericId<"admins">;
|
|
13
|
+
_creationTime: number;
|
|
14
|
+
lastLoginAt?: number | undefined;
|
|
15
|
+
email: string;
|
|
16
|
+
name: string;
|
|
17
|
+
clerkUserId: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
isDeleted: boolean;
|
|
20
|
+
role: "super_admin" | "admin";
|
|
21
|
+
}>>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all branches - Paginated
|
|
24
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
25
|
+
*/
|
|
26
|
+
export declare const getBranches: import("convex/server").RegisteredQuery<"public", {
|
|
27
|
+
includeInactive?: boolean | undefined;
|
|
28
|
+
cursor?: string | undefined;
|
|
29
|
+
numItems?: number | undefined;
|
|
30
|
+
}, Promise<{
|
|
31
|
+
page: {
|
|
32
|
+
_id: import("convex/values").GenericId<"branches">;
|
|
33
|
+
_creationTime: number;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
phoneNumber: string;
|
|
36
|
+
name: string;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
isDeleted: boolean;
|
|
39
|
+
isActive: boolean;
|
|
40
|
+
address: string;
|
|
41
|
+
city: string;
|
|
42
|
+
country: string;
|
|
43
|
+
pricingPerKg: number;
|
|
44
|
+
deliveryFee: number;
|
|
45
|
+
createdBy: import("convex/values").GenericId<"admins">;
|
|
46
|
+
}[];
|
|
47
|
+
isDone: boolean;
|
|
48
|
+
continueCursor: string;
|
|
49
|
+
}>>;
|
|
50
|
+
/**
|
|
51
|
+
* Get all attendants - Paginated
|
|
52
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
53
|
+
*/
|
|
54
|
+
export declare const getAttendants: import("convex/server").RegisteredQuery<"public", {
|
|
55
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
56
|
+
includeInactive?: boolean | undefined;
|
|
57
|
+
cursor?: string | undefined;
|
|
58
|
+
numItems?: number | undefined;
|
|
59
|
+
}, Promise<{
|
|
60
|
+
page: {
|
|
61
|
+
_id: import("convex/values").GenericId<"attendants">;
|
|
62
|
+
_creationTime: number;
|
|
63
|
+
lastLoginAt?: number | undefined;
|
|
64
|
+
passcode?: string | undefined;
|
|
65
|
+
phoneNumber: string;
|
|
66
|
+
email: string;
|
|
67
|
+
name: string;
|
|
68
|
+
clerkUserId: string;
|
|
69
|
+
createdAt: number;
|
|
70
|
+
isDeleted: boolean;
|
|
71
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
72
|
+
isActive: boolean;
|
|
73
|
+
}[];
|
|
74
|
+
isDone: boolean;
|
|
75
|
+
continueCursor: string;
|
|
76
|
+
}>>;
|
|
77
|
+
/**
|
|
78
|
+
* Get all orders (with filters) - Paginated
|
|
79
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
80
|
+
*/
|
|
81
|
+
export declare const getOrders: import("convex/server").RegisteredQuery<"public", {
|
|
82
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
83
|
+
status?: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled" | undefined;
|
|
84
|
+
cursor?: string | undefined;
|
|
85
|
+
numItems?: number | undefined;
|
|
86
|
+
startDate?: number | undefined;
|
|
87
|
+
endDate?: number | undefined;
|
|
88
|
+
}, Promise<{
|
|
89
|
+
page: {
|
|
90
|
+
_id: import("convex/values").GenericId<"orders">;
|
|
91
|
+
_creationTime: number;
|
|
92
|
+
createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
|
|
93
|
+
estimatedWeight?: number | undefined;
|
|
94
|
+
actualWeight?: number | undefined;
|
|
95
|
+
itemCount?: number | undefined;
|
|
96
|
+
estimatedLoads?: number | undefined;
|
|
97
|
+
whitesSeparate?: boolean | undefined;
|
|
98
|
+
notes?: string | undefined;
|
|
99
|
+
deliveryAddress?: string | undefined;
|
|
100
|
+
deliveryPhoneNumber?: string | undefined;
|
|
101
|
+
deliveryHall?: string | undefined;
|
|
102
|
+
deliveryRoom?: string | undefined;
|
|
103
|
+
paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
|
|
104
|
+
paymentId?: import("convex/values").GenericId<"payments"> | undefined;
|
|
105
|
+
fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
|
|
106
|
+
createdAt: number;
|
|
107
|
+
isDeleted: boolean;
|
|
108
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
109
|
+
deliveryFee: number;
|
|
110
|
+
customerId: import("convex/values").GenericId<"users">;
|
|
111
|
+
customerPhoneNumber: string;
|
|
112
|
+
orderNumber: string;
|
|
113
|
+
orderType: "walk_in" | "online";
|
|
114
|
+
serviceType: "wash_only" | "wash_and_dry" | "dry_only";
|
|
115
|
+
isDelivery: boolean;
|
|
116
|
+
basePrice: number;
|
|
117
|
+
totalPrice: number;
|
|
118
|
+
finalPrice: number;
|
|
119
|
+
status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
|
|
120
|
+
paymentStatus: "pending" | "paid" | "failed" | "refunded";
|
|
121
|
+
updatedAt: number;
|
|
122
|
+
statusHistory: {
|
|
123
|
+
notes?: string | undefined;
|
|
124
|
+
status: string;
|
|
125
|
+
changedAt: number;
|
|
126
|
+
changedBy: import("convex/values").GenericId<"attendants">;
|
|
127
|
+
}[];
|
|
128
|
+
}[];
|
|
129
|
+
isDone: boolean;
|
|
130
|
+
continueCursor: string;
|
|
131
|
+
}>>;
|
|
132
|
+
/**
|
|
133
|
+
* Get analytics dashboard data
|
|
134
|
+
*/
|
|
135
|
+
export declare const getAnalytics: import("convex/server").RegisteredQuery<"public", {
|
|
136
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
137
|
+
startDate?: number | undefined;
|
|
138
|
+
endDate?: number | undefined;
|
|
139
|
+
}, Promise<{
|
|
140
|
+
totalOrders: number;
|
|
141
|
+
totalRevenue: number;
|
|
142
|
+
averageOrderValue: number;
|
|
143
|
+
ordersByStatus: Record<string, number>;
|
|
144
|
+
ordersByDay: Record<string, number>;
|
|
145
|
+
topCustomers: {
|
|
146
|
+
customerId: Id<"users">;
|
|
147
|
+
name: string;
|
|
148
|
+
phoneNumber: string;
|
|
149
|
+
orderCount: number;
|
|
150
|
+
}[];
|
|
151
|
+
dateRange: {
|
|
152
|
+
start: number | undefined;
|
|
153
|
+
end: number | undefined;
|
|
154
|
+
};
|
|
155
|
+
}>>;
|
|
156
|
+
/**
|
|
157
|
+
* Get all customers (with filters) - Paginated
|
|
158
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
159
|
+
*/
|
|
160
|
+
export declare const getCustomers: import("convex/server").RegisteredQuery<"public", {
|
|
161
|
+
search?: string | undefined;
|
|
162
|
+
cursor?: string | undefined;
|
|
163
|
+
numItems?: number | undefined;
|
|
164
|
+
}, Promise<{
|
|
165
|
+
page: {
|
|
166
|
+
_id: import("convex/values").GenericId<"users">;
|
|
167
|
+
_creationTime: number;
|
|
168
|
+
email?: string | undefined;
|
|
169
|
+
clerkUserId?: string | undefined;
|
|
170
|
+
lastLoginAt?: number | undefined;
|
|
171
|
+
preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
172
|
+
phoneNumber: string;
|
|
173
|
+
name: string;
|
|
174
|
+
isRegistered: boolean;
|
|
175
|
+
isVerified: boolean;
|
|
176
|
+
createdAt: number;
|
|
177
|
+
isDeleted: boolean;
|
|
178
|
+
}[];
|
|
179
|
+
isDone: boolean;
|
|
180
|
+
continueCursor: string;
|
|
181
|
+
}>>;
|
|
182
|
+
/**
|
|
183
|
+
* Create new branch
|
|
184
|
+
*/
|
|
185
|
+
export declare const createBranch: import("convex/server").RegisteredMutation<"public", {
|
|
186
|
+
email?: string | undefined;
|
|
187
|
+
phoneNumber: string;
|
|
188
|
+
name: string;
|
|
189
|
+
address: string;
|
|
190
|
+
city: string;
|
|
191
|
+
country: string;
|
|
192
|
+
pricingPerKg: number;
|
|
193
|
+
deliveryFee: number;
|
|
194
|
+
}, Promise<import("convex/values").GenericId<"branches">>>;
|
|
195
|
+
/**
|
|
196
|
+
* Update branch details
|
|
197
|
+
*/
|
|
198
|
+
export declare const updateBranch: import("convex/server").RegisteredMutation<"public", {
|
|
199
|
+
phoneNumber?: string | undefined;
|
|
200
|
+
email?: string | undefined;
|
|
201
|
+
name?: string | undefined;
|
|
202
|
+
isActive?: boolean | undefined;
|
|
203
|
+
address?: string | undefined;
|
|
204
|
+
city?: string | undefined;
|
|
205
|
+
country?: string | undefined;
|
|
206
|
+
pricingPerKg?: number | undefined;
|
|
207
|
+
deliveryFee?: number | undefined;
|
|
208
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
209
|
+
}, Promise<import("convex/values").GenericId<"branches">>>;
|
|
210
|
+
/**
|
|
211
|
+
* Create attendant account
|
|
212
|
+
* Note: Clerk user must be created separately, then link clerkUserId
|
|
213
|
+
*/
|
|
214
|
+
export declare const createAttendant: import("convex/server").RegisteredMutation<"public", {
|
|
215
|
+
passcode?: string | undefined;
|
|
216
|
+
phoneNumber: string;
|
|
217
|
+
email: string;
|
|
218
|
+
name: string;
|
|
219
|
+
clerkUserId: string;
|
|
220
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
221
|
+
}, Promise<import("convex/values").GenericId<"attendants">>>;
|
|
222
|
+
/**
|
|
223
|
+
* Update attendant details
|
|
224
|
+
*/
|
|
225
|
+
export declare const updateAttendant: import("convex/server").RegisteredMutation<"public", {
|
|
226
|
+
phoneNumber?: string | undefined;
|
|
227
|
+
email?: string | undefined;
|
|
228
|
+
name?: string | undefined;
|
|
229
|
+
passcode?: string | undefined;
|
|
230
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
231
|
+
isActive?: boolean | undefined;
|
|
232
|
+
attendantId: import("convex/values").GenericId<"attendants">;
|
|
233
|
+
}, Promise<import("convex/values").GenericId<"attendants">>>;
|
|
234
|
+
/**
|
|
235
|
+
* Assign attendant to branch
|
|
236
|
+
*/
|
|
237
|
+
export declare const assignAttendantToBranch: import("convex/server").RegisteredMutation<"public", {
|
|
238
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
239
|
+
attendantId: import("convex/values").GenericId<"attendants">;
|
|
240
|
+
}, Promise<import("convex/values").GenericId<"attendants">>>;
|
|
241
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attendant Functions
|
|
3
|
+
*
|
|
4
|
+
* Handles attendant authentication, attendance clock-in/out, and profile queries.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get attendants by branch (admin/attendant view)
|
|
8
|
+
*/
|
|
9
|
+
export declare const getByBranch: import("convex/server").RegisteredQuery<"public", {
|
|
10
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
11
|
+
}, Promise<{
|
|
12
|
+
_id: import("convex/values").GenericId<"attendants">;
|
|
13
|
+
_creationTime: number;
|
|
14
|
+
lastLoginAt?: number | undefined;
|
|
15
|
+
passcode?: string | undefined;
|
|
16
|
+
phoneNumber: string;
|
|
17
|
+
email: string;
|
|
18
|
+
name: string;
|
|
19
|
+
clerkUserId: string;
|
|
20
|
+
createdAt: number;
|
|
21
|
+
isDeleted: boolean;
|
|
22
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
}[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* Get current attendant profile (from authenticated Clerk session)
|
|
27
|
+
*/
|
|
28
|
+
export declare const getCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
29
|
+
branch: {
|
|
30
|
+
_id: import("convex/values").GenericId<"branches">;
|
|
31
|
+
name: string;
|
|
32
|
+
address: string;
|
|
33
|
+
} | null;
|
|
34
|
+
_id: import("convex/values").GenericId<"attendants">;
|
|
35
|
+
_creationTime: number;
|
|
36
|
+
lastLoginAt?: number | undefined;
|
|
37
|
+
passcode?: string | undefined;
|
|
38
|
+
phoneNumber: string;
|
|
39
|
+
email: string;
|
|
40
|
+
name: string;
|
|
41
|
+
clerkUserId: string;
|
|
42
|
+
createdAt: number;
|
|
43
|
+
isDeleted: boolean;
|
|
44
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
45
|
+
isActive: boolean;
|
|
46
|
+
}>>;
|
|
47
|
+
/**
|
|
48
|
+
* Get current active attendance session
|
|
49
|
+
*/
|
|
50
|
+
export declare const getActiveSession: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
51
|
+
_id: import("convex/values").GenericId<"attendanceLogs">;
|
|
52
|
+
_creationTime: number;
|
|
53
|
+
clockOutAt?: number | undefined;
|
|
54
|
+
deviceId?: string | undefined;
|
|
55
|
+
deviceInfo?: string | undefined;
|
|
56
|
+
isDeleted: boolean;
|
|
57
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
58
|
+
isActive: boolean;
|
|
59
|
+
attendantId: import("convex/values").GenericId<"attendants">;
|
|
60
|
+
clockInAt: number;
|
|
61
|
+
} | null>>;
|
|
62
|
+
/**
|
|
63
|
+
* Get attendance history - Paginated
|
|
64
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
65
|
+
*/
|
|
66
|
+
export declare const getAttendanceHistory: import("convex/server").RegisteredQuery<"public", {
|
|
67
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
68
|
+
cursor?: string | undefined;
|
|
69
|
+
numItems?: number | undefined;
|
|
70
|
+
}, Promise<{
|
|
71
|
+
page: {
|
|
72
|
+
_id: import("convex/values").GenericId<"attendanceLogs">;
|
|
73
|
+
_creationTime: number;
|
|
74
|
+
clockOutAt?: number | undefined;
|
|
75
|
+
deviceId?: string | undefined;
|
|
76
|
+
deviceInfo?: string | undefined;
|
|
77
|
+
isDeleted: boolean;
|
|
78
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
79
|
+
isActive: boolean;
|
|
80
|
+
attendantId: import("convex/values").GenericId<"attendants">;
|
|
81
|
+
clockInAt: number;
|
|
82
|
+
}[];
|
|
83
|
+
isDone: boolean;
|
|
84
|
+
continueCursor: string;
|
|
85
|
+
}>>;
|
|
86
|
+
/**
|
|
87
|
+
* Clock in attendant (start attendance session)
|
|
88
|
+
*/
|
|
89
|
+
export declare const clockIn: import("convex/server").RegisteredMutation<"public", {
|
|
90
|
+
deviceId?: string | undefined;
|
|
91
|
+
deviceInfo?: string | undefined;
|
|
92
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
93
|
+
}, Promise<import("convex/values").GenericId<"attendanceLogs">>>;
|
|
94
|
+
/**
|
|
95
|
+
* Clock out attendant (end attendance session)
|
|
96
|
+
*/
|
|
97
|
+
export declare const clockOut: import("convex/server").RegisteredMutation<"public", {
|
|
98
|
+
attendanceLogId?: import("convex/values").GenericId<"attendanceLogs"> | undefined;
|
|
99
|
+
}, Promise<import("convex/values").GenericId<"attendanceLogs">>>;
|
|
100
|
+
//# sourceMappingURL=attendants.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Functions
|
|
3
|
+
*
|
|
4
|
+
* Handles querying audit logs for compliance and accountability.
|
|
5
|
+
* Only admins can access audit logs.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get audit logs by entity
|
|
9
|
+
*/
|
|
10
|
+
export declare const getByEntity: import("convex/server").RegisteredQuery<"public", {
|
|
11
|
+
entityId?: string | undefined;
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
entityType: string;
|
|
14
|
+
}, Promise<{
|
|
15
|
+
_id: import("convex/values").GenericId<"auditLogs">;
|
|
16
|
+
_creationTime: number;
|
|
17
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
18
|
+
deviceId?: string | undefined;
|
|
19
|
+
entityId?: string | undefined;
|
|
20
|
+
ipAddress?: string | undefined;
|
|
21
|
+
details?: string | undefined;
|
|
22
|
+
oldValue?: string | undefined;
|
|
23
|
+
newValue?: string | undefined;
|
|
24
|
+
actorId: string;
|
|
25
|
+
actorType: "admin" | "customer" | "attendant";
|
|
26
|
+
actorRole: string;
|
|
27
|
+
action: string;
|
|
28
|
+
entityType: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}[]>>;
|
|
31
|
+
/**
|
|
32
|
+
* Get audit logs by actor
|
|
33
|
+
*/
|
|
34
|
+
export declare const getByActor: import("convex/server").RegisteredQuery<"public", {
|
|
35
|
+
actorType?: "admin" | "customer" | "attendant" | undefined;
|
|
36
|
+
limit?: number | undefined;
|
|
37
|
+
actorId: string;
|
|
38
|
+
}, Promise<{
|
|
39
|
+
_id: import("convex/values").GenericId<"auditLogs">;
|
|
40
|
+
_creationTime: number;
|
|
41
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
42
|
+
deviceId?: string | undefined;
|
|
43
|
+
entityId?: string | undefined;
|
|
44
|
+
ipAddress?: string | undefined;
|
|
45
|
+
details?: string | undefined;
|
|
46
|
+
oldValue?: string | undefined;
|
|
47
|
+
newValue?: string | undefined;
|
|
48
|
+
actorId: string;
|
|
49
|
+
actorType: "admin" | "customer" | "attendant";
|
|
50
|
+
actorRole: string;
|
|
51
|
+
action: string;
|
|
52
|
+
entityType: string;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
}[]>>;
|
|
55
|
+
/**
|
|
56
|
+
* Get audit logs by branch
|
|
57
|
+
*/
|
|
58
|
+
export declare const getByBranch: import("convex/server").RegisteredQuery<"public", {
|
|
59
|
+
limit?: number | undefined;
|
|
60
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
61
|
+
}, Promise<{
|
|
62
|
+
_id: import("convex/values").GenericId<"auditLogs">;
|
|
63
|
+
_creationTime: number;
|
|
64
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
65
|
+
deviceId?: string | undefined;
|
|
66
|
+
entityId?: string | undefined;
|
|
67
|
+
ipAddress?: string | undefined;
|
|
68
|
+
details?: string | undefined;
|
|
69
|
+
oldValue?: string | undefined;
|
|
70
|
+
newValue?: string | undefined;
|
|
71
|
+
actorId: string;
|
|
72
|
+
actorType: "admin" | "customer" | "attendant";
|
|
73
|
+
actorRole: string;
|
|
74
|
+
action: string;
|
|
75
|
+
entityType: string;
|
|
76
|
+
timestamp: number;
|
|
77
|
+
}[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Get audit logs by action
|
|
80
|
+
*/
|
|
81
|
+
export declare const getByAction: import("convex/server").RegisteredQuery<"public", {
|
|
82
|
+
limit?: number | undefined;
|
|
83
|
+
action: string;
|
|
84
|
+
}, Promise<{
|
|
85
|
+
_id: import("convex/values").GenericId<"auditLogs">;
|
|
86
|
+
_creationTime: number;
|
|
87
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
88
|
+
deviceId?: string | undefined;
|
|
89
|
+
entityId?: string | undefined;
|
|
90
|
+
ipAddress?: string | undefined;
|
|
91
|
+
details?: string | undefined;
|
|
92
|
+
oldValue?: string | undefined;
|
|
93
|
+
newValue?: string | undefined;
|
|
94
|
+
actorId: string;
|
|
95
|
+
actorType: "admin" | "customer" | "attendant";
|
|
96
|
+
actorRole: string;
|
|
97
|
+
action: string;
|
|
98
|
+
entityType: string;
|
|
99
|
+
timestamp: number;
|
|
100
|
+
}[]>>;
|
|
101
|
+
/**
|
|
102
|
+
* Get audit logs by time range
|
|
103
|
+
*/
|
|
104
|
+
export declare const getByTimeRange: import("convex/server").RegisteredQuery<"public", {
|
|
105
|
+
limit?: number | undefined;
|
|
106
|
+
startTimestamp: number;
|
|
107
|
+
endTimestamp: number;
|
|
108
|
+
}, Promise<{
|
|
109
|
+
_id: import("convex/values").GenericId<"auditLogs">;
|
|
110
|
+
_creationTime: number;
|
|
111
|
+
branchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
112
|
+
deviceId?: string | undefined;
|
|
113
|
+
entityId?: string | undefined;
|
|
114
|
+
ipAddress?: string | undefined;
|
|
115
|
+
details?: string | undefined;
|
|
116
|
+
oldValue?: string | undefined;
|
|
117
|
+
newValue?: string | undefined;
|
|
118
|
+
actorId: string;
|
|
119
|
+
actorType: "admin" | "customer" | "attendant";
|
|
120
|
+
actorRole: string;
|
|
121
|
+
action: string;
|
|
122
|
+
entityType: string;
|
|
123
|
+
timestamp: number;
|
|
124
|
+
}[]>>;
|
|
125
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Clerk Webhook Mutations
|
|
3
|
+
*
|
|
4
|
+
* These mutations are called from the webhook handler to sync Clerk user data
|
|
5
|
+
* with our database. They are internal (not exposed to clients) for security.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sync user created event from Clerk
|
|
9
|
+
*/
|
|
10
|
+
export declare const syncUserCreated: import("convex/server").RegisteredMutation<"internal", {
|
|
11
|
+
phoneNumber?: string | undefined;
|
|
12
|
+
email?: string | undefined;
|
|
13
|
+
userType?: "admin" | "customer" | "attendant" | undefined;
|
|
14
|
+
name: string;
|
|
15
|
+
clerkUserId: string;
|
|
16
|
+
emailVerified: boolean;
|
|
17
|
+
}, Promise<import("convex/values").GenericId<"admins"> | import("convex/values").GenericId<"users"> | import("convex/values").GenericId<"attendants"> | null>>;
|
|
18
|
+
/**
|
|
19
|
+
* Sync user updated event from Clerk
|
|
20
|
+
*/
|
|
21
|
+
export declare const syncUserUpdated: import("convex/server").RegisteredMutation<"internal", {
|
|
22
|
+
phoneNumber?: string | undefined;
|
|
23
|
+
email?: string | undefined;
|
|
24
|
+
name: string;
|
|
25
|
+
clerkUserId: string;
|
|
26
|
+
emailVerified: boolean;
|
|
27
|
+
}, Promise<{
|
|
28
|
+
type: string;
|
|
29
|
+
id: import("convex/values").GenericId<"users">;
|
|
30
|
+
} | {
|
|
31
|
+
type: string;
|
|
32
|
+
id: import("convex/values").GenericId<"attendants">;
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
id: import("convex/values").GenericId<"admins">;
|
|
36
|
+
} | null>>;
|
|
37
|
+
/**
|
|
38
|
+
* Sync user deleted event from Clerk
|
|
39
|
+
*/
|
|
40
|
+
export declare const syncUserDeleted: import("convex/server").RegisteredMutation<"internal", {
|
|
41
|
+
clerkUserId: string;
|
|
42
|
+
}, Promise<{
|
|
43
|
+
type: string;
|
|
44
|
+
id: import("convex/values").GenericId<"users">;
|
|
45
|
+
} | {
|
|
46
|
+
type: string;
|
|
47
|
+
id: import("convex/values").GenericId<"attendants">;
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
id: import("convex/values").GenericId<"admins">;
|
|
51
|
+
} | null>>;
|
|
52
|
+
//# sourceMappingURL=clerk.d.ts.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Id } from "./_generated/dataModel";
|
|
2
|
+
/**
|
|
3
|
+
* Customer Functions
|
|
4
|
+
*
|
|
5
|
+
* Handles customer profile management, registration, and lookups.
|
|
6
|
+
* Customers can be guests (walk-in, no account) or registered (with Clerk account).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Get customer by phone number
|
|
10
|
+
* Used by POS for walk-in customer lookup
|
|
11
|
+
*/
|
|
12
|
+
export declare const getByPhone: import("convex/server").RegisteredQuery<"public", {
|
|
13
|
+
phoneNumber: string;
|
|
14
|
+
}, Promise<{
|
|
15
|
+
_id: import("convex/values").GenericId<"users">;
|
|
16
|
+
_creationTime: number;
|
|
17
|
+
email?: string | undefined;
|
|
18
|
+
clerkUserId?: string | undefined;
|
|
19
|
+
lastLoginAt?: number | undefined;
|
|
20
|
+
preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
21
|
+
phoneNumber: string;
|
|
22
|
+
name: string;
|
|
23
|
+
isRegistered: boolean;
|
|
24
|
+
isVerified: boolean;
|
|
25
|
+
createdAt: number;
|
|
26
|
+
isDeleted: boolean;
|
|
27
|
+
} | null>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get current customer profile (from authenticated Clerk session)
|
|
30
|
+
*/
|
|
31
|
+
export declare const getProfile: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
32
|
+
orderCount: number;
|
|
33
|
+
completedOrderCount: number;
|
|
34
|
+
_id: import("convex/values").GenericId<"users">;
|
|
35
|
+
_creationTime: number;
|
|
36
|
+
email?: string | undefined;
|
|
37
|
+
clerkUserId?: string | undefined;
|
|
38
|
+
lastLoginAt?: number | undefined;
|
|
39
|
+
preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
40
|
+
phoneNumber: string;
|
|
41
|
+
name: string;
|
|
42
|
+
isRegistered: boolean;
|
|
43
|
+
isVerified: boolean;
|
|
44
|
+
createdAt: number;
|
|
45
|
+
isDeleted: boolean;
|
|
46
|
+
}>>;
|
|
47
|
+
/**
|
|
48
|
+
* Get customer order history - Paginated
|
|
49
|
+
* Supports usePaginatedQuery for infinite scroll
|
|
50
|
+
*/
|
|
51
|
+
export declare const getOrders: import("convex/server").RegisteredQuery<"public", {
|
|
52
|
+
cursor?: string | undefined;
|
|
53
|
+
numItems?: number | undefined;
|
|
54
|
+
}, Promise<{
|
|
55
|
+
page: {
|
|
56
|
+
_id: import("convex/values").GenericId<"orders">;
|
|
57
|
+
_creationTime: number;
|
|
58
|
+
createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
|
|
59
|
+
estimatedWeight?: number | undefined;
|
|
60
|
+
actualWeight?: number | undefined;
|
|
61
|
+
itemCount?: number | undefined;
|
|
62
|
+
estimatedLoads?: number | undefined;
|
|
63
|
+
whitesSeparate?: boolean | undefined;
|
|
64
|
+
notes?: string | undefined;
|
|
65
|
+
deliveryAddress?: string | undefined;
|
|
66
|
+
deliveryPhoneNumber?: string | undefined;
|
|
67
|
+
deliveryHall?: string | undefined;
|
|
68
|
+
deliveryRoom?: string | undefined;
|
|
69
|
+
paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
|
|
70
|
+
paymentId?: import("convex/values").GenericId<"payments"> | undefined;
|
|
71
|
+
fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
|
|
72
|
+
createdAt: number;
|
|
73
|
+
isDeleted: boolean;
|
|
74
|
+
branchId: import("convex/values").GenericId<"branches">;
|
|
75
|
+
deliveryFee: number;
|
|
76
|
+
customerId: import("convex/values").GenericId<"users">;
|
|
77
|
+
customerPhoneNumber: string;
|
|
78
|
+
orderNumber: string;
|
|
79
|
+
orderType: "walk_in" | "online";
|
|
80
|
+
serviceType: "wash_only" | "wash_and_dry" | "dry_only";
|
|
81
|
+
isDelivery: boolean;
|
|
82
|
+
basePrice: number;
|
|
83
|
+
totalPrice: number;
|
|
84
|
+
finalPrice: number;
|
|
85
|
+
status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
|
|
86
|
+
paymentStatus: "pending" | "paid" | "failed" | "refunded";
|
|
87
|
+
updatedAt: number;
|
|
88
|
+
statusHistory: {
|
|
89
|
+
notes?: string | undefined;
|
|
90
|
+
status: string;
|
|
91
|
+
changedAt: number;
|
|
92
|
+
changedBy: import("convex/values").GenericId<"attendants">;
|
|
93
|
+
}[];
|
|
94
|
+
}[];
|
|
95
|
+
isDone: boolean;
|
|
96
|
+
continueCursor: string;
|
|
97
|
+
}>>;
|
|
98
|
+
/**
|
|
99
|
+
* Get customer loyalty points balance
|
|
100
|
+
*/
|
|
101
|
+
export declare const getLoyaltyPoints: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
102
|
+
points: number;
|
|
103
|
+
totalEarned: number;
|
|
104
|
+
totalRedeemed: number;
|
|
105
|
+
lastEarnedAt?: undefined;
|
|
106
|
+
lastRedeemedAt?: undefined;
|
|
107
|
+
} | {
|
|
108
|
+
points: number;
|
|
109
|
+
totalEarned: number;
|
|
110
|
+
totalRedeemed: number;
|
|
111
|
+
lastEarnedAt: number | undefined;
|
|
112
|
+
lastRedeemedAt: number | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
/**
|
|
115
|
+
* Create guest customer (walk-in, no Clerk account)
|
|
116
|
+
* Used when creating walk-in orders at POS
|
|
117
|
+
*/
|
|
118
|
+
export declare const createGuest: import("convex/server").RegisteredMutation<"public", {
|
|
119
|
+
phoneNumber: string;
|
|
120
|
+
name: string;
|
|
121
|
+
}, Promise<import("convex/values").GenericId<"users">>>;
|
|
122
|
+
/**
|
|
123
|
+
* Register customer (link Clerk account to customer profile)
|
|
124
|
+
* Called after customer signs up via Clerk
|
|
125
|
+
*/
|
|
126
|
+
export declare const register: import("convex/server").RegisteredMutation<"public", {
|
|
127
|
+
email?: string | undefined;
|
|
128
|
+
phoneNumber: string;
|
|
129
|
+
name: string;
|
|
130
|
+
}, Promise<Id<"users">>>;
|
|
131
|
+
/**
|
|
132
|
+
* Update customer profile
|
|
133
|
+
*/
|
|
134
|
+
export declare const updateProfile: import("convex/server").RegisteredMutation<"public", {
|
|
135
|
+
email?: string | undefined;
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
|
|
138
|
+
}, Promise<import("convex/values").GenericId<"users">>>;
|
|
139
|
+
/**
|
|
140
|
+
* Create test user (DEV ONLY)
|
|
141
|
+
*
|
|
142
|
+
* This mutation allows creating test users in development without requiring
|
|
143
|
+
* Clerk authentication. Useful for testing and development.
|
|
144
|
+
*
|
|
145
|
+
* WARNING: This should only be used in development environments.
|
|
146
|
+
* In production, users should be created via Clerk webhooks or the register mutation.
|
|
147
|
+
*/
|
|
148
|
+
export declare const createTestUser: import("convex/server").RegisteredMutation<"public", {
|
|
149
|
+
email?: string | undefined;
|
|
150
|
+
clerkUserId?: string | undefined;
|
|
151
|
+
isRegistered?: boolean | undefined;
|
|
152
|
+
isVerified?: boolean | undefined;
|
|
153
|
+
phoneNumber: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}, Promise<import("convex/values").GenericId<"users">>>;
|
|
156
|
+
//# sourceMappingURL=customers.d.ts.map
|
package/convex/http.d.ts
ADDED