@7365admin1/layer-common 4.2.9 → 4.2.10
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 +14 -4
- package/composables/useFacility.ts +40 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.2.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 66a947b: Add the front-end half of facility restore: `useFacility` now forwards the
|
|
8
|
+
allow-listed `status` filter to `POST /api/facilities/search/v1` (omitted
|
|
9
|
+
entirely when a caller does not ask for it, so no existing list changes) and
|
|
10
|
+
exposes `restoreFacility`, which calls the `PATCH /api/facilities/restore/v1`
|
|
11
|
+
route already live in API-core.
|
|
12
|
+
|
|
3
13
|
## 4.2.9
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -544,11 +554,11 @@
|
|
|
544
554
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
545
555
|
own rule from two endpoints the console already calls, unprojected:
|
|
546
556
|
|
|
547
|
-
|
|
548
|
-
|
|
557
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
558
|
+
GET /api/roles/id/:role that membership's role document
|
|
549
559
|
|
|
550
|
-
|
|
551
|
-
|
|
560
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
561
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
552
562
|
|
|
553
563
|
`role.default` is the marker because it is the only property of a platform
|
|
554
564
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -317,6 +317,15 @@ export default function usetFacility() {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
/**
|
|
321
|
+
* `status` is the "Show deleted" switch.
|
|
322
|
+
*
|
|
323
|
+
* Omitted, the server keeps its existing default of active-only, which is
|
|
324
|
+
* what every caller sends today (none send it at all), so no list changes
|
|
325
|
+
* unless a caller asks for the other one. The server allow-lists it to
|
|
326
|
+
* exactly `active` / `deleted`, so this is a passthrough of two words and
|
|
327
|
+
* not of free text.
|
|
328
|
+
*/
|
|
320
329
|
async function getFacilitiesByPageSearch({
|
|
321
330
|
page = 1,
|
|
322
331
|
search = "",
|
|
@@ -324,6 +333,7 @@ export default function usetFacility() {
|
|
|
324
333
|
sites = [],
|
|
325
334
|
_id = "",
|
|
326
335
|
userType,
|
|
336
|
+
status,
|
|
327
337
|
}: {
|
|
328
338
|
_id?: string;
|
|
329
339
|
page?: number;
|
|
@@ -331,6 +341,7 @@ export default function usetFacility() {
|
|
|
331
341
|
sites?: string[];
|
|
332
342
|
limit?: number;
|
|
333
343
|
userType?: string;
|
|
344
|
+
status?: "active" | "deleted";
|
|
334
345
|
}) {
|
|
335
346
|
return useNuxtApp().$api("/api/facilities/search/v1", {
|
|
336
347
|
method: "POST",
|
|
@@ -341,6 +352,7 @@ export default function usetFacility() {
|
|
|
341
352
|
sites,
|
|
342
353
|
_id,
|
|
343
354
|
userType,
|
|
355
|
+
...(status ? { status } : {}),
|
|
344
356
|
},
|
|
345
357
|
});
|
|
346
358
|
}
|
|
@@ -443,6 +455,33 @@ export default function usetFacility() {
|
|
|
443
455
|
});
|
|
444
456
|
}
|
|
445
457
|
|
|
458
|
+
/**
|
|
459
|
+
* The way back from `deleteFacility`.
|
|
460
|
+
*
|
|
461
|
+
* Same verb, same two query parameters, same shape — the server gates the
|
|
462
|
+
* restore exactly as it gates the delete (`requireAuth` +
|
|
463
|
+
* `requireSiteAccess(req.query.site)`), so anyone who could delete a facility
|
|
464
|
+
* can undo it and nobody else. `restoreFacilityById` matches on
|
|
465
|
+
* `{_id, site, status: "deleted"}`, so restoring something already active is
|
|
466
|
+
* a no-op rather than a write.
|
|
467
|
+
*/
|
|
468
|
+
async function restoreFacility({
|
|
469
|
+
_id,
|
|
470
|
+
site,
|
|
471
|
+
updatedBy,
|
|
472
|
+
}: {
|
|
473
|
+
_id?: string;
|
|
474
|
+
site?: string;
|
|
475
|
+
updatedBy?: string;
|
|
476
|
+
}) {
|
|
477
|
+
return useNuxtApp().$api(`/api/facilities/restore/v1?_id=${_id}&site=${site}`, {
|
|
478
|
+
method: "PATCH",
|
|
479
|
+
query: {
|
|
480
|
+
updatedBy,
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
446
485
|
function setFacility(data?: TFacility) {
|
|
447
486
|
facility.value = new MFacility(data);
|
|
448
487
|
}
|
|
@@ -679,6 +718,7 @@ export default function usetFacility() {
|
|
|
679
718
|
affectedBookingsTab,
|
|
680
719
|
cancelFacilityBooking,
|
|
681
720
|
deleteFacility,
|
|
721
|
+
restoreFacility,
|
|
682
722
|
bookingFeeTaxPercentage,
|
|
683
723
|
bookingCurrencySymbol,
|
|
684
724
|
bookingCurrencyType,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.2.
|
|
5
|
+
"version": "4.2.10",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|