@devlider001/washlab-backend 1.1.0 → 1.1.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 CHANGED
@@ -7,7 +7,58 @@ import { Id } from "./_generated/dataModel";
7
7
  */
8
8
  /**
9
9
  * Get current admin profile (from authenticated Clerk session)
10
+ * Returns null if user is authenticated but not an admin (for redirect to unauthorized page)
11
+ * Returns null if user is not authenticated (frontend handles redirect to sign-in)
10
12
  */
13
+ /**
14
+ * Get all attendance logs (admin view)
15
+ * Returns attendance logs with optional filtering by branch and date range
16
+ */
17
+ export declare const getAttendanceLogs: import("convex/server").RegisteredQuery<"public", {
18
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
19
+ startDate?: number | undefined;
20
+ endDate?: number | undefined;
21
+ limit?: number | undefined;
22
+ }, Promise<{
23
+ _id: import("convex/values").GenericId<"attendanceLogs">;
24
+ clockInAt: number;
25
+ clockOutAt: number | undefined;
26
+ deviceId: string | undefined;
27
+ isActive: boolean;
28
+ durationMinutes: number | null;
29
+ attendant: {
30
+ _id: import("convex/values").GenericId<"attendants">;
31
+ name: string;
32
+ email: string;
33
+ } | null;
34
+ branch: {
35
+ _id: import("convex/values").GenericId<"branches">;
36
+ name: string;
37
+ code: string;
38
+ } | null;
39
+ }[]>>;
40
+ /**
41
+ * Get station/branch attendance summary
42
+ * Returns active attendances grouped by branch
43
+ */
44
+ export declare const getBranchAttendanceSummary: import("convex/server").RegisteredQuery<"public", {}, Promise<{
45
+ branch: {
46
+ _id: import("convex/values").GenericId<"branches">;
47
+ name: string;
48
+ code: string;
49
+ terminalId: string | undefined;
50
+ };
51
+ activeCount: number;
52
+ attendances: {
53
+ attendanceId: import("convex/values").GenericId<"attendanceLogs">;
54
+ clockInAt: number;
55
+ attendant: {
56
+ _id: import("convex/values").GenericId<"attendants">;
57
+ name: string;
58
+ email: string;
59
+ } | null;
60
+ }[];
61
+ }[]>>;
11
62
  export declare const getCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
12
63
  _id: import("convex/values").GenericId<"admins">;
13
64
  _creationTime: number;
@@ -18,7 +69,7 @@ export declare const getCurrentUser: import("convex/server").RegisteredQuery<"pu
18
69
  createdAt: number;
19
70
  isDeleted: boolean;
20
71
  role: "super_admin" | "admin";
21
- }>>;
72
+ } | null>>;
22
73
  /**
23
74
  * Get all branches - Paginated
24
75
  * Supports usePaginatedQuery for infinite scroll
@@ -38,6 +89,7 @@ export declare const getBranches: import("convex/server").RegisteredQuery<"publi
38
89
  _id: import("convex/values").GenericId<"branches">;
39
90
  _creationTime: number;
40
91
  email?: string | undefined;
92
+ terminalId?: string | undefined;
41
93
  stationPinHash?: string | undefined;
42
94
  requireStationLogin?: boolean | undefined;
43
95
  phoneNumber: string;
@@ -56,6 +108,14 @@ export declare const getBranches: import("convex/server").RegisteredQuery<"publi
56
108
  isDone: boolean;
57
109
  continueCursor: string;
58
110
  }>>;
111
+ /**
112
+ * Get all active branches with codes (public - no auth required)
113
+ * Used for displaying available branch codes on login page
114
+ */
115
+ export declare const getActiveBranchesList: import("convex/server").RegisteredQuery<"public", {}, Promise<{
116
+ code: string;
117
+ name: string;
118
+ }[]>>;
59
119
  /**
60
120
  * Get branch by code
61
121
  */
@@ -63,22 +123,15 @@ export declare const getBranchByCode: import("convex/server").RegisteredQuery<"p
63
123
  code: string;
64
124
  }, Promise<{
65
125
  _id: import("convex/values").GenericId<"branches">;
66
- _creationTime: number;
67
- email?: string | undefined;
68
- stationPinHash?: string | undefined;
69
- requireStationLogin?: boolean | undefined;
70
- phoneNumber: string;
71
126
  name: string;
72
- createdAt: number;
73
- isDeleted: boolean;
74
- isActive: boolean;
75
- createdBy: import("convex/values").GenericId<"admins">;
76
127
  code: string;
77
128
  address: string;
78
129
  city: string;
79
130
  country: string;
80
- pricingPerKg: number;
81
- deliveryFee: number;
131
+ phoneNumber: string;
132
+ email: string | undefined;
133
+ requireStationLogin: boolean;
134
+ hasStationPin: boolean;
82
135
  } | null>>;
83
136
  /**
84
137
  * Get single branch by ID
@@ -89,6 +142,7 @@ export declare const getBranch: import("convex/server").RegisteredQuery<"public"
89
142
  _id: import("convex/values").GenericId<"branches">;
90
143
  _creationTime: number;
91
144
  email?: string | undefined;
145
+ terminalId?: string | undefined;
92
146
  stationPinHash?: string | undefined;
93
147
  requireStationLogin?: boolean | undefined;
94
148
  phoneNumber: string;
@@ -317,16 +371,16 @@ export declare const deleteCustomer: import("convex/server").RegisteredMutation<
317
371
  */
318
372
  export declare const createBranch: import("convex/server").RegisteredMutation<"public", {
319
373
  email?: string | undefined;
320
- requireStationLogin?: boolean | undefined;
321
- stationPin?: string | undefined;
322
374
  phoneNumber: string;
323
375
  name: string;
324
376
  code: string;
377
+ terminalId: string;
325
378
  address: string;
326
379
  city: string;
327
380
  country: string;
328
381
  pricingPerKg: number;
329
382
  deliveryFee: number;
383
+ stationPin: string;
330
384
  }, Promise<import("convex/values").GenericId<"branches">>>;
331
385
  /**
332
386
  * Update branch details
@@ -337,12 +391,12 @@ export declare const updateBranch: import("convex/server").RegisteredMutation<"p
337
391
  name?: string | undefined;
338
392
  isActive?: boolean | undefined;
339
393
  code?: string | undefined;
394
+ terminalId?: string | undefined;
340
395
  address?: string | undefined;
341
396
  city?: string | undefined;
342
397
  country?: string | undefined;
343
398
  pricingPerKg?: number | undefined;
344
399
  deliveryFee?: number | undefined;
345
- requireStationLogin?: boolean | undefined;
346
400
  stationPin?: string | undefined;
347
401
  branchId: import("convex/values").GenericId<"branches">;
348
402
  }, Promise<import("convex/values").GenericId<"branches">>>;
@@ -307,6 +307,7 @@ export declare const findByEmail: import("convex/server").RegisteredQuery<"publi
307
307
  authenticationMethods: ("biometric_face" | "biometric_hand" | "pin" | "password")[];
308
308
  hasBiometric: boolean;
309
309
  hasPin: boolean;
310
+ hasPassword: boolean;
310
311
  } | null>>;
311
312
  /**
312
313
  * Start verification (for login or action)
@@ -29,9 +29,15 @@ export declare const getByPhone: import("convex/server").RegisteredQuery<"public
29
29
  createdAt: number;
30
30
  isDeleted: boolean;
31
31
  } | null>>;
32
+ /**
33
+ * Check if authenticated user is an admin or attendant
34
+ * Returns true if user is admin/attendant (should be blocked from customer app)
35
+ */
36
+ export declare const checkIsAdminOrAttendant: import("convex/server").RegisteredQuery<"public", {}, Promise<boolean>>;
32
37
  /**
33
38
  * Get current customer profile (from authenticated Clerk session)
34
39
  * Returns null if customer hasn't completed registration yet
40
+ * Returns null if user is admin/attendant (will be handled by unauthorized page)
35
41
  */
36
42
  export declare const getProfile: import("convex/server").RegisteredQuery<"public", {}, Promise<{
37
43
  orderCount: number;
@@ -1,3 +1,4 @@
1
+ import { Id } from "../_generated/dataModel";
1
2
  /**
2
3
  * Utility functions for common operations
3
4
  */
@@ -35,4 +36,5 @@ export declare function formatDate(date: Date): string;
35
36
  * Get current timestamp in milliseconds
36
37
  */
37
38
  export declare function getCurrentTimestamp(): number;
39
+ export declare function safeGet<T extends Id<any>>(ctx: any, id?: T): Promise<any>;
38
40
  //# sourceMappingURL=utils.d.ts.map
@@ -64,7 +64,7 @@ export declare const deleteNotification: import("convex/server").RegisteredMutat
64
64
  */
65
65
  export declare const getAllNotifications: import("convex/server").RegisteredQuery<"public", {
66
66
  type?: "info" | "success" | "warning" | "error" | "order" | "payment" | "system" | undefined;
67
- recipientType?: "admin" | "customer" | "attendant" | "all" | undefined;
67
+ recipientType?: "admin" | "customer" | "attendant" | "station" | "all" | undefined;
68
68
  isRead?: boolean | undefined;
69
69
  paginationOpts: {
70
70
  id?: number;
@@ -94,7 +94,7 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
94
94
  createdAt: number;
95
95
  isDeleted: boolean;
96
96
  recipientId: string;
97
- recipientType: "admin" | "customer" | "attendant" | "all";
97
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
98
98
  title: string;
99
99
  message: string;
100
100
  priority: "low" | "normal" | "high" | "urgent";
@@ -116,7 +116,7 @@ export declare const createNotification: import("convex/server").RegisteredMutat
116
116
  expiresAt?: number | undefined;
117
117
  scheduledFor?: number | undefined;
118
118
  type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
119
- recipientType: "admin" | "customer" | "attendant" | "all";
119
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
120
120
  title: string;
121
121
  message: string;
122
122
  }, Promise<{
@@ -139,7 +139,7 @@ export declare const internalCreateNotification: import("convex/server").Registe
139
139
  expiresAt?: number | undefined;
140
140
  scheduledFor?: number | undefined;
141
141
  type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
142
- recipientType: "admin" | "customer" | "attendant" | "all";
142
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
143
143
  title: string;
144
144
  message: string;
145
145
  }, Promise<{
@@ -167,7 +167,7 @@ export declare const createSystemNotification: import("convex/server").Registere
167
167
  expiresAt?: number | undefined;
168
168
  type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
169
169
  recipientId: string;
170
- recipientType: "admin" | "customer" | "attendant" | "all";
170
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
171
171
  title: string;
172
172
  message: string;
173
173
  }, Promise<import("convex/values").GenericId<"notifications">>>;
@@ -38,6 +38,7 @@ export declare const getBranches: import("convex/server").RegisteredQuery<"publi
38
38
  _id: import("convex/values").GenericId<"branches">;
39
39
  _creationTime: number;
40
40
  email?: string | undefined;
41
+ terminalId?: string | undefined;
41
42
  stationPinHash?: string | undefined;
42
43
  requireStationLogin?: boolean | undefined;
43
44
  phoneNumber: string;
@@ -65,6 +66,7 @@ export declare const getBranchByCode: import("convex/server").RegisteredQuery<"p
65
66
  _id: import("convex/values").GenericId<"branches">;
66
67
  _creationTime: number;
67
68
  email?: string | undefined;
69
+ terminalId?: string | undefined;
68
70
  stationPinHash?: string | undefined;
69
71
  requireStationLogin?: boolean | undefined;
70
72
  phoneNumber: string;
@@ -89,6 +91,7 @@ export declare const getBranch: import("convex/server").RegisteredQuery<"public"
89
91
  _id: import("convex/values").GenericId<"branches">;
90
92
  _creationTime: number;
91
93
  email?: string | undefined;
94
+ terminalId?: string | undefined;
92
95
  stationPinHash?: string | undefined;
93
96
  requireStationLogin?: boolean | undefined;
94
97
  phoneNumber: string;
@@ -104,6 +107,60 @@ export declare const getBranch: import("convex/server").RegisteredQuery<"public"
104
107
  pricingPerKg: number;
105
108
  deliveryFee: number;
106
109
  } | null>>;
110
+ /**
111
+ * Get pending online orders (awaiting drop-off at POS)
112
+ */
113
+ export declare const getPending: import("convex/server").RegisteredQuery<"public", {
114
+ branchId: import("convex/values").GenericId<"branches">;
115
+ }, Promise<{
116
+ _id: import("convex/values").GenericId<"orders">;
117
+ _creationTime: number;
118
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
119
+ customerEmail?: string | undefined;
120
+ estimatedWeight?: number | undefined;
121
+ actualWeight?: number | undefined;
122
+ itemCount?: number | undefined;
123
+ estimatedLoads?: number | undefined;
124
+ whitesSeparate?: boolean | undefined;
125
+ bagCardNumber?: string | undefined;
126
+ notes?: string | undefined;
127
+ deliveryAddress?: string | undefined;
128
+ deliveryPhoneNumber?: string | undefined;
129
+ deliveryHall?: string | undefined;
130
+ deliveryRoom?: string | undefined;
131
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
132
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
133
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
134
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
135
+ createdAt: number;
136
+ isDeleted: boolean;
137
+ branchId: import("convex/values").GenericId<"branches">;
138
+ deliveryFee: number;
139
+ customerId: import("convex/values").GenericId<"users">;
140
+ customerPhoneNumber: string;
141
+ orderNumber: string;
142
+ orderType: "walk_in" | "online";
143
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
144
+ isDelivery: boolean;
145
+ basePrice: number;
146
+ totalPrice: number;
147
+ finalPrice: number;
148
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
149
+ updatedAt: number;
150
+ statusHistory: {
151
+ notes?: string | undefined;
152
+ changedBy?: import("convex/values").GenericId<"attendants"> | undefined;
153
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
154
+ status: string;
155
+ changedAt: number;
156
+ }[];
157
+ }[]>>;
158
+ export declare const updateWeight: import("convex/server").RegisteredMutation<"public", {
159
+ bagCardNumber?: string | undefined;
160
+ actualWeight: number;
161
+ itemCount: number;
162
+ orderId: import("convex/values").GenericId<"orders">;
163
+ }, Promise<void>>;
107
164
  /**
108
165
  * Get all attendants - Paginated
109
166
  * Supports usePaginatedQuery for infinite scroll
@@ -320,6 +377,7 @@ export declare const createBranch: import("convex/server").RegisteredMutation<"p
320
377
  phoneNumber: string;
321
378
  name: string;
322
379
  code: string;
380
+ terminalId: string;
323
381
  address: string;
324
382
  city: string;
325
383
  country: string;
@@ -539,4 +597,30 @@ export declare const getByOrderNumber: import("convex/server").RegisteredQuery<"
539
597
  changedAt: number;
540
598
  }[];
541
599
  } | null>>;
600
+ /**
601
+ * Create online order (customer creates from website)
602
+ * Supports both guest checkout and authenticated users
603
+ */
604
+ export declare const createOnline: import("convex/server").RegisteredMutation<"public", {
605
+ estimatedLoads?: number | undefined;
606
+ whitesSeparate?: boolean | undefined;
607
+ bagCardNumber?: string | undefined;
608
+ notes?: string | undefined;
609
+ deliveryAddress?: string | undefined;
610
+ deliveryPhoneNumber?: string | undefined;
611
+ deliveryHall?: string | undefined;
612
+ deliveryRoom?: string | undefined;
613
+ branchId: import("convex/values").GenericId<"branches">;
614
+ customerPhoneNumber: string;
615
+ customerEmail: string;
616
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
617
+ estimatedWeight: number;
618
+ itemCount: number;
619
+ isDelivery: boolean;
620
+ customerName: string;
621
+ }, Promise<{
622
+ orderId: import("convex/values").GenericId<"orders">;
623
+ orderNumber: string;
624
+ isGuest: boolean;
625
+ }>>;
542
626
  //# sourceMappingURL=orders.d.ts.map
@@ -226,6 +226,7 @@ export declare const getTransactionHistory: import("convex/server").RegisteredQu
226
226
  _id: import("convex/values").GenericId<"branches">;
227
227
  _creationTime: number;
228
228
  email?: string | undefined;
229
+ terminalId?: string | undefined;
229
230
  stationPinHash?: string | undefined;
230
231
  requireStationLogin?: boolean | undefined;
231
232
  phoneNumber: string;
@@ -142,6 +142,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
142
142
  }, {}, {}>;
143
143
  branches: import("convex/server").TableDefinition<import("convex/values").VObject<{
144
144
  email?: string | undefined;
145
+ terminalId?: string | undefined;
145
146
  stationPinHash?: string | undefined;
146
147
  requireStationLogin?: boolean | undefined;
147
148
  phoneNumber: string;
@@ -159,6 +160,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
159
160
  }, {
160
161
  name: import("convex/values").VString<string, "required">;
161
162
  code: import("convex/values").VString<string, "required">;
163
+ terminalId: import("convex/values").VString<string | undefined, "optional">;
162
164
  address: import("convex/values").VString<string, "required">;
163
165
  city: import("convex/values").VString<string, "required">;
164
166
  country: import("convex/values").VString<string, "required">;
@@ -172,10 +174,11 @@ declare const _default: import("convex/server").SchemaDefinition<{
172
174
  createdAt: import("convex/values").VFloat64<number, "required">;
173
175
  createdBy: import("convex/values").VId<import("convex/values").GenericId<"admins">, "required">;
174
176
  isDeleted: import("convex/values").VBoolean<boolean, "required">;
175
- }, "required", "phoneNumber" | "email" | "name" | "createdAt" | "isDeleted" | "isActive" | "createdBy" | "code" | "address" | "city" | "country" | "pricingPerKg" | "deliveryFee" | "stationPinHash" | "requireStationLogin">, {
177
+ }, "required", "phoneNumber" | "email" | "name" | "createdAt" | "isDeleted" | "isActive" | "createdBy" | "code" | "terminalId" | "address" | "city" | "country" | "pricingPerKg" | "deliveryFee" | "stationPinHash" | "requireStationLogin">, {
176
178
  by_city: ["city", "_creationTime"];
177
179
  by_active: ["isActive", "_creationTime"];
178
180
  by_code: ["code", "_creationTime"];
181
+ by_terminal_id: ["terminalId", "_creationTime"];
179
182
  }, {}, {}>;
180
183
  orders: import("convex/server").TableDefinition<import("convex/values").VObject<{
181
184
  createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
@@ -527,14 +530,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
527
530
  createdAt: number;
528
531
  isDeleted: boolean;
529
532
  recipientId: string;
530
- recipientType: "admin" | "customer" | "attendant" | "all";
533
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
531
534
  title: string;
532
535
  message: string;
533
536
  priority: "low" | "normal" | "high" | "urgent";
534
537
  isRead: boolean;
535
538
  }, {
536
539
  recipientId: import("convex/values").VString<string, "required">;
537
- 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>;
540
+ recipientType: import("convex/values").VUnion<"admin" | "customer" | "attendant" | "station" | "all", [import("convex/values").VLiteral<"customer", "required">, import("convex/values").VLiteral<"attendant", "required">, import("convex/values").VLiteral<"admin", "required">, import("convex/values").VLiteral<"station", "required">, import("convex/values").VLiteral<"all", "required">], "required", never>;
538
541
  title: import("convex/values").VString<string, "required">;
539
542
  message: import("convex/values").VString<string, "required">;
540
543
  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>;
@@ -566,11 +569,11 @@ declare const _default: import("convex/server").SchemaDefinition<{
566
569
  readAt: number;
567
570
  notificationId: import("convex/values").GenericId<"notifications">;
568
571
  userId: string;
569
- userType: "admin" | "customer" | "attendant";
572
+ userType: "admin" | "customer" | "attendant" | "station";
570
573
  }, {
571
574
  notificationId: import("convex/values").VId<import("convex/values").GenericId<"notifications">, "required">;
572
575
  userId: import("convex/values").VString<string, "required">;
573
- userType: import("convex/values").VUnion<"admin" | "customer" | "attendant", [import("convex/values").VLiteral<"customer", "required">, import("convex/values").VLiteral<"attendant", "required">, import("convex/values").VLiteral<"admin", "required">], "required", never>;
576
+ userType: import("convex/values").VUnion<"admin" | "customer" | "attendant" | "station", [import("convex/values").VLiteral<"customer", "required">, import("convex/values").VLiteral<"attendant", "required">, import("convex/values").VLiteral<"admin", "required">, import("convex/values").VLiteral<"station", "required">], "required", never>;
574
577
  readAt: import("convex/values").VFloat64<number, "required">;
575
578
  }, "required", "readAt" | "notificationId" | "userId" | "userType">, {
576
579
  by_notification: ["notificationId", "_creationTime"];
@@ -4,6 +4,15 @@
4
4
  * Handles station (branch) login and session management.
5
5
  * Station login is separate from attendant authentication.
6
6
  */
7
+ import { Id } from "./_generated/dataModel";
8
+ /**
9
+ * Get all active branches with codes (public - no auth required)
10
+ * Used for displaying available branch codes on login page
11
+ */
12
+ export declare const getActiveBranches: import("convex/server").RegisteredQuery<"public", {}, Promise<{
13
+ code: string;
14
+ name: string;
15
+ }[]>>;
7
16
  /**
8
17
  * Verify branch code (public - no auth required)
9
18
  * Returns branch info without sensitive data
@@ -28,30 +37,62 @@ export declare const verifyBranchCode: import("convex/server").RegisteredQuery<"
28
37
  */
29
38
  export declare const loginStation: import("convex/server").RegisteredMutation<"public", {
30
39
  deviceInfo?: string | undefined;
31
- stationPin?: string | undefined;
32
40
  branchId: import("convex/values").GenericId<"branches">;
33
41
  deviceId: string;
42
+ stationPin: string;
34
43
  }, Promise<{
35
- success: boolean;
44
+ stationToken: string;
45
+ sessionId: import("convex/values").GenericId<"stationSessions">;
36
46
  branchId: import("convex/values").GenericId<"branches">;
37
47
  branchName: string;
38
- stationToken: string;
39
48
  expiresAt: number;
49
+ loggedInBy: any;
50
+ loggedInAt: number;
51
+ } | {
52
+ stationToken: string;
40
53
  sessionId: import("convex/values").GenericId<"stationSessions">;
54
+ branchId: import("convex/values").GenericId<"branches">;
55
+ branchName: string;
56
+ expiresAt: number;
57
+ loggedInBy?: undefined;
58
+ loggedInAt?: undefined;
41
59
  }>>;
42
60
  /**
43
- * Verify station session token
61
+ * Verify station session
44
62
  */
45
63
  export declare const verifyStationSession: import("convex/server").RegisteredQuery<"public", {
46
64
  stationToken: string;
47
65
  }, Promise<{
66
+ valid: boolean;
67
+ reason: string;
68
+ branchActive: boolean;
69
+ branchId?: undefined;
70
+ branchName?: undefined;
71
+ branchCode?: undefined;
72
+ terminalId?: undefined;
73
+ deviceId?: undefined;
74
+ sessionId?: undefined;
75
+ } | {
48
76
  valid: boolean;
49
77
  branchId: import("convex/values").GenericId<"branches">;
50
- branchName: string | undefined;
78
+ branchName: string;
79
+ branchCode: string;
80
+ branchActive: boolean;
81
+ reason: string;
82
+ terminalId: string | undefined;
51
83
  deviceId: string;
52
- expiresAt: number;
53
- loggedInAt: number;
54
- } | null>>;
84
+ sessionId: string;
85
+ } | {
86
+ valid: boolean;
87
+ branchId: import("convex/values").GenericId<"branches">;
88
+ branchName: string;
89
+ branchCode: string;
90
+ branchActive: boolean;
91
+ terminalId: string | undefined;
92
+ deviceId: string;
93
+ sessionId: string;
94
+ reason?: undefined;
95
+ }>>;
55
96
  /**
56
97
  * Logout from station
57
98
  */
@@ -61,17 +102,450 @@ export declare const logoutStation: import("convex/server").RegisteredMutation<"
61
102
  success: boolean;
62
103
  }>>;
63
104
  /**
64
- * Get active station session for device
105
+ * Get active station session info
65
106
  */
66
107
  export declare const getActiveStationSession: import("convex/server").RegisteredQuery<"public", {
67
- branchId: import("convex/values").GenericId<"branches">;
68
- deviceId: string;
108
+ stationToken: string;
69
109
  }, Promise<{
70
- _id: import("convex/values").GenericId<"stationSessions">;
110
+ sessionId: import("convex/values").GenericId<"stationSessions">;
71
111
  branchId: import("convex/values").GenericId<"branches">;
72
- branchName: string | undefined;
112
+ branchName: string;
73
113
  deviceId: string;
74
114
  loggedInAt: number;
75
115
  expiresAt: number;
76
116
  } | null>>;
117
+ /**
118
+ * Get station orders with pagination and filtering
119
+ */
120
+ export declare const getStationOrders: import("convex/server").RegisteredQuery<"public", {
121
+ status?: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled" | undefined;
122
+ paginationOpts: {
123
+ id?: number;
124
+ endCursor?: string | null;
125
+ maximumRowsRead?: number;
126
+ maximumBytesRead?: number;
127
+ numItems: number;
128
+ cursor: string | null;
129
+ };
130
+ stationToken: string;
131
+ }, Promise<{
132
+ page: {
133
+ customer: {
134
+ _id: import("convex/values").GenericId<"users">;
135
+ name: string;
136
+ phoneNumber: string;
137
+ email: string | undefined;
138
+ } | null;
139
+ statusHistory: ({
140
+ changedBy: {
141
+ type: "attendant";
142
+ name: any;
143
+ };
144
+ notes?: string | undefined;
145
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
146
+ status: string;
147
+ changedAt: number;
148
+ } | {
149
+ changedBy: {
150
+ type: "admin";
151
+ name: any;
152
+ };
153
+ notes?: string | undefined;
154
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
155
+ status: string;
156
+ changedAt: number;
157
+ } | {
158
+ changedBy: undefined;
159
+ notes?: string | undefined;
160
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
161
+ status: string;
162
+ changedAt: number;
163
+ })[];
164
+ _id: import("convex/values").GenericId<"orders">;
165
+ _creationTime: number;
166
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
167
+ customerEmail?: string | undefined;
168
+ estimatedWeight?: number | undefined;
169
+ actualWeight?: number | undefined;
170
+ itemCount?: number | undefined;
171
+ estimatedLoads?: number | undefined;
172
+ whitesSeparate?: boolean | undefined;
173
+ bagCardNumber?: string | undefined;
174
+ notes?: string | undefined;
175
+ deliveryAddress?: string | undefined;
176
+ deliveryPhoneNumber?: string | undefined;
177
+ deliveryHall?: string | undefined;
178
+ deliveryRoom?: string | undefined;
179
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
180
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
181
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
182
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
183
+ createdAt: number;
184
+ isDeleted: boolean;
185
+ branchId: import("convex/values").GenericId<"branches">;
186
+ deliveryFee: number;
187
+ customerId: import("convex/values").GenericId<"users">;
188
+ customerPhoneNumber: string;
189
+ orderNumber: string;
190
+ orderType: "walk_in" | "online";
191
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
192
+ isDelivery: boolean;
193
+ basePrice: number;
194
+ totalPrice: number;
195
+ finalPrice: number;
196
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
197
+ updatedAt: number;
198
+ }[];
199
+ isDone: boolean;
200
+ continueCursor: string;
201
+ }>>;
202
+ /**
203
+ * Get order details for station
204
+ */
205
+ export declare const getStationOrderDetails: import("convex/server").RegisteredQuery<"public", {
206
+ orderId: import("convex/values").GenericId<"orders">;
207
+ stationToken: string;
208
+ }, Promise<{
209
+ customer: {
210
+ _id: import("convex/values").GenericId<"users">;
211
+ name: string;
212
+ phoneNumber: string;
213
+ email: string | undefined;
214
+ } | null;
215
+ branch: {
216
+ _id: import("convex/values").GenericId<"branches">;
217
+ name: string;
218
+ code: string;
219
+ address: string;
220
+ };
221
+ statusHistory: ({
222
+ changedBy: {
223
+ type: "attendant";
224
+ name: any;
225
+ };
226
+ notes?: string | undefined;
227
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
228
+ status: string;
229
+ changedAt: number;
230
+ } | {
231
+ changedBy: {
232
+ type: "admin";
233
+ name: any;
234
+ };
235
+ notes?: string | undefined;
236
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
237
+ status: string;
238
+ changedAt: number;
239
+ } | {
240
+ changedBy: undefined;
241
+ notes?: string | undefined;
242
+ changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
243
+ status: string;
244
+ changedAt: number;
245
+ })[];
246
+ _id: import("convex/values").GenericId<"orders">;
247
+ _creationTime: number;
248
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
249
+ customerEmail?: string | undefined;
250
+ estimatedWeight?: number | undefined;
251
+ actualWeight?: number | undefined;
252
+ itemCount?: number | undefined;
253
+ estimatedLoads?: number | undefined;
254
+ whitesSeparate?: boolean | undefined;
255
+ bagCardNumber?: string | undefined;
256
+ notes?: string | undefined;
257
+ deliveryAddress?: string | undefined;
258
+ deliveryPhoneNumber?: string | undefined;
259
+ deliveryHall?: string | undefined;
260
+ deliveryRoom?: string | undefined;
261
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
262
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
263
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
264
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
265
+ createdAt: number;
266
+ isDeleted: boolean;
267
+ branchId: import("convex/values").GenericId<"branches">;
268
+ deliveryFee: number;
269
+ customerId: import("convex/values").GenericId<"users">;
270
+ customerPhoneNumber: string;
271
+ orderNumber: string;
272
+ orderType: "walk_in" | "online";
273
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
274
+ isDelivery: boolean;
275
+ basePrice: number;
276
+ totalPrice: number;
277
+ finalPrice: number;
278
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
279
+ updatedAt: number;
280
+ } | null>>;
281
+ /**
282
+ * Update order status (for station)
283
+ * Allows station to update order status
284
+ */
285
+ export declare const updateStationOrderStatus: import("convex/server").RegisteredMutation<"public", {
286
+ notes?: string | undefined;
287
+ attendantId?: import("convex/values").GenericId<"attendants"> | undefined;
288
+ attendanceId?: import("convex/values").GenericId<"attendanceLogs"> | undefined;
289
+ orderId: import("convex/values").GenericId<"orders">;
290
+ newStatus: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
291
+ stationToken: string;
292
+ }, Promise<{
293
+ success: boolean;
294
+ orderId: import("convex/values").GenericId<"orders">;
295
+ }>>;
296
+ /**
297
+ * Get station analytics/dashboard stats
298
+ */
299
+ export declare const getStationStats: import("convex/server").RegisteredQuery<"public", {
300
+ startDate?: number | undefined;
301
+ endDate?: number | undefined;
302
+ stationToken: string;
303
+ }, Promise<{
304
+ totalOrders: number;
305
+ totalRevenue: number;
306
+ pendingOrders: number;
307
+ ordersByStatus: {
308
+ pending: number;
309
+ in_progress: number;
310
+ ready_for_pickup: number;
311
+ delivered: number;
312
+ completed: number;
313
+ cancelled: number;
314
+ };
315
+ averageOrderValue: number;
316
+ }>>;
317
+ /**
318
+ * Search customers for station
319
+ */
320
+ export declare const searchStationCustomers: import("convex/server").RegisteredQuery<"public", {
321
+ limit?: number | undefined;
322
+ query: string;
323
+ stationToken: string;
324
+ }, Promise<{
325
+ _id: import("convex/values").GenericId<"users">;
326
+ name: string;
327
+ phoneNumber: string;
328
+ email: string | undefined;
329
+ status: "active" | "blocked" | "suspended" | "restricted" | undefined;
330
+ orderCount: number;
331
+ completedOrderCount: number;
332
+ totalSpent: number;
333
+ }[]>>;
334
+ /**
335
+ * Get active attendance for station
336
+ * Returns active attendance logs for the station's branch
337
+ * Multiple attendants can be clocked in simultaneously
338
+ */
339
+ export declare const getActiveStationAttendances: import("convex/server").RegisteredQuery<"public", {
340
+ stationToken: string;
341
+ }, Promise<{
342
+ _id: import("convex/values").GenericId<"attendanceLogs">;
343
+ clockInAt: number;
344
+ deviceId: string | undefined;
345
+ attendant: {
346
+ _id: import("convex/values").GenericId<"attendants">;
347
+ name: string;
348
+ email: string;
349
+ } | null;
350
+ }[]>>;
351
+ /**
352
+ * Get attendants for branch (for clock-in selection)
353
+ * Returns list of attendants assigned to the branch
354
+ */
355
+ export declare const getBranchAttendants: import("convex/server").RegisteredQuery<"public", {
356
+ stationToken: string;
357
+ }, Promise<{
358
+ _id: import("convex/values").GenericId<"attendants">;
359
+ name: string;
360
+ email: string;
361
+ hasBiometric: boolean;
362
+ hasPin: boolean;
363
+ authenticationMethods: ("biometric_face" | "biometric_hand" | "pin" | "password")[];
364
+ }[]>>;
365
+ /**
366
+ * Start biometric verification for clock-in
367
+ * Creates a challenge for the attendant to verify their identity
368
+ */
369
+ export declare const startClockInVerification: import("convex/server").RegisteredMutation<"public", {
370
+ attendantId: import("convex/values").GenericId<"attendants">;
371
+ stationToken: string;
372
+ }, Promise<{
373
+ challenge: string;
374
+ attendantId: import("convex/values").GenericId<"attendants">;
375
+ verificationType: "login";
376
+ requiresLiveness: boolean;
377
+ }>>;
378
+ /**
379
+ * Complete clock-in with biometric verification
380
+ * Verifies biometric and creates attendance record
381
+ */
382
+ export declare const completeClockIn: import("convex/server").RegisteredMutation<"public", {
383
+ attendantId: import("convex/values").GenericId<"attendants">;
384
+ challenge: string;
385
+ biometricData: {
386
+ deviceInfo?: string | undefined;
387
+ captureType: "face" | "hand";
388
+ captureQuality: number;
389
+ angles: string[];
390
+ features: string;
391
+ measurements: string;
392
+ livenessData: string;
393
+ };
394
+ stationToken: string;
395
+ }, Promise<{
396
+ attendanceId: import("convex/values").GenericId<"attendanceLogs">;
397
+ clockInAt: number;
398
+ attendant: {
399
+ _id: import("convex/values").GenericId<"attendants">;
400
+ name: string;
401
+ email: string;
402
+ };
403
+ }>>;
404
+ /**
405
+ * Start clock-out verification
406
+ */
407
+ export declare const startClockOutVerification: import("convex/server").RegisteredMutation<"public", {
408
+ attendanceId: import("convex/values").GenericId<"attendanceLogs">;
409
+ stationToken: string;
410
+ }, Promise<{
411
+ challenge: string;
412
+ attendantId: import("convex/values").GenericId<"attendants">;
413
+ verificationType: "action";
414
+ requiresLiveness: boolean;
415
+ }>>;
416
+ /**
417
+ * Complete clock-out with biometric verification
418
+ */
419
+ export declare const completeClockOut: import("convex/server").RegisteredMutation<"public", {
420
+ notes?: string | undefined;
421
+ attendanceId: import("convex/values").GenericId<"attendanceLogs">;
422
+ challenge: string;
423
+ biometricData: {
424
+ deviceInfo?: string | undefined;
425
+ captureType: "face" | "hand";
426
+ captureQuality: number;
427
+ angles: string[];
428
+ features: string;
429
+ measurements: string;
430
+ livenessData: string;
431
+ };
432
+ stationToken: string;
433
+ }, Promise<{
434
+ attendanceId: import("convex/values").GenericId<"attendanceLogs">;
435
+ durationMinutes: number;
436
+ clockOutAt: number;
437
+ sessionsRevoked: number;
438
+ }>>;
439
+ /**
440
+ * Get attendance history for the station's branch
441
+ * Returns attendance logs with optional date filtering
442
+ */
443
+ export declare const getStationAttendanceHistory: import("convex/server").RegisteredQuery<"public", {
444
+ startDate?: number | undefined;
445
+ endDate?: number | undefined;
446
+ limit?: number | undefined;
447
+ stationToken: string;
448
+ }, Promise<{
449
+ _id: import("convex/values").GenericId<"attendanceLogs">;
450
+ clockInAt: number;
451
+ clockOutAt: number | undefined;
452
+ deviceId: string | undefined;
453
+ isActive: boolean;
454
+ durationMinutes: number | null;
455
+ attendant: {
456
+ _id: import("convex/values").GenericId<"attendants">;
457
+ name: string;
458
+ email: string;
459
+ } | null;
460
+ }[]>>;
461
+ /**
462
+ * Get activity logs (audit logs) for the station's branch
463
+ * Returns audit logs for actions taken at this station
464
+ */
465
+ export declare const getStationActivityLogs: import("convex/server").RegisteredQuery<"public", {
466
+ limit?: number | undefined;
467
+ stationToken: string;
468
+ }, Promise<{
469
+ _id: import("convex/values").GenericId<"auditLogs">;
470
+ action: string;
471
+ entityType: string;
472
+ entityId: string | undefined;
473
+ actor: {
474
+ type: "admin" | "customer" | "attendant";
475
+ name: string;
476
+ email: undefined;
477
+ } | {
478
+ type: "attendant";
479
+ name: string;
480
+ email: string;
481
+ } | {
482
+ type: "admin";
483
+ name: string;
484
+ email: string;
485
+ } | {
486
+ type: "customer";
487
+ name: string;
488
+ email: string | undefined;
489
+ } | null;
490
+ actorRole: string;
491
+ attendanceId: import("convex/values").GenericId<"attendanceLogs"> | undefined;
492
+ deviceId: string | undefined;
493
+ details: string | undefined;
494
+ oldValue: string | undefined;
495
+ newValue: string | undefined;
496
+ timestamp: number;
497
+ }[]>>;
498
+ /**
499
+ * Get notifications for station (using stationToken)
500
+ */
501
+ export declare const getStationNotifications: import("convex/server").RegisteredQuery<"public", {
502
+ type?: "info" | "success" | "warning" | "error" | "order" | "payment" | "system" | undefined;
503
+ isRead?: boolean | undefined;
504
+ limit?: number | undefined;
505
+ stationToken: string;
506
+ }, Promise<{
507
+ _id: Id<"notifications">;
508
+ _creationTime: number;
509
+ recipientId: string;
510
+ recipientType: string;
511
+ title: string;
512
+ message: string;
513
+ type: string;
514
+ priority: string;
515
+ isRead: boolean;
516
+ createdAt: number;
517
+ isDeleted: boolean;
518
+ readAt?: number;
519
+ actionUrl?: string;
520
+ actionLabel?: string;
521
+ entityType?: string;
522
+ entityId?: string;
523
+ senderId?: string;
524
+ senderType?: string;
525
+ branchId?: Id<"branches">;
526
+ }[]>>;
527
+ /**
528
+ * Get unread notification count for station
529
+ */
530
+ export declare const getStationUnreadCount: import("convex/server").RegisteredQuery<"public", {
531
+ stationToken: string;
532
+ }, Promise<number>>;
533
+ /**
534
+ * Mark station notification as read
535
+ */
536
+ export declare const markStationNotificationAsRead: import("convex/server").RegisteredMutation<"public", {
537
+ notificationId: import("convex/values").GenericId<"notifications">;
538
+ stationToken: string;
539
+ }, Promise<{
540
+ success: boolean;
541
+ }>>;
542
+ /**
543
+ * Mark all station notifications as read
544
+ */
545
+ export declare const markAllStationNotificationsAsRead: import("convex/server").RegisteredMutation<"public", {
546
+ stationToken: string;
547
+ }, Promise<{
548
+ success: boolean;
549
+ count: number;
550
+ }>>;
77
551
  //# sourceMappingURL=stations.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlider001/washlab-backend",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Washlab backend - Convex API package for Lider Technology Ltd",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -52,6 +52,7 @@
52
52
  "type": "module",
53
53
  "dependencies": {
54
54
  "@clerk/clerk-sdk-node": "^4.13.23",
55
+ "@devlider001/washlab-backend": "^1.1.1",
55
56
  "convex": "^1.31.2"
56
57
  },
57
58
  "devDependencies": {