@7365admin1/layer-common 1.11.53 → 2.0.0

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.
@@ -51,10 +51,11 @@ export default function useMember() {
51
51
  org = "",
52
52
  type = "",
53
53
  status = "active",
54
+ siteId = "",
54
55
  } = {}) {
55
56
  return useNuxtApp().$api<Record<string, any>>("/api/members", {
56
57
  method: "GET",
57
- query: { page, limit, search, user, org, type, status },
58
+ query: { page, limit, search, user, org, type, status, siteId },
58
59
  });
59
60
  }
60
61
  function createUserByVerification(
@@ -109,35 +110,24 @@ export default function useMember() {
109
110
  siteId?: string;
110
111
  siteName?: string;
111
112
  }) {
112
- return useNuxtApp().$api<TMember>('/api/members/direct', {
113
- method: 'POST',
113
+ return useNuxtApp().$api<TMember>("/api/members/direct", {
114
+ method: "POST",
114
115
  body: payload,
115
- })
116
+ });
116
117
  }
117
-
118
- function updateMemberSite(
119
- id: string,
120
- siteId: string,
121
- siteName: string,
122
- ) {
123
- return useNuxtApp().$api(
124
- `/api/members/site`,
125
- {
126
- method: "PUT",
127
- body: {
128
- id,
129
- siteId,
130
- siteName,
131
- },
132
- }
133
- )
118
+
119
+ function updateMemberSite(id: string, siteId: string, siteName: string) {
120
+ return useNuxtApp().$api(`/api/members/site`, {
121
+ method: "PUT",
122
+ body: {
123
+ id,
124
+ siteId,
125
+ siteName,
126
+ },
127
+ });
134
128
  }
135
129
 
136
- function getByUserTypeOrg(
137
- user: string,
138
- type: string,
139
- org: string
140
- ) {
130
+ function getByUserTypeOrg(user: string, type: string, org: string) {
141
131
  return useNuxtApp().$api<TMember>(
142
132
  `/api/members/user/${user}/app/${type}/org`,
143
133
  {
@@ -165,6 +155,6 @@ export default function useMember() {
165
155
  createMemberDirect,
166
156
  updateMemberSite,
167
157
  getAllByUserId,
168
- getByUserTypeOrg
158
+ getByUserTypeOrg,
169
159
  };
170
160
  }
@@ -3,9 +3,9 @@ export default function(){
3
3
  const formatLocation = ({block, level, unit}: {block: number, level: string, unit: string | TBuildingUnit}) => {
4
4
  const parts = [];
5
5
 
6
- if (block) parts.push(`Block ${block}`);
7
- if (level) parts.push(level);
8
- if (unit) parts.push(unit);
6
+ if (block?.name) parts.push(`${block.name}`);
7
+ if (level?.name) parts.push(`${level.name}`);
8
+ if (unit?.name) parts.push(unit?.name);
9
9
 
10
10
  return parts.join(" / ");
11
11
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.53",
5
+ "version": "2.0.0",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -3,7 +3,7 @@ declare type TBuilding = {
3
3
  site: string;
4
4
  name: string;
5
5
  block: number | null;
6
- levels: string[];
6
+ levels: { _id: string; name: string }[];
7
7
  buildingFiles: { id: string, name: string }[] | string[];
8
8
  };
9
9
 
@@ -16,7 +16,7 @@ declare type TBuildingUnit = {
16
16
  building: string;
17
17
  buildingName?: string;
18
18
  block: number | null;
19
- level: string | null;
19
+ level: { _id: string; name: string } | null;
20
20
  category: string;
21
21
  status: string;
22
22
  buildingUnitFiles: string[];
@@ -25,3 +25,15 @@ declare type TBuildingUnit = {
25
25
  leaseStart: string;
26
26
  leaseEnd: string;
27
27
  };
28
+
29
+
30
+ declare type TBuildingPayload = Pick<TBuilding, "site" | "name" | "block" | "buildingFiles"> & {
31
+ levels: string[];
32
+ };
33
+
34
+
35
+ declare type TBuildingUpdatePayload = Pick<TBuilding, "name" | "buildingFiles"> & {
36
+ levels: string[];
37
+ };
38
+
39
+ declare type TBuildingUnitPayload = Pick<TBuildingUnit, "site" | "name" | "building" | "buildingName" | "block" | "category" | "status" | "buildingUnitFiles" | "companyName" | "companyRegistrationNumber" | "leaseStart" | "leaseEnd"> & { level?: string}
@@ -6,8 +6,14 @@ declare type TVehicle = {
6
6
  direction: "entry" | "exit" | "both" | "none";
7
7
  name: string;
8
8
  phoneNumber?: string;
9
- block: number | "";
10
- level: string;
9
+ block: {
10
+ _id: string;
11
+ name: string;
12
+ }
13
+ level: {
14
+ _id: string;
15
+ name: string;
16
+ }
11
17
  unit: string;
12
18
  unitName?: string; // For display purposes, the API will return the unit name if available
13
19
  nric?: string | null;
@@ -33,8 +39,6 @@ declare type TVehiclePayload = Pick<
33
39
  | "direction"
34
40
  | "name"
35
41
  | "phoneNumber"
36
- | "block"
37
- | "level"
38
42
  | "unit"
39
43
  | "nric"
40
44
  | "remarks"
@@ -44,4 +48,4 @@ declare type TVehiclePayload = Pick<
44
48
  | "site"
45
49
  | "org"
46
50
  | "peopleId"
47
- > & { plateNumber?: string | string[] };
51
+ > & { plateNumber?: string | string[], block?: string, level?: string };