@iservice365/layer-common 1.0.3 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 789ece4: Revamp service provider site management
8
+
3
9
  ## 1.0.3
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,36 @@
1
+ export default function useCustomerSite() {
2
+ function add(payload: TCustomerSite) {
3
+ return useNuxtApp().$api<Record<string, any>>(`/api/customer-sites`, {
4
+ method: "POST",
5
+ body: payload,
6
+ });
7
+ }
8
+
9
+ async function getAll({
10
+ page = 1,
11
+ search = "",
12
+ limit = 10,
13
+ org = "",
14
+ status = "active",
15
+ sort = "",
16
+ order = "asc",
17
+ }: {
18
+ page?: number;
19
+ search?: string;
20
+ limit?: number;
21
+ org?: string;
22
+ status?: string;
23
+ sort?: string;
24
+ order?: string;
25
+ } = {}) {
26
+ return useNuxtApp().$api<Record<string, any>>("/api/customer-sites", {
27
+ method: "GET",
28
+ query: { page, search, limit, sort, order, status, org },
29
+ });
30
+ }
31
+
32
+ return {
33
+ add,
34
+ getAll,
35
+ };
36
+ }
@@ -31,6 +31,10 @@ export default function useLocal() {
31
31
  const headerSearch = useState("headerSearch", () => "");
32
32
 
33
33
  const natureOfBusiness = [
34
+ {
35
+ title: "Real Estate Developer",
36
+ value: "real_estate_developer",
37
+ },
34
38
  {
35
39
  title: "Property Management Agency",
36
40
  value: "property_management_agency",
@@ -91,17 +91,27 @@ export default function useOrg() {
91
91
  }
92
92
  });
93
93
 
94
- function getAll({ page = 1, search = "", limit = 20 } = {}) {
94
+ function getAll({ page = 1, search = "", limit = 20, nature = "" } = {}) {
95
95
  return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
96
96
  method: "GET",
97
97
  query: {
98
98
  page,
99
99
  search,
100
100
  limit,
101
+ nature,
101
102
  },
102
103
  });
103
104
  }
104
105
 
106
+ function add(
107
+ value: Partial<Pick<TOrg, "name" | "email" | "nature" | "contact">>
108
+ ) {
109
+ return useNuxtApp().$api<TOrg>("/api/organizations", {
110
+ method: "POST",
111
+ body: value,
112
+ });
113
+ }
114
+
105
115
  return {
106
116
  org,
107
117
  getOrgs,
@@ -114,5 +124,6 @@ export default function useOrg() {
114
124
  currentOrg,
115
125
  getById,
116
126
  getAll,
127
+ add,
117
128
  };
118
129
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iservice365/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.0.3",
5
+ "version": "1.0.4",
6
6
  "main": "./nuxt.config.ts",
7
7
  "scripts": {
8
8
  "dev": "nuxi dev .playground",
@@ -13,3 +13,15 @@ declare type TCustomerCreate = Pick<
13
13
  TCustomer,
14
14
  "name" | "orgId" | "siteName" | "siteDescription"
15
15
  >;
16
+
17
+ declare type TCustomerSite = {
18
+ name: string;
19
+ site?: string;
20
+ siteOrg: string;
21
+ siteOrgName: string;
22
+ org: string;
23
+ status?: string;
24
+ createdAt?: string;
25
+ updatedAt?: string;
26
+ deletedAt?: string;
27
+ };
package/types/site.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare type TSite = {
2
2
  _id?: string;
3
3
  name: string;
4
- description: string;
4
+ description?: string;
5
5
  orgId: string;
6
6
  blocks?: number;
7
7
  customerOrgId: string;
@@ -11,6 +11,7 @@ declare type TSite = {
11
11
  deletedAt?: string;
12
12
  metadata?: {
13
13
  block?: number; // Number of blocks in the site
14
- }} ;
14
+ };
15
+ };
15
16
 
16
17
  declare type TSiteCreate = Pick<TSite, "name" | "description" | "orgId">;