@jsdev_ninja/core 0.8.52 → 0.8.53

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.
@@ -1,4 +1,9 @@
1
- export const collections = {
1
+ export const systemCollections = {
2
+ stores: "stores",
3
+ companies: "companies",
4
+ } as const;
5
+
6
+ export const storeCollections = {
2
7
  products: "products",
3
8
  profiles: "profiles",
4
9
  cart: "cart",
@@ -6,22 +11,29 @@ export const collections = {
6
11
  orders: "orders",
7
12
  categories: "categories",
8
13
  favorites: "favorites",
9
- stores: "stores",
10
- companies: "companies",
11
14
  payments: "payments",
12
15
  } as const;
13
16
 
14
17
  export const FirestoreApi = {
18
+ systemCollections,
19
+ storeCollections,
20
+ // for client
15
21
  getPath: ({
16
22
  companyId,
17
23
  storeId,
18
24
  collectionName,
25
+ id,
19
26
  }: {
20
27
  companyId: string;
21
28
  storeId: string;
22
- collectionName: keyof typeof collections;
29
+ collectionName: keyof typeof storeCollections;
30
+ id?: string;
23
31
  }) => {
24
- return `${companyId}/${storeId}/${collectionName}`;
32
+ return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
33
+ },
34
+ // for backend
35
+ getDocPath: (collectionName: keyof typeof storeCollections) => {
36
+ return `{companyId}/{storeId}/${collectionName}/{id}`;
25
37
  },
26
38
  };
27
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.8.52",
3
+ "version": "0.8.53",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",