@devlider001/washlab-backend 1.1.1 → 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
@@ -10,6 +10,55 @@ import { Id } from "./_generated/dataModel";
10
10
  * Returns null if user is authenticated but not an admin (for redirect to unauthorized page)
11
11
  * Returns null if user is not authenticated (frontend handles redirect to sign-in)
12
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
+ }[]>>;
13
62
  export declare const getCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
14
63
  _id: import("convex/values").GenericId<"admins">;
15
64
  _creationTime: 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">>>;
@@ -107,6 +107,60 @@ export declare const getBranch: import("convex/server").RegisteredQuery<"public"
107
107
  pricingPerKg: number;
108
108
  deliveryFee: number;
109
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>>;
110
164
  /**
111
165
  * Get all attendants - Paginated
112
166
  * Supports usePaginatedQuery for infinite scroll
@@ -543,4 +597,30 @@ export declare const getByOrderNumber: import("convex/server").RegisteredQuery<"
543
597
  changedAt: number;
544
598
  }[];
545
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
+ }>>;
546
626
  //# sourceMappingURL=orders.d.ts.map
@@ -530,14 +530,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
530
530
  createdAt: number;
531
531
  isDeleted: boolean;
532
532
  recipientId: string;
533
- recipientType: "admin" | "customer" | "attendant" | "all";
533
+ recipientType: "admin" | "customer" | "attendant" | "station" | "all";
534
534
  title: string;
535
535
  message: string;
536
536
  priority: "low" | "normal" | "high" | "urgent";
537
537
  isRead: boolean;
538
538
  }, {
539
539
  recipientId: import("convex/values").VString<string, "required">;
540
- 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>;
541
541
  title: import("convex/values").VString<string, "required">;
542
542
  message: import("convex/values").VString<string, "required">;
543
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>;
@@ -569,11 +569,11 @@ declare const _default: import("convex/server").SchemaDefinition<{
569
569
  readAt: number;
570
570
  notificationId: import("convex/values").GenericId<"notifications">;
571
571
  userId: string;
572
- userType: "admin" | "customer" | "attendant";
572
+ userType: "admin" | "customer" | "attendant" | "station";
573
573
  }, {
574
574
  notificationId: import("convex/values").VId<import("convex/values").GenericId<"notifications">, "required">;
575
575
  userId: import("convex/values").VString<string, "required">;
576
- 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>;
577
577
  readAt: import("convex/values").VFloat64<number, "required">;
578
578
  }, "required", "readAt" | "notificationId" | "userId" | "userType">, {
579
579
  by_notification: ["notificationId", "_creationTime"];
@@ -4,6 +4,7 @@
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";
7
8
  /**
8
9
  * Get all active branches with codes (public - no auth required)
9
10
  * Used for displaying available branch codes on login page
@@ -45,6 +46,16 @@ export declare const loginStation: import("convex/server").RegisteredMutation<"p
45
46
  branchId: import("convex/values").GenericId<"branches">;
46
47
  branchName: string;
47
48
  expiresAt: number;
49
+ loggedInBy: any;
50
+ loggedInAt: number;
51
+ } | {
52
+ stationToken: string;
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;
48
59
  }>>;
49
60
  /**
50
61
  * Verify station session
@@ -125,6 +136,31 @@ export declare const getStationOrders: import("convex/server").RegisteredQuery<"
125
136
  phoneNumber: string;
126
137
  email: string | undefined;
127
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
+ })[];
128
164
  _id: import("convex/values").GenericId<"orders">;
129
165
  _creationTime: number;
130
166
  createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
@@ -159,13 +195,6 @@ export declare const getStationOrders: import("convex/server").RegisteredQuery<"
159
195
  finalPrice: number;
160
196
  paymentStatus: "pending" | "paid" | "failed" | "refunded";
161
197
  updatedAt: number;
162
- statusHistory: {
163
- notes?: string | undefined;
164
- changedBy?: import("convex/values").GenericId<"attendants"> | undefined;
165
- changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
166
- status: string;
167
- changedAt: number;
168
- }[];
169
198
  }[];
170
199
  isDone: boolean;
171
200
  continueCursor: string;
@@ -189,6 +218,31 @@ export declare const getStationOrderDetails: import("convex/server").RegisteredQ
189
218
  code: string;
190
219
  address: string;
191
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
+ })[];
192
246
  _id: import("convex/values").GenericId<"orders">;
193
247
  _creationTime: number;
194
248
  createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
@@ -223,13 +277,6 @@ export declare const getStationOrderDetails: import("convex/server").RegisteredQ
223
277
  finalPrice: number;
224
278
  paymentStatus: "pending" | "paid" | "failed" | "refunded";
225
279
  updatedAt: number;
226
- statusHistory: {
227
- notes?: string | undefined;
228
- changedBy?: import("convex/values").GenericId<"attendants"> | undefined;
229
- changedByAdmin?: import("convex/values").GenericId<"admins"> | undefined;
230
- status: string;
231
- changedAt: number;
232
- }[];
233
280
  } | null>>;
234
281
  /**
235
282
  * Update order status (for station)
@@ -237,6 +284,8 @@ export declare const getStationOrderDetails: import("convex/server").RegisteredQ
237
284
  */
238
285
  export declare const updateStationOrderStatus: import("convex/server").RegisteredMutation<"public", {
239
286
  notes?: string | undefined;
287
+ attendantId?: import("convex/values").GenericId<"attendants"> | undefined;
288
+ attendanceId?: import("convex/values").GenericId<"attendanceLogs"> | undefined;
240
289
  orderId: import("convex/values").GenericId<"orders">;
241
290
  newStatus: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
242
291
  stationToken: string;
@@ -422,6 +471,10 @@ export declare const getStationActivityLogs: import("convex/server").RegisteredQ
422
471
  entityType: string;
423
472
  entityId: string | undefined;
424
473
  actor: {
474
+ type: "admin" | "customer" | "attendant";
475
+ name: string;
476
+ email: undefined;
477
+ } | {
425
478
  type: "attendant";
426
479
  name: string;
427
480
  email: string;
@@ -442,4 +495,57 @@ export declare const getStationActivityLogs: import("convex/server").RegisteredQ
442
495
  newValue: string | undefined;
443
496
  timestamp: number;
444
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
+ }>>;
445
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.1",
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": {