@devlider001/washlab-backend 1.0.5 → 1.0.7

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.
@@ -12,6 +12,7 @@ import type * as admin from "../admin.js";
12
12
  import type * as analytics from "../analytics.js";
13
13
  import type * as attendants from "../attendants.js";
14
14
  import type * as audit from "../audit.js";
15
+ import type * as branches from "../branches.js";
15
16
  import type * as clerk from "../clerk.js";
16
17
  import type * as customers from "../customers.js";
17
18
  import type * as http from "../http.js";
@@ -36,6 +37,7 @@ declare const fullApi: ApiFromModules<{
36
37
  analytics: typeof analytics;
37
38
  attendants: typeof attendants;
38
39
  audit: typeof audit;
40
+ branches: typeof branches;
39
41
  clerk: typeof clerk;
40
42
  customers: typeof customers;
41
43
  http: typeof http;
package/convex/admin.d.ts CHANGED
@@ -226,6 +226,7 @@ export declare const getCustomers: import("convex/server").RegisteredQuery<"publ
226
226
  _creationTime: number;
227
227
  email?: string | undefined;
228
228
  clerkUserId?: string | undefined;
229
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
229
230
  statusNote?: string | undefined;
230
231
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
231
232
  statusChangedAt?: number | undefined;
@@ -235,7 +236,6 @@ export declare const getCustomers: import("convex/server").RegisteredQuery<"publ
235
236
  name: string;
236
237
  isRegistered: boolean;
237
238
  isVerified: boolean;
238
- status: "active" | "blocked" | "suspended" | "restricted";
239
239
  createdAt: number;
240
240
  isDeleted: boolean;
241
241
  }[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Branch Functions
3
+ *
4
+ * Handles branch information queries for customers and public access.
5
+ */
6
+ /**
7
+ * Get all active branches
8
+ * Public query - can be used by customers and guests
9
+ */
10
+ export declare const getActive: import("convex/server").RegisteredQuery<"public", {}, Promise<{
11
+ _id: import("convex/values").GenericId<"branches">;
12
+ name: string;
13
+ code: string;
14
+ address: string;
15
+ city: string;
16
+ country: string;
17
+ phoneNumber: string;
18
+ email: string | undefined;
19
+ pricingPerKg: number;
20
+ deliveryFee: number;
21
+ isActive: boolean;
22
+ createdAt: number;
23
+ }[]>>;
24
+ //# sourceMappingURL=branches.d.ts.map
@@ -16,6 +16,7 @@ export declare const getByPhone: import("convex/server").RegisteredQuery<"public
16
16
  _creationTime: number;
17
17
  email?: string | undefined;
18
18
  clerkUserId?: string | undefined;
19
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
19
20
  statusNote?: string | undefined;
20
21
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
21
22
  statusChangedAt?: number | undefined;
@@ -25,12 +26,12 @@ export declare const getByPhone: import("convex/server").RegisteredQuery<"public
25
26
  name: string;
26
27
  isRegistered: boolean;
27
28
  isVerified: boolean;
28
- status: "active" | "blocked" | "suspended" | "restricted";
29
29
  createdAt: number;
30
30
  isDeleted: boolean;
31
31
  } | null>>;
32
32
  /**
33
33
  * Get current customer profile (from authenticated Clerk session)
34
+ * Returns null if customer hasn't completed registration yet
34
35
  */
35
36
  export declare const getProfile: import("convex/server").RegisteredQuery<"public", {}, Promise<{
36
37
  orderCount: number;
@@ -39,6 +40,7 @@ export declare const getProfile: import("convex/server").RegisteredQuery<"public
39
40
  _creationTime: number;
40
41
  email?: string | undefined;
41
42
  clerkUserId?: string | undefined;
43
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
42
44
  statusNote?: string | undefined;
43
45
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
44
46
  statusChangedAt?: number | undefined;
@@ -48,18 +50,22 @@ export declare const getProfile: import("convex/server").RegisteredQuery<"public
48
50
  name: string;
49
51
  isRegistered: boolean;
50
52
  isVerified: boolean;
51
- status: "active" | "blocked" | "suspended" | "restricted";
52
53
  createdAt: number;
53
54
  isDeleted: boolean;
54
- }>>;
55
+ } | null>>;
55
56
  /**
56
57
  * Get customer order history - Paginated
57
58
  * Supports usePaginatedQuery for infinite scroll
59
+ * Returns empty results if customer not found
58
60
  */
59
61
  export declare const getOrders: import("convex/server").RegisteredQuery<"public", {
60
62
  cursor?: string | undefined;
61
63
  numItems?: number | undefined;
62
64
  }, Promise<{
65
+ page: never[];
66
+ isDone: boolean;
67
+ continueCursor: null;
68
+ } | {
63
69
  page: {
64
70
  _id: import("convex/values").GenericId<"orders">;
65
71
  _creationTime: number;
@@ -106,6 +112,7 @@ export declare const getOrders: import("convex/server").RegisteredQuery<"public"
106
112
  }>>;
107
113
  /**
108
114
  * Get customer loyalty points balance
115
+ * Returns zero points if customer not found
109
116
  */
110
117
  export declare const getLoyaltyPoints: import("convex/server").RegisteredQuery<"public", {}, Promise<{
111
118
  points: number;
@@ -178,6 +185,7 @@ export declare const search: import("convex/server").RegisteredQuery<"public", {
178
185
  _creationTime: number;
179
186
  email?: string | undefined;
180
187
  clerkUserId?: string | undefined;
188
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
181
189
  statusNote?: string | undefined;
182
190
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
183
191
  statusChangedAt?: number | undefined;
@@ -187,7 +195,6 @@ export declare const search: import("convex/server").RegisteredQuery<"public", {
187
195
  name: string;
188
196
  isRegistered: boolean;
189
197
  isVerified: boolean;
190
- status: "active" | "blocked" | "suspended" | "restricted";
191
198
  createdAt: number;
192
199
  isDeleted: boolean;
193
200
  }[]>>;
@@ -208,6 +215,7 @@ export declare const getDetails: import("convex/server").RegisteredQuery<"public
208
215
  _creationTime: number;
209
216
  email?: string | undefined;
210
217
  clerkUserId?: string | undefined;
218
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
211
219
  statusNote?: string | undefined;
212
220
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
213
221
  statusChangedAt?: number | undefined;
@@ -217,7 +225,6 @@ export declare const getDetails: import("convex/server").RegisteredQuery<"public
217
225
  name: string;
218
226
  isRegistered: boolean;
219
227
  isVerified: boolean;
220
- status: "active" | "blocked" | "suspended" | "restricted";
221
228
  createdAt: number;
222
229
  isDeleted: boolean;
223
230
  }>>;
@@ -5,6 +5,29 @@ import { Id } from "../_generated/dataModel";
5
5
  * @throws Error if user is not authenticated
6
6
  */
7
7
  export declare function getClerkIdentity(ctx: QueryCtx | MutationCtx): Promise<import("convex/server").UserIdentity>;
8
+ /**
9
+ * Find current customer user from Clerk identity
10
+ * Returns null if customer doesn't exist (for profile check scenarios)
11
+ * @throws Error if user is not authenticated
12
+ */
13
+ export declare function findCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise<{
14
+ _id: import("convex/values").GenericId<"users">;
15
+ _creationTime: number;
16
+ email?: string | undefined;
17
+ clerkUserId?: string | undefined;
18
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
19
+ statusNote?: string | undefined;
20
+ statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
21
+ statusChangedAt?: number | undefined;
22
+ lastLoginAt?: number | undefined;
23
+ preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
24
+ phoneNumber: string;
25
+ name: string;
26
+ isRegistered: boolean;
27
+ isVerified: boolean;
28
+ createdAt: number;
29
+ isDeleted: boolean;
30
+ } | null>;
8
31
  /**
9
32
  * Get current customer user from Clerk identity
10
33
  * @throws Error if user is not authenticated or not found
@@ -14,6 +37,7 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
14
37
  _creationTime: number;
15
38
  email?: string | undefined;
16
39
  clerkUserId?: string | undefined;
40
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
17
41
  statusNote?: string | undefined;
18
42
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
19
43
  statusChangedAt?: number | undefined;
@@ -23,7 +47,6 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
23
47
  name: string;
24
48
  isRegistered: boolean;
25
49
  isVerified: boolean;
26
- status: "active" | "blocked" | "suspended" | "restricted";
27
50
  createdAt: number;
28
51
  isDeleted: boolean;
29
52
  }>;
@@ -1,58 +1,39 @@
1
+ import { Id } from "./_generated/dataModel";
1
2
  /**
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
3
+ * Get notifications for current user
4
+ * Returns empty array if user not found
10
5
  */
11
6
  export declare const getMyNotifications: import("convex/server").RegisteredQuery<"public", {
12
7
  type?: "info" | "success" | "warning" | "error" | "order" | "payment" | "system" | undefined;
13
8
  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
- };
9
+ limit?: number | undefined;
22
10
  }, 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
- }>>;
11
+ _id: Id<"notifications">;
12
+ _creationTime: number;
13
+ recipientId: string;
14
+ recipientType: string;
15
+ title: string;
16
+ message: string;
17
+ type: string;
18
+ priority: string;
19
+ isRead: boolean;
20
+ createdAt: number;
21
+ isDeleted: boolean;
22
+ readAt?: number;
23
+ actionUrl?: string;
24
+ actionLabel?: string;
25
+ entityType?: string;
26
+ entityId?: string;
27
+ senderId?: string;
28
+ senderType?: string;
29
+ branchId?: Id<"branches">;
30
+ expiresAt?: number;
31
+ scheduledFor?: number;
32
+ sentAt?: number;
33
+ }[]>>;
54
34
  /**
55
35
  * Get unread notification count for current user
36
+ * Returns 0 if user not found
56
37
  */
57
38
  export declare const getUnreadCount: import("convex/server").RegisteredQuery<"public", {}, Promise<number>>;
58
39
  /**
@@ -8,6 +8,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
8
8
  users: import("convex/server").TableDefinition<import("convex/values").VObject<{
9
9
  email?: string | undefined;
10
10
  clerkUserId?: string | undefined;
11
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
11
12
  statusNote?: string | undefined;
12
13
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
13
14
  statusChangedAt?: number | undefined;
@@ -17,7 +18,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
17
18
  name: string;
18
19
  isRegistered: boolean;
19
20
  isVerified: boolean;
20
- status: "active" | "blocked" | "suspended" | "restricted";
21
21
  createdAt: number;
22
22
  isDeleted: boolean;
23
23
  }, {
@@ -27,7 +27,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
27
27
  clerkUserId: import("convex/values").VString<string | undefined, "optional">;
28
28
  isRegistered: import("convex/values").VBoolean<boolean, "required">;
29
29
  isVerified: import("convex/values").VBoolean<boolean, "required">;
30
- status: import("convex/values").VUnion<"active" | "blocked" | "suspended" | "restricted", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"blocked", "required">, import("convex/values").VLiteral<"suspended", "required">, import("convex/values").VLiteral<"restricted", "required">], "required", never>;
30
+ status: import("convex/values").VUnion<"active" | "blocked" | "suspended" | "restricted" | undefined, [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"blocked", "required">, import("convex/values").VLiteral<"suspended", "required">, import("convex/values").VLiteral<"restricted", "required">], "optional", never>;
31
31
  statusNote: import("convex/values").VString<string | undefined, "optional">;
32
32
  statusChangedBy: import("convex/values").VId<import("convex/values").GenericId<"admins"> | undefined, "optional">;
33
33
  statusChangedAt: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -496,6 +496,21 @@ declare const _default: import("convex/server").SchemaDefinition<{
496
496
  by_branch: ["branchId", "_creationTime"];
497
497
  by_entity: ["entityType", "entityId", "_creationTime"];
498
498
  }, {}, {}>;
499
+ notificationReadStatus: import("convex/server").TableDefinition<import("convex/values").VObject<{
500
+ readAt: number;
501
+ notificationId: import("convex/values").GenericId<"notifications">;
502
+ userId: string;
503
+ userType: "admin" | "customer" | "attendant";
504
+ }, {
505
+ notificationId: import("convex/values").VId<import("convex/values").GenericId<"notifications">, "required">;
506
+ userId: import("convex/values").VString<string, "required">;
507
+ 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>;
508
+ readAt: import("convex/values").VFloat64<number, "required">;
509
+ }, "required", "readAt" | "notificationId" | "userId" | "userType">, {
510
+ by_notification: ["notificationId", "_creationTime"];
511
+ by_user: ["userId", "userType", "_creationTime"];
512
+ by_notification_user: ["notificationId", "userId", "userType", "_creationTime"];
513
+ }, {}, {}>;
499
514
  }, true>;
500
515
  export default _default;
501
516
  //# sourceMappingURL=schema.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlider001/washlab-backend",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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",
@@ -35,8 +35,10 @@
35
35
  "homepage": "https://github.com/lider-technology-ltd/washlab-backend#readme",
36
36
  "scripts": {
37
37
  "build": "tsc --project tsconfig.build.json >nul 2>&1 || exit 0",
38
+ "clean:convex": "node -e \"const fs=require('fs'),p=require('path');function rm(d){for(const f of fs.readdirSync(d)){const fp=p.join(d,f);const st=fs.statSync(fp);if(st.isDirectory()){if(f==='_generated')continue;rm(fp);}else{if(/\\.(?:js|js\\.map|d\\.ts|d\\.ts\\.map)$/.test(f)){fs.unlinkSync(fp);}}}}rm('convex');\"",
39
+ "prepack": "npm run clean:convex && npm run build",
38
40
  "build:strict": "tsc --project tsconfig.build.json",
39
- "prepublishOnly": "npm run build",
41
+ "prepublishOnly": "npm run clean:convex && npm run build",
40
42
  "test": "echo \"Error: no test specified\" && exit 1"
41
43
  },
42
44
  "keywords": [
@@ -59,4 +61,4 @@
59
61
  "peerDependencies": {
60
62
  "convex": "^1.31.2"
61
63
  }
62
- }
64
+ }