@devlider001/washlab-backend 1.0.4 → 1.0.5

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.
Files changed (73) hide show
  1. package/convex/_generated/api.d.ts +2 -0
  2. package/convex/audit.d.ts +39 -0
  3. package/convex/notifications.d.ts +170 -0
  4. package/convex/schema.d.ts +51 -0
  5. package/dist/convex/admin.d.ts +377 -0
  6. package/dist/convex/admin.d.ts.map +1 -0
  7. package/dist/convex/admin.js +959 -0
  8. package/dist/convex/admin.js.map +1 -0
  9. package/dist/convex/analytics.d.ts +87 -0
  10. package/dist/convex/analytics.d.ts.map +1 -0
  11. package/dist/convex/analytics.js +361 -0
  12. package/dist/convex/analytics.js.map +1 -0
  13. package/dist/convex/attendants.d.ts +140 -0
  14. package/dist/convex/attendants.d.ts.map +1 -0
  15. package/dist/convex/attendants.js +337 -0
  16. package/dist/convex/attendants.js.map +1 -0
  17. package/dist/convex/audit.d.ts +158 -0
  18. package/dist/convex/audit.d.ts.map +1 -0
  19. package/dist/convex/audit.js +184 -0
  20. package/dist/convex/audit.js.map +1 -0
  21. package/dist/convex/clerk.d.ts +53 -0
  22. package/dist/convex/clerk.d.ts.map +1 -0
  23. package/dist/convex/clerk.js +316 -0
  24. package/dist/convex/clerk.js.map +1 -0
  25. package/dist/convex/customers.d.ts +224 -0
  26. package/dist/convex/customers.d.ts.map +1 -0
  27. package/dist/convex/customers.js +504 -0
  28. package/dist/convex/customers.js.map +1 -0
  29. package/dist/convex/http.d.ts +3 -0
  30. package/dist/convex/http.d.ts.map +1 -0
  31. package/dist/convex/http.js +115 -0
  32. package/dist/convex/http.js.map +1 -0
  33. package/dist/convex/lib/audit.d.ts +36 -0
  34. package/dist/convex/lib/audit.d.ts.map +1 -0
  35. package/dist/convex/lib/audit.js +59 -0
  36. package/dist/convex/lib/audit.js.map +1 -0
  37. package/dist/convex/lib/auth.d.ts +96 -0
  38. package/dist/convex/lib/auth.d.ts.map +1 -0
  39. package/dist/convex/lib/auth.js +94 -0
  40. package/dist/convex/lib/auth.js.map +1 -0
  41. package/dist/convex/lib/utils.d.ts +38 -0
  42. package/dist/convex/lib/utils.d.ts.map +1 -0
  43. package/dist/convex/lib/utils.js +71 -0
  44. package/dist/convex/lib/utils.js.map +1 -0
  45. package/dist/convex/loyalty.d.ts +82 -0
  46. package/dist/convex/loyalty.d.ts.map +1 -0
  47. package/dist/convex/loyalty.js +286 -0
  48. package/dist/convex/loyalty.js.map +1 -0
  49. package/dist/convex/orders.d.ts +326 -0
  50. package/dist/convex/orders.d.ts.map +1 -0
  51. package/dist/convex/orders.js +570 -0
  52. package/dist/convex/orders.js.map +1 -0
  53. package/dist/convex/payments.d.ts +134 -0
  54. package/dist/convex/payments.d.ts.map +1 -0
  55. package/dist/convex/payments.js +360 -0
  56. package/dist/convex/payments.js.map +1 -0
  57. package/dist/convex/resources.d.ts +119 -0
  58. package/dist/convex/resources.d.ts.map +1 -0
  59. package/dist/convex/resources.js +283 -0
  60. package/dist/convex/resources.js.map +1 -0
  61. package/dist/convex/schema.d.ts +450 -0
  62. package/dist/convex/schema.d.ts.map +1 -0
  63. package/dist/convex/schema.js +347 -0
  64. package/dist/convex/schema.js.map +1 -0
  65. package/dist/convex/vouchers.d.ts +187 -0
  66. package/dist/convex/vouchers.d.ts.map +1 -0
  67. package/dist/convex/vouchers.js +464 -0
  68. package/dist/convex/vouchers.js.map +1 -0
  69. package/dist/src/index.d.ts +9 -0
  70. package/dist/src/index.d.ts.map +1 -0
  71. package/dist/src/index.js +9 -0
  72. package/dist/src/index.js.map +1 -0
  73. package/package.json +3 -3
@@ -19,6 +19,7 @@ import type * as lib_audit from "../lib/audit.js";
19
19
  import type * as lib_auth from "../lib/auth.js";
20
20
  import type * as lib_utils from "../lib/utils.js";
21
21
  import type * as loyalty from "../loyalty.js";
22
+ import type * as notifications from "../notifications.js";
22
23
  import type * as orders from "../orders.js";
23
24
  import type * as payments from "../payments.js";
24
25
  import type * as resources from "../resources.js";
@@ -42,6 +43,7 @@ declare const fullApi: ApiFromModules<{
42
43
  "lib/auth": typeof lib_auth;
43
44
  "lib/utils": typeof lib_utils;
44
45
  loyalty: typeof loyalty;
46
+ notifications: typeof notifications;
45
47
  orders: typeof orders;
46
48
  payments: typeof payments;
47
49
  resources: typeof resources;
package/convex/audit.d.ts CHANGED
@@ -122,4 +122,43 @@ export declare const getByTimeRange: import("convex/server").RegisteredQuery<"pu
122
122
  entityType: string;
123
123
  timestamp: number;
124
124
  }[]>>;
125
+ /**
126
+ * Get all audit logs with filters - Paginated
127
+ * Supports usePaginatedQuery for infinite scroll
128
+ */
129
+ export declare const getAll: import("convex/server").RegisteredQuery<"public", {
130
+ actorType?: "admin" | "customer" | "attendant" | undefined;
131
+ action?: string | undefined;
132
+ entityType?: string | undefined;
133
+ startTimestamp?: number | undefined;
134
+ endTimestamp?: number | undefined;
135
+ paginationOpts: {
136
+ id?: number;
137
+ endCursor?: string | null;
138
+ maximumRowsRead?: number;
139
+ maximumBytesRead?: number;
140
+ numItems: number;
141
+ cursor: string | null;
142
+ };
143
+ }, Promise<{
144
+ page: {
145
+ _id: import("convex/values").GenericId<"auditLogs">;
146
+ _creationTime: number;
147
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
148
+ deviceId?: string | undefined;
149
+ entityId?: string | undefined;
150
+ ipAddress?: string | undefined;
151
+ details?: string | undefined;
152
+ oldValue?: string | undefined;
153
+ newValue?: string | undefined;
154
+ actorId: string;
155
+ actorType: "admin" | "customer" | "attendant";
156
+ actorRole: string;
157
+ action: string;
158
+ entityType: string;
159
+ timestamp: number;
160
+ }[];
161
+ isDone: boolean;
162
+ continueCursor: string;
163
+ }>>;
125
164
  //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Notification Functions
3
+ *
4
+ * Handles creating, reading, and managing system notifications
5
+ * for customers, attendants, and admins.
6
+ */
7
+ /**
8
+ * Get notifications for current user - Paginated
9
+ * Supports usePaginatedQuery for infinite scroll
10
+ */
11
+ export declare const getMyNotifications: import("convex/server").RegisteredQuery<"public", {
12
+ type?: "info" | "success" | "warning" | "error" | "order" | "payment" | "system" | undefined;
13
+ isRead?: boolean | undefined;
14
+ paginationOpts: {
15
+ id?: number;
16
+ endCursor?: string | null;
17
+ maximumRowsRead?: number;
18
+ maximumBytesRead?: number;
19
+ numItems: number;
20
+ cursor: string | null;
21
+ };
22
+ }, Promise<{
23
+ page: never[];
24
+ isDone: boolean;
25
+ continueCursor: null;
26
+ } | {
27
+ page: {
28
+ _id: import("convex/values").GenericId<"notifications">;
29
+ _creationTime: number;
30
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
31
+ entityType?: string | undefined;
32
+ entityId?: string | undefined;
33
+ actionUrl?: string | undefined;
34
+ actionLabel?: string | undefined;
35
+ readAt?: number | undefined;
36
+ senderId?: string | undefined;
37
+ senderType?: "admin" | "attendant" | "system" | undefined;
38
+ expiresAt?: number | undefined;
39
+ scheduledFor?: number | undefined;
40
+ sentAt?: number | undefined;
41
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
42
+ createdAt: number;
43
+ isDeleted: boolean;
44
+ recipientId: string;
45
+ recipientType: "admin" | "customer" | "attendant" | "all";
46
+ title: string;
47
+ message: string;
48
+ priority: "low" | "normal" | "high" | "urgent";
49
+ isRead: boolean;
50
+ }[];
51
+ isDone: boolean;
52
+ continueCursor: string;
53
+ }>>;
54
+ /**
55
+ * Get unread notification count for current user
56
+ */
57
+ export declare const getUnreadCount: import("convex/server").RegisteredQuery<"public", {}, Promise<number>>;
58
+ /**
59
+ * Mark notification as read
60
+ */
61
+ export declare const markAsRead: import("convex/server").RegisteredMutation<"public", {
62
+ notificationId: import("convex/values").GenericId<"notifications">;
63
+ }, Promise<{
64
+ success: boolean;
65
+ }>>;
66
+ /**
67
+ * Mark all notifications as read for current user
68
+ */
69
+ export declare const markAllAsRead: import("convex/server").RegisteredMutation<"public", {}, Promise<{
70
+ success: boolean;
71
+ count: number;
72
+ }>>;
73
+ /**
74
+ * Delete notification (soft delete)
75
+ */
76
+ export declare const deleteNotification: import("convex/server").RegisteredMutation<"public", {
77
+ notificationId: import("convex/values").GenericId<"notifications">;
78
+ }, Promise<{
79
+ success: boolean;
80
+ }>>;
81
+ /**
82
+ * Get all notifications (admin only) - Paginated
83
+ */
84
+ export declare const getAllNotifications: import("convex/server").RegisteredQuery<"public", {
85
+ type?: "info" | "success" | "warning" | "error" | "order" | "payment" | "system" | undefined;
86
+ recipientType?: "admin" | "customer" | "attendant" | "all" | undefined;
87
+ isRead?: boolean | undefined;
88
+ paginationOpts: {
89
+ id?: number;
90
+ endCursor?: string | null;
91
+ maximumRowsRead?: number;
92
+ maximumBytesRead?: number;
93
+ numItems: number;
94
+ cursor: string | null;
95
+ };
96
+ }, Promise<{
97
+ page: {
98
+ _id: import("convex/values").GenericId<"notifications">;
99
+ _creationTime: number;
100
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
101
+ entityType?: string | undefined;
102
+ entityId?: string | undefined;
103
+ actionUrl?: string | undefined;
104
+ actionLabel?: string | undefined;
105
+ readAt?: number | undefined;
106
+ senderId?: string | undefined;
107
+ senderType?: "admin" | "attendant" | "system" | undefined;
108
+ expiresAt?: number | undefined;
109
+ scheduledFor?: number | undefined;
110
+ sentAt?: number | undefined;
111
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
112
+ createdAt: number;
113
+ isDeleted: boolean;
114
+ recipientId: string;
115
+ recipientType: "admin" | "customer" | "attendant" | "all";
116
+ title: string;
117
+ message: string;
118
+ priority: "low" | "normal" | "high" | "urgent";
119
+ isRead: boolean;
120
+ }[];
121
+ isDone: boolean;
122
+ continueCursor: string;
123
+ }>>;
124
+ /**
125
+ * Create notification (admin only)
126
+ */
127
+ export declare const createNotification: import("convex/server").RegisteredMutation<"public", {
128
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
129
+ entityType?: string | undefined;
130
+ entityId?: string | undefined;
131
+ recipientId?: string | undefined;
132
+ actionUrl?: string | undefined;
133
+ actionLabel?: string | undefined;
134
+ priority?: "low" | "normal" | "high" | "urgent" | undefined;
135
+ expiresAt?: number | undefined;
136
+ scheduledFor?: number | undefined;
137
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
138
+ recipientType: "admin" | "customer" | "attendant" | "all";
139
+ title: string;
140
+ message: string;
141
+ }, Promise<{
142
+ notificationId: import("convex/values").GenericId<"notifications">;
143
+ success: boolean;
144
+ }>>;
145
+ /**
146
+ * Delete notification (admin only - hard delete)
147
+ */
148
+ export declare const adminDeleteNotification: import("convex/server").RegisteredMutation<"public", {
149
+ notificationId: import("convex/values").GenericId<"notifications">;
150
+ }, Promise<{
151
+ success: boolean;
152
+ }>>;
153
+ /**
154
+ * Create notification (internal - for system use)
155
+ */
156
+ export declare const createSystemNotification: import("convex/server").RegisteredMutation<"internal", {
157
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
158
+ entityType?: string | undefined;
159
+ entityId?: string | undefined;
160
+ actionUrl?: string | undefined;
161
+ actionLabel?: string | undefined;
162
+ priority?: "low" | "normal" | "high" | "urgent" | undefined;
163
+ expiresAt?: number | undefined;
164
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
165
+ recipientId: string;
166
+ recipientType: "admin" | "customer" | "attendant" | "all";
167
+ title: string;
168
+ message: string;
169
+ }, Promise<import("convex/values").GenericId<"notifications">>>;
170
+ //# sourceMappingURL=notifications.d.ts.map
@@ -445,6 +445,57 @@ declare const _default: import("convex/server").SchemaDefinition<{
445
445
  by_customer: ["customerId", "_creationTime"];
446
446
  by_used_at: ["usedAt", "_creationTime"];
447
447
  }, {}, {}>;
448
+ notifications: import("convex/server").TableDefinition<import("convex/values").VObject<{
449
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
450
+ entityType?: string | undefined;
451
+ entityId?: string | undefined;
452
+ actionUrl?: string | undefined;
453
+ actionLabel?: string | undefined;
454
+ readAt?: number | undefined;
455
+ senderId?: string | undefined;
456
+ senderType?: "admin" | "attendant" | "system" | undefined;
457
+ expiresAt?: number | undefined;
458
+ scheduledFor?: number | undefined;
459
+ sentAt?: number | undefined;
460
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
461
+ createdAt: number;
462
+ isDeleted: boolean;
463
+ recipientId: string;
464
+ recipientType: "admin" | "customer" | "attendant" | "all";
465
+ title: string;
466
+ message: string;
467
+ priority: "low" | "normal" | "high" | "urgent";
468
+ isRead: boolean;
469
+ }, {
470
+ recipientId: import("convex/values").VString<string, "required">;
471
+ recipientType: import("convex/values").VUnion<"admin" | "customer" | "attendant" | "all", [import("convex/values").VLiteral<"customer", "required">, import("convex/values").VLiteral<"attendant", "required">, import("convex/values").VLiteral<"admin", "required">, import("convex/values").VLiteral<"all", "required">], "required", never>;
472
+ title: import("convex/values").VString<string, "required">;
473
+ message: import("convex/values").VString<string, "required">;
474
+ type: import("convex/values").VUnion<"info" | "success" | "warning" | "error" | "order" | "payment" | "system", [import("convex/values").VLiteral<"info", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"warning", "required">, import("convex/values").VLiteral<"error", "required">, import("convex/values").VLiteral<"order", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"system", "required">], "required", never>;
475
+ actionUrl: import("convex/values").VString<string | undefined, "optional">;
476
+ actionLabel: import("convex/values").VString<string | undefined, "optional">;
477
+ entityType: import("convex/values").VString<string | undefined, "optional">;
478
+ entityId: import("convex/values").VString<string | undefined, "optional">;
479
+ priority: import("convex/values").VUnion<"low" | "normal" | "high" | "urgent", [import("convex/values").VLiteral<"low", "required">, import("convex/values").VLiteral<"normal", "required">, import("convex/values").VLiteral<"high", "required">, import("convex/values").VLiteral<"urgent", "required">], "required", never>;
480
+ isRead: import("convex/values").VBoolean<boolean, "required">;
481
+ readAt: import("convex/values").VFloat64<number | undefined, "optional">;
482
+ senderId: import("convex/values").VString<string | undefined, "optional">;
483
+ senderType: import("convex/values").VUnion<"admin" | "attendant" | "system" | undefined, [import("convex/values").VLiteral<"admin", "required">, import("convex/values").VLiteral<"attendant", "required">, import("convex/values").VLiteral<"system", "required">], "optional", never>;
484
+ branchId: import("convex/values").VId<import("convex/values").GenericId<"branches"> | undefined, "optional">;
485
+ expiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
486
+ scheduledFor: import("convex/values").VFloat64<number | undefined, "optional">;
487
+ createdAt: import("convex/values").VFloat64<number, "required">;
488
+ sentAt: import("convex/values").VFloat64<number | undefined, "optional">;
489
+ isDeleted: import("convex/values").VBoolean<boolean, "required">;
490
+ }, "required", "type" | "createdAt" | "isDeleted" | "branchId" | "entityType" | "entityId" | "recipientId" | "recipientType" | "title" | "message" | "actionUrl" | "actionLabel" | "priority" | "isRead" | "readAt" | "senderId" | "senderType" | "expiresAt" | "scheduledFor" | "sentAt">, {
491
+ by_recipient: ["recipientId", "recipientType", "_creationTime"];
492
+ by_recipient_read: ["recipientId", "recipientType", "isRead", "_creationTime"];
493
+ by_type: ["type", "_creationTime"];
494
+ by_priority: ["priority", "_creationTime"];
495
+ by_created: ["createdAt", "_creationTime"];
496
+ by_branch: ["branchId", "_creationTime"];
497
+ by_entity: ["entityType", "entityId", "_creationTime"];
498
+ }, {}, {}>;
448
499
  }, true>;
449
500
  export default _default;
450
501
  //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1,377 @@
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
+ code: string;
41
+ address: string;
42
+ city: string;
43
+ country: string;
44
+ pricingPerKg: number;
45
+ deliveryFee: number;
46
+ createdBy: import("convex/values").GenericId<"admins">;
47
+ }[];
48
+ isDone: boolean;
49
+ continueCursor: string;
50
+ }>>;
51
+ /**
52
+ * Get branch by code
53
+ */
54
+ export declare const getBranchByCode: import("convex/server").RegisteredQuery<"public", {
55
+ code: string;
56
+ }, Promise<{
57
+ _id: import("convex/values").GenericId<"branches">;
58
+ _creationTime: number;
59
+ email?: string | undefined;
60
+ phoneNumber: string;
61
+ name: string;
62
+ createdAt: number;
63
+ isDeleted: boolean;
64
+ isActive: boolean;
65
+ code: string;
66
+ address: string;
67
+ city: string;
68
+ country: string;
69
+ pricingPerKg: number;
70
+ deliveryFee: number;
71
+ createdBy: import("convex/values").GenericId<"admins">;
72
+ } | null>>;
73
+ /**
74
+ * Get single branch by ID
75
+ */
76
+ export declare const getBranch: import("convex/server").RegisteredQuery<"public", {
77
+ branchId: import("convex/values").GenericId<"branches">;
78
+ }, Promise<{
79
+ _id: import("convex/values").GenericId<"branches">;
80
+ _creationTime: number;
81
+ email?: string | undefined;
82
+ phoneNumber: string;
83
+ name: string;
84
+ createdAt: number;
85
+ isDeleted: boolean;
86
+ isActive: boolean;
87
+ code: string;
88
+ address: string;
89
+ city: string;
90
+ country: string;
91
+ pricingPerKg: number;
92
+ deliveryFee: number;
93
+ createdBy: import("convex/values").GenericId<"admins">;
94
+ } | null>>;
95
+ /**
96
+ * Get all attendants - Paginated
97
+ * Supports usePaginatedQuery for infinite scroll
98
+ */
99
+ export declare const getAttendants: import("convex/server").RegisteredQuery<"public", {
100
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
101
+ includeInactive?: boolean | undefined;
102
+ cursor?: string | undefined;
103
+ numItems?: number | undefined;
104
+ }, Promise<{
105
+ page: {
106
+ _id: import("convex/values").GenericId<"attendants">;
107
+ _creationTime: number;
108
+ lastLoginAt?: number | undefined;
109
+ passcode?: string | undefined;
110
+ phoneNumber: string;
111
+ email: string;
112
+ name: string;
113
+ clerkUserId: string;
114
+ createdAt: number;
115
+ isDeleted: boolean;
116
+ branchId: import("convex/values").GenericId<"branches">;
117
+ isActive: boolean;
118
+ }[];
119
+ isDone: boolean;
120
+ continueCursor: string;
121
+ }>>;
122
+ /**
123
+ * Get all orders (with filters) - Paginated
124
+ * Supports usePaginatedQuery for infinite scroll
125
+ */
126
+ export declare const getOrders: import("convex/server").RegisteredQuery<"public", {
127
+ status?: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled" | undefined;
128
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
129
+ cursor?: string | undefined;
130
+ numItems?: number | undefined;
131
+ startDate?: number | undefined;
132
+ endDate?: number | undefined;
133
+ }, Promise<{
134
+ page: {
135
+ _id: import("convex/values").GenericId<"orders">;
136
+ _creationTime: number;
137
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
138
+ estimatedWeight?: number | undefined;
139
+ actualWeight?: number | undefined;
140
+ itemCount?: number | undefined;
141
+ estimatedLoads?: number | undefined;
142
+ whitesSeparate?: boolean | undefined;
143
+ bagCardNumber?: string | undefined;
144
+ notes?: string | undefined;
145
+ deliveryAddress?: string | undefined;
146
+ deliveryPhoneNumber?: string | undefined;
147
+ deliveryHall?: string | undefined;
148
+ deliveryRoom?: string | undefined;
149
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
150
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
151
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
152
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
153
+ createdAt: number;
154
+ isDeleted: boolean;
155
+ branchId: import("convex/values").GenericId<"branches">;
156
+ deliveryFee: number;
157
+ customerId: import("convex/values").GenericId<"users">;
158
+ customerPhoneNumber: string;
159
+ orderNumber: string;
160
+ orderType: "walk_in" | "online";
161
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
162
+ isDelivery: boolean;
163
+ basePrice: number;
164
+ totalPrice: number;
165
+ finalPrice: number;
166
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
167
+ updatedAt: number;
168
+ statusHistory: {
169
+ notes?: string | undefined;
170
+ status: string;
171
+ changedAt: number;
172
+ changedBy: import("convex/values").GenericId<"attendants">;
173
+ }[];
174
+ }[];
175
+ isDone: boolean;
176
+ continueCursor: string;
177
+ }>>;
178
+ /**
179
+ * Get analytics dashboard data
180
+ */
181
+ export declare const getAnalytics: import("convex/server").RegisteredQuery<"public", {
182
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
183
+ startDate?: number | undefined;
184
+ endDate?: number | undefined;
185
+ }, Promise<{
186
+ totalOrders: number;
187
+ totalRevenue: number;
188
+ averageOrderValue: number;
189
+ ordersByStatus: Record<string, number>;
190
+ ordersByDay: Record<string, number>;
191
+ topCustomers: {
192
+ customerId: Id<"users">;
193
+ name: string;
194
+ phoneNumber: string;
195
+ orderCount: number;
196
+ }[];
197
+ dateRange: {
198
+ start: number | undefined;
199
+ end: number | undefined;
200
+ };
201
+ }>>;
202
+ /**
203
+ * Get all customers (with filters) - Paginated
204
+ * Supports usePaginatedQuery for infinite scroll
205
+ */
206
+ export declare const getCustomers: import("convex/server").RegisteredQuery<"public", {
207
+ isRegistered?: boolean | undefined;
208
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
209
+ search?: string | undefined;
210
+ paginationOpts: {
211
+ id?: number;
212
+ endCursor?: string | null;
213
+ maximumRowsRead?: number;
214
+ maximumBytesRead?: number;
215
+ numItems: number;
216
+ cursor: string | null;
217
+ };
218
+ }, Promise<{
219
+ page: {
220
+ orderCount: number;
221
+ completedOrderCount: number;
222
+ totalSpent: number;
223
+ lastOrderDate: number;
224
+ lastOrderNumber: string;
225
+ _id: import("convex/values").GenericId<"users">;
226
+ _creationTime: number;
227
+ email?: string | undefined;
228
+ clerkUserId?: string | undefined;
229
+ statusNote?: string | undefined;
230
+ statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
231
+ statusChangedAt?: number | undefined;
232
+ lastLoginAt?: number | undefined;
233
+ preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
234
+ phoneNumber: string;
235
+ name: string;
236
+ isRegistered: boolean;
237
+ isVerified: boolean;
238
+ status: "active" | "blocked" | "suspended" | "restricted";
239
+ createdAt: number;
240
+ isDeleted: boolean;
241
+ }[];
242
+ isDone: boolean;
243
+ continueCursor: string;
244
+ }>>;
245
+ /**
246
+ * Get customer statistics/aggregations
247
+ */
248
+ export declare const getCustomerStats: import("convex/server").RegisteredQuery<"public", {}, Promise<{
249
+ totalCustomers: number;
250
+ registeredCustomers: number;
251
+ walkInCustomers: number;
252
+ activeCustomers: number;
253
+ blockedCustomers: number;
254
+ suspendedCustomers: number;
255
+ restrictedCustomers: number;
256
+ verifiedCustomers: number;
257
+ customersWithActiveOrders: number;
258
+ totalRevenue: number;
259
+ }>>;
260
+ /**
261
+ * Change customer status (with required note)
262
+ */
263
+ export declare const changeCustomerStatus: import("convex/server").RegisteredMutation<"public", {
264
+ status: "active" | "blocked" | "suspended" | "restricted";
265
+ customerId: import("convex/values").GenericId<"users">;
266
+ note: string;
267
+ }, Promise<import("convex/values").GenericId<"users">>>;
268
+ /**
269
+ * Delete a customer (soft delete)
270
+ */
271
+ export declare const deleteCustomer: import("convex/server").RegisteredMutation<"public", {
272
+ customerId: import("convex/values").GenericId<"users">;
273
+ }, Promise<import("convex/values").GenericId<"users">>>;
274
+ /**
275
+ * Create new branch
276
+ */
277
+ export declare const createBranch: import("convex/server").RegisteredMutation<"public", {
278
+ email?: string | undefined;
279
+ phoneNumber: string;
280
+ name: string;
281
+ code: string;
282
+ address: string;
283
+ city: string;
284
+ country: string;
285
+ pricingPerKg: number;
286
+ deliveryFee: number;
287
+ }, Promise<import("convex/values").GenericId<"branches">>>;
288
+ /**
289
+ * Update branch details
290
+ */
291
+ export declare const updateBranch: import("convex/server").RegisteredMutation<"public", {
292
+ phoneNumber?: string | undefined;
293
+ email?: string | undefined;
294
+ name?: string | undefined;
295
+ isActive?: boolean | undefined;
296
+ code?: string | undefined;
297
+ address?: string | undefined;
298
+ city?: string | undefined;
299
+ country?: string | undefined;
300
+ pricingPerKg?: number | undefined;
301
+ deliveryFee?: number | undefined;
302
+ branchId: import("convex/values").GenericId<"branches">;
303
+ }, Promise<import("convex/values").GenericId<"branches">>>;
304
+ /**
305
+ * Toggle branch active status (enable/disable)
306
+ */
307
+ export declare const toggleBranchStatus: import("convex/server").RegisteredMutation<"public", {
308
+ branchId: import("convex/values").GenericId<"branches">;
309
+ }, Promise<{
310
+ branchId: import("convex/values").GenericId<"branches">;
311
+ isActive: boolean;
312
+ }>>;
313
+ /**
314
+ * Delete branch (soft delete)
315
+ */
316
+ export declare const deleteBranch: import("convex/server").RegisteredMutation<"public", {
317
+ branchId: import("convex/values").GenericId<"branches">;
318
+ }, Promise<import("convex/values").GenericId<"branches">>>;
319
+ /**
320
+ * Create attendant account
321
+ * Note: Clerk user must be created separately, then link clerkUserId
322
+ */
323
+ export declare const createAttendant: import("convex/server").RegisteredMutation<"public", {
324
+ passcode?: string | undefined;
325
+ phoneNumber: string;
326
+ email: string;
327
+ name: string;
328
+ clerkUserId: string;
329
+ branchId: import("convex/values").GenericId<"branches">;
330
+ }, Promise<import("convex/values").GenericId<"attendants">>>;
331
+ /**
332
+ * Update attendant details
333
+ */
334
+ export declare const updateAttendant: import("convex/server").RegisteredMutation<"public", {
335
+ phoneNumber?: string | undefined;
336
+ email?: string | undefined;
337
+ name?: string | undefined;
338
+ passcode?: string | undefined;
339
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
340
+ isActive?: boolean | undefined;
341
+ attendantId: import("convex/values").GenericId<"attendants">;
342
+ }, Promise<import("convex/values").GenericId<"attendants">>>;
343
+ /**
344
+ * Assign attendant to branch
345
+ */
346
+ export declare const assignAttendantToBranch: import("convex/server").RegisteredMutation<"public", {
347
+ branchId: import("convex/values").GenericId<"branches">;
348
+ attendantId: import("convex/values").GenericId<"attendants">;
349
+ }, Promise<import("convex/values").GenericId<"attendants">>>;
350
+ /**
351
+ * Delete attendant (soft delete)
352
+ */
353
+ export declare const deleteAttendant: import("convex/server").RegisteredMutation<"public", {
354
+ attendantId: import("convex/values").GenericId<"attendants">;
355
+ }, Promise<import("convex/values").GenericId<"attendants">>>;
356
+ /**
357
+ * Create admin account
358
+ * Only super admins can create other admins
359
+ * Note: Clerk user must be created separately, then link clerkUserId
360
+ */
361
+ export declare const createAdmin: import("convex/server").RegisteredMutation<"public", {
362
+ email: string;
363
+ name: string;
364
+ clerkUserId: string;
365
+ role: "super_admin" | "admin";
366
+ }, Promise<import("convex/values").GenericId<"admins">>>;
367
+ /**
368
+ * Create the first super admin (one-time setup)
369
+ * This function can only be used when no super admins exist in the database
370
+ * After the first super admin is created, use createAdmin instead
371
+ */
372
+ export declare const createFirstSuperAdmin: import("convex/server").RegisteredMutation<"public", {
373
+ email: string;
374
+ name: string;
375
+ clerkUserId: string;
376
+ }, Promise<import("convex/values").GenericId<"admins">>>;
377
+ //# sourceMappingURL=admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../convex/admin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE5C;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;GAMzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;GA+BtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;UAuB1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;UAoBpB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;GAwCxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;GAqFvB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;GA6D3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;uDA2D/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;uDA6CzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;0DA+DvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;0DA2EvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;GAiC7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;0DAgDvB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;4DAiE1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;4DA6C1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;4DAuClC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;4DAgD1B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;wDAsDtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;wDAqDhC,CAAC"}