@communecter/cocolight-api-client 1.0.155 → 1.0.156
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/dist/1035.cocolight-api-client.browser.js +1 -1
- package/dist/1035.cocolight-api-client.cjs +1 -1
- package/dist/1483.cocolight-api-client.browser.js +1 -1
- package/dist/1483.cocolight-api-client.cjs +1 -1
- package/dist/1491.cocolight-api-client.browser.js +1 -1
- package/dist/1491.cocolight-api-client.cjs +1 -1
- package/dist/1494.cocolight-api-client.browser.js +1 -1
- package/dist/1494.cocolight-api-client.cjs +1 -1
- package/dist/1641.cocolight-api-client.browser.js +1 -1
- package/dist/1641.cocolight-api-client.cjs +1 -1
- package/dist/1678.cocolight-api-client.browser.js +1 -1
- package/dist/1678.cocolight-api-client.cjs +1 -1
- package/dist/2041.cocolight-api-client.browser.js +1 -1
- package/dist/2041.cocolight-api-client.cjs +1 -1
- package/dist/2302.cocolight-api-client.browser.js +1 -1
- package/dist/2302.cocolight-api-client.cjs +1 -1
- package/dist/2313.cocolight-api-client.browser.js +1 -1
- package/dist/2313.cocolight-api-client.cjs +1 -1
- package/dist/2379.cocolight-api-client.browser.js +1 -1
- package/dist/2379.cocolight-api-client.cjs +1 -1
- package/dist/2439.cocolight-api-client.browser.js +1 -1
- package/dist/2439.cocolight-api-client.cjs +1 -1
- package/dist/2594.cocolight-api-client.browser.js +1 -1
- package/dist/2594.cocolight-api-client.cjs +1 -1
- package/dist/2766.cocolight-api-client.browser.js +1 -1
- package/dist/2766.cocolight-api-client.cjs +1 -1
- package/dist/2812.cocolight-api-client.browser.js +1 -1
- package/dist/2812.cocolight-api-client.cjs +1 -1
- package/dist/2918.cocolight-api-client.browser.js +1 -1
- package/dist/2918.cocolight-api-client.cjs +1 -1
- package/dist/3028.cocolight-api-client.browser.js +1 -1
- package/dist/3028.cocolight-api-client.cjs +1 -1
- package/dist/3330.cocolight-api-client.browser.js +1 -1
- package/dist/3330.cocolight-api-client.cjs +1 -1
- package/dist/3371.cocolight-api-client.browser.js +1 -1
- package/dist/3371.cocolight-api-client.cjs +1 -1
- package/dist/3401.cocolight-api-client.browser.js +1 -1
- package/dist/3401.cocolight-api-client.cjs +1 -1
- package/dist/3516.cocolight-api-client.browser.js +1 -1
- package/dist/3516.cocolight-api-client.cjs +1 -1
- package/dist/3593.cocolight-api-client.browser.js +1 -1
- package/dist/3593.cocolight-api-client.cjs +1 -1
- package/dist/3764.cocolight-api-client.browser.js +1 -1
- package/dist/3764.cocolight-api-client.cjs +1 -1
- package/dist/3873.cocolight-api-client.browser.js +1 -1
- package/dist/3873.cocolight-api-client.cjs +1 -1
- package/dist/3911.cocolight-api-client.browser.js +1 -1
- package/dist/3911.cocolight-api-client.cjs +1 -1
- package/dist/4031.cocolight-api-client.browser.js +1 -1
- package/dist/4031.cocolight-api-client.cjs +1 -1
- package/dist/4152.cocolight-api-client.browser.js +1 -1
- package/dist/4152.cocolight-api-client.cjs +1 -1
- package/dist/4203.cocolight-api-client.browser.js +1 -1
- package/dist/4203.cocolight-api-client.cjs +1 -1
- package/dist/424.cocolight-api-client.browser.js +1 -1
- package/dist/424.cocolight-api-client.cjs +1 -1
- package/dist/435.cocolight-api-client.browser.js +1 -1
- package/dist/435.cocolight-api-client.cjs +1 -1
- package/dist/4402.cocolight-api-client.browser.js +1 -1
- package/dist/4402.cocolight-api-client.cjs +1 -1
- package/dist/4425.cocolight-api-client.browser.js +1 -1
- package/dist/4425.cocolight-api-client.cjs +1 -1
- package/dist/4472.cocolight-api-client.browser.js +1 -1
- package/dist/4472.cocolight-api-client.cjs +1 -1
- package/dist/4914.cocolight-api-client.browser.js +1 -1
- package/dist/4914.cocolight-api-client.cjs +1 -1
- package/dist/4959.cocolight-api-client.browser.js +1 -1
- package/dist/4959.cocolight-api-client.cjs +1 -1
- package/dist/5100.cocolight-api-client.browser.js +1 -1
- package/dist/5100.cocolight-api-client.cjs +1 -1
- package/dist/5111.cocolight-api-client.browser.js +1 -1
- package/dist/5111.cocolight-api-client.cjs +1 -1
- package/dist/5286.cocolight-api-client.browser.js +1 -1
- package/dist/5286.cocolight-api-client.cjs +1 -1
- package/dist/5380.cocolight-api-client.browser.js +1 -1
- package/dist/5380.cocolight-api-client.cjs +1 -1
- package/dist/5383.cocolight-api-client.browser.js +1 -1
- package/dist/5383.cocolight-api-client.cjs +1 -1
- package/dist/5480.cocolight-api-client.browser.js +1 -1
- package/dist/5480.cocolight-api-client.cjs +1 -1
- package/dist/5541.cocolight-api-client.browser.js +1 -1
- package/dist/5541.cocolight-api-client.cjs +1 -1
- package/dist/5839.cocolight-api-client.browser.js +1 -1
- package/dist/5839.cocolight-api-client.cjs +1 -1
- package/dist/5862.cocolight-api-client.browser.js +1 -1
- package/dist/5862.cocolight-api-client.cjs +1 -1
- package/dist/5869.cocolight-api-client.browser.js +1 -1
- package/dist/5869.cocolight-api-client.cjs +1 -1
- package/dist/588.cocolight-api-client.browser.js +1 -1
- package/dist/588.cocolight-api-client.cjs +1 -1
- package/dist/601.cocolight-api-client.browser.js +1 -1
- package/dist/601.cocolight-api-client.cjs +1 -1
- package/dist/6012.cocolight-api-client.browser.js +1 -1
- package/dist/6012.cocolight-api-client.cjs +1 -1
- package/dist/6200.cocolight-api-client.browser.js +1 -1
- package/dist/6200.cocolight-api-client.cjs +1 -1
- package/dist/6369.cocolight-api-client.browser.js +1 -1
- package/dist/6369.cocolight-api-client.cjs +1 -1
- package/dist/7009.cocolight-api-client.browser.js +1 -1
- package/dist/7009.cocolight-api-client.cjs +1 -1
- package/dist/725.cocolight-api-client.browser.js +1 -1
- package/dist/725.cocolight-api-client.cjs +1 -1
- package/dist/7320.cocolight-api-client.browser.js +1 -1
- package/dist/7339.cocolight-api-client.browser.js +1 -1
- package/dist/7339.cocolight-api-client.cjs +1 -1
- package/dist/7398.cocolight-api-client.browser.js +1 -1
- package/dist/7398.cocolight-api-client.cjs +1 -1
- package/dist/7888.cocolight-api-client.browser.js +1 -1
- package/dist/7888.cocolight-api-client.cjs +1 -1
- package/dist/7975.cocolight-api-client.browser.js +1 -1
- package/dist/7975.cocolight-api-client.cjs +1 -1
- package/dist/809.cocolight-api-client.browser.js +1 -1
- package/dist/809.cocolight-api-client.cjs +1 -1
- package/dist/8300.cocolight-api-client.browser.js +1 -1
- package/dist/8300.cocolight-api-client.cjs +1 -1
- package/dist/8317.cocolight-api-client.browser.js +1 -1
- package/dist/8317.cocolight-api-client.cjs +1 -1
- package/dist/8525.cocolight-api-client.browser.js +1 -1
- package/dist/8525.cocolight-api-client.cjs +1 -1
- package/dist/8894.cocolight-api-client.browser.js +1 -1
- package/dist/8894.cocolight-api-client.cjs +1 -1
- package/dist/9301.cocolight-api-client.browser.js +1 -1
- package/dist/9301.cocolight-api-client.cjs +1 -1
- package/dist/9438.cocolight-api-client.browser.js +1 -1
- package/dist/9438.cocolight-api-client.cjs +1 -1
- package/dist/9478.cocolight-api-client.browser.js +1 -1
- package/dist/9478.cocolight-api-client.cjs +1 -1
- package/dist/9568.cocolight-api-client.browser.js +1 -1
- package/dist/9568.cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.browser.js +6 -6
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +7 -17
- package/types/Api.d.ts +1 -0
- package/types/ApiClient.d.ts +10 -1
- package/types/api/BaseEntity.d.ts +2 -0
- package/types/utils/OfflineClientManager.d.ts +8 -0
- package/dist/1035.cocolight-api-client.mjs.js +0 -1
- package/dist/1483.cocolight-api-client.mjs.js +0 -1
- package/dist/1491.cocolight-api-client.mjs.js +0 -1
- package/dist/1494.cocolight-api-client.mjs.js +0 -1
- package/dist/1641.cocolight-api-client.mjs.js +0 -1
- package/dist/1678.cocolight-api-client.mjs.js +0 -1
- package/dist/2041.cocolight-api-client.mjs.js +0 -1
- package/dist/2302.cocolight-api-client.mjs.js +0 -1
- package/dist/2313.cocolight-api-client.mjs.js +0 -1
- package/dist/2379.cocolight-api-client.mjs.js +0 -1
- package/dist/2439.cocolight-api-client.mjs.js +0 -1
- package/dist/2594.cocolight-api-client.mjs.js +0 -1
- package/dist/2766.cocolight-api-client.mjs.js +0 -1
- package/dist/2812.cocolight-api-client.mjs.js +0 -1
- package/dist/2918.cocolight-api-client.mjs.js +0 -1
- package/dist/3028.cocolight-api-client.mjs.js +0 -1
- package/dist/3330.cocolight-api-client.mjs.js +0 -1
- package/dist/3371.cocolight-api-client.mjs.js +0 -1
- package/dist/3401.cocolight-api-client.mjs.js +0 -1
- package/dist/3516.cocolight-api-client.mjs.js +0 -1
- package/dist/3593.cocolight-api-client.mjs.js +0 -1
- package/dist/3764.cocolight-api-client.mjs.js +0 -1
- package/dist/3873.cocolight-api-client.mjs.js +0 -1
- package/dist/3911.cocolight-api-client.mjs.js +0 -1
- package/dist/4031.cocolight-api-client.mjs.js +0 -1
- package/dist/4152.cocolight-api-client.mjs.js +0 -1
- package/dist/4203.cocolight-api-client.mjs.js +0 -1
- package/dist/424.cocolight-api-client.mjs.js +0 -1
- package/dist/435.cocolight-api-client.mjs.js +0 -1
- package/dist/4402.cocolight-api-client.mjs.js +0 -1
- package/dist/4425.cocolight-api-client.mjs.js +0 -1
- package/dist/4472.cocolight-api-client.mjs.js +0 -1
- package/dist/4914.cocolight-api-client.mjs.js +0 -1
- package/dist/4959.cocolight-api-client.mjs.js +0 -1
- package/dist/5100.cocolight-api-client.mjs.js +0 -1
- package/dist/5111.cocolight-api-client.mjs.js +0 -1
- package/dist/5286.cocolight-api-client.mjs.js +0 -1
- package/dist/5380.cocolight-api-client.mjs.js +0 -1
- package/dist/5383.cocolight-api-client.mjs.js +0 -1
- package/dist/5480.cocolight-api-client.mjs.js +0 -1
- package/dist/5541.cocolight-api-client.mjs.js +0 -1
- package/dist/5839.cocolight-api-client.mjs.js +0 -1
- package/dist/5862.cocolight-api-client.mjs.js +0 -1
- package/dist/5869.cocolight-api-client.mjs.js +0 -1
- package/dist/588.cocolight-api-client.mjs.js +0 -1
- package/dist/601.cocolight-api-client.mjs.js +0 -1
- package/dist/6012.cocolight-api-client.mjs.js +0 -1
- package/dist/6200.cocolight-api-client.mjs.js +0 -1
- package/dist/6369.cocolight-api-client.mjs.js +0 -1
- package/dist/7009.cocolight-api-client.mjs.js +0 -1
- package/dist/725.cocolight-api-client.mjs.js +0 -1
- package/dist/7339.cocolight-api-client.mjs.js +0 -1
- package/dist/7398.cocolight-api-client.mjs.js +0 -1
- package/dist/7888.cocolight-api-client.mjs.js +0 -1
- package/dist/7975.cocolight-api-client.mjs.js +0 -1
- package/dist/809.cocolight-api-client.mjs.js +0 -1
- package/dist/8300.cocolight-api-client.mjs.js +0 -1
- package/dist/8317.cocolight-api-client.mjs.js +0 -1
- package/dist/8525.cocolight-api-client.mjs.js +0 -1
- package/dist/8894.cocolight-api-client.mjs.js +0 -1
- package/dist/9301.cocolight-api-client.mjs.js +0 -1
- package/dist/9438.cocolight-api-client.mjs.js +0 -1
- package/dist/9478.cocolight-api-client.mjs.js +0 -1
- package/dist/9568.cocolight-api-client.mjs.js +0 -1
- package/dist/cocolight-api-client.mjs.js +0 -1
- package/src/Api.ts +0 -348
- package/src/ApiClient.ts +0 -1994
- package/src/EJSONType.ts +0 -103
- package/src/api/Action.ts +0 -665
- package/src/api/Answer.ts +0 -1392
- package/src/api/Badge.ts +0 -143
- package/src/api/BaseEntity.ts +0 -6384
- package/src/api/Classified.ts +0 -175
- package/src/api/Comment.ts +0 -280
- package/src/api/EndpointApi.ts +0 -2270
- package/src/api/EndpointApi.types.ts +0 -6566
- package/src/api/EntityRegistry.ts +0 -324
- package/src/api/Event.ts +0 -360
- package/src/api/Form.ts +0 -282
- package/src/api/News.ts +0 -547
- package/src/api/Notifications.ts +0 -196
- package/src/api/Organization.ts +0 -771
- package/src/api/Poi.ts +0 -242
- package/src/api/Project.ts +0 -545
- package/src/api/User.ts +0 -1889
- package/src/api/UserApi.ts +0 -192
- package/src/api/serverDataType/Action.ts +0 -177
- package/src/api/serverDataType/Answer.ts +0 -106
- package/src/api/serverDataType/Classified.ts +0 -152
- package/src/api/serverDataType/Comment.ts +0 -88
- package/src/api/serverDataType/Country.ts +0 -1
- package/src/api/serverDataType/Event.ts +0 -112
- package/src/api/serverDataType/Form.ts +0 -157
- package/src/api/serverDataType/News.ts +0 -138
- package/src/api/serverDataType/Notification.ts +0 -81
- package/src/api/serverDataType/Organization.ts +0 -111
- package/src/api/serverDataType/Poi.ts +0 -75
- package/src/api/serverDataType/Project.ts +0 -115
- package/src/api/serverDataType/User.ts +0 -112
- package/src/api/serverDataType/Zone.ts +0 -33
- package/src/api/serverDataType/common.ts +0 -84
- package/src/costum/normalize.ts +0 -7
- package/src/costum/registry.ts +0 -138
- package/src/costum/runtime-map.ts +0 -221
- package/src/costum/runtime.ts +0 -274
- package/src/costum/schemas/CercleTravailleursSociauxLiberauxLaPlumeSociale.ts +0 -19
- package/src/costum/schemas/FabEn.ts +0 -19
- package/src/costum/schemas/LivingLabInnovationSocialeBraspanon.ts +0 -19
- package/src/costum/schemas/alfph.ts +0 -27
- package/src/costum/schemas/campagne.ts +0 -19
- package/src/costum/schemas/chtitube.ts +0 -19
- package/src/costum/schemas/circuitCourt.ts +0 -19
- package/src/costum/schemas/cmcasHauteBretagne.ts +0 -19
- package/src/costum/schemas/coFinancementTierslieux.ts +0 -27
- package/src/costum/schemas/coeurNumerique.ts +0 -19
- package/src/costum/schemas/communLundi.ts +0 -19
- package/src/costum/schemas/cressReunion.ts +0 -35
- package/src/costum/schemas/cressReunionNetwork.ts +0 -35
- package/src/costum/schemas/ctenat.ts +0 -43
- package/src/costum/schemas/cyberReunion.ts +0 -19
- package/src/costum/schemas/ekisphere.ts +0 -35
- package/src/costum/schemas/equipementsSportifs974.ts +0 -19
- package/src/costum/schemas/federationDesCae.ts +0 -19
- package/src/costum/schemas/formationGenerique.ts +0 -35
- package/src/costum/schemas/franceTierslieux.ts +0 -19
- package/src/costum/schemas/hinaura.ts +0 -27
- package/src/costum/schemas/hubmayotte.ts +0 -19
- package/src/costum/schemas/hubnouvellecaledonie.ts +0 -19
- package/src/costum/schemas/hubpolynesiefrancaise.ts +0 -19
- package/src/costum/schemas/hubreunion.ts +0 -19
- package/src/costum/schemas/hubterritoires.ts +0 -19
- package/src/costum/schemas/hubwallisetfutuna.ts +0 -19
- package/src/costum/schemas/hva.ts +0 -27
- package/src/costum/schemas/ibv2.ts +0 -19
- package/src/costum/schemas/institutBleu.ts +0 -19
- package/src/costum/schemas/journalInsoumisChambery.ts +0 -27
- package/src/costum/schemas/kpacite.ts +0 -19
- package/src/costum/schemas/laCompagnieDesTierslieux.ts +0 -43
- package/src/costum/schemas/laMaisonDesFaiseurs.ts +0 -19
- package/src/costum/schemas/laReunionPourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/laSemaineDesTierslieux.ts +0 -19
- package/src/costum/schemas/labEnCommuns.ts +0 -19
- package/src/costum/schemas/lakou.ts +0 -27
- package/src/costum/schemas/lesCommunsDesTierslieux.ts +0 -19
- package/src/costum/schemas/mayottePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/meir.ts +0 -27
- package/src/costum/schemas/navigatorDesTierslieux.ts +0 -19
- package/src/costum/schemas/notragora.ts +0 -27
- package/src/costum/schemas/nouvellecaledoniePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/openAtlas.ts +0 -19
- package/src/costum/schemas/polynesieFrancaisePourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/schemas/prdr.ts +0 -19
- package/src/costum/schemas/reseauTierslieux.ts +0 -19
- package/src/costum/schemas/rfflabs.ts +0 -19
- package/src/costum/schemas/ries.ts +0 -19
- package/src/costum/schemas/siteDuPactePourLaTransition.ts +0 -27
- package/src/costum/schemas/sportSanteBienetre.ts +0 -43
- package/src/costum/schemas/suppa.ts +0 -19
- package/src/costum/schemas/terramies.ts +0 -19
- package/src/costum/schemas/testeTplFormation.ts +0 -35
- package/src/costum/schemas/tierslieuxbelgique.ts +0 -19
- package/src/costum/schemas/tierslieuxorg1.ts +0 -35
- package/src/costum/schemas/transiter.ts +0 -35
- package/src/costum/schemas/vhelioPeiTour2025.ts +0 -19
- package/src/costum/schemas/wallisetfutunaPourUnNumeriqueInclusif.ts +0 -19
- package/src/costum/symbol.ts +0 -26
- package/src/costum/types.ts +0 -895
- package/src/endpoints.module.ts +0 -4253
- package/src/error.ts +0 -86
- package/src/forms/entityForm.ts +0 -142
- package/src/index.ts +0 -161
- package/src/mixin/UserMixin.ts +0 -4
- package/src/types/api-responses.ts +0 -217
- package/src/types/entities.ts +0 -58
- package/src/types/error-guards.ts +0 -230
- package/src/types/index.ts +0 -41
- package/src/types/payloads.ts +0 -21
- package/src/types/transforms.ts +0 -119
- package/src/utils/FileOfflineStorageStrategy.node.ts +0 -50
- package/src/utils/FileStorageStrategy.node.ts +0 -63
- package/src/utils/MultiServerFileStorageStrategy.node.ts +0 -67
- package/src/utils/MultiServerTokenStorageStrategy.ts +0 -139
- package/src/utils/OfflineClientManager.ts +0 -216
- package/src/utils/OfflineQueueStorageStrategy.ts +0 -47
- package/src/utils/TokenStorage.ts +0 -77
- package/src/utils/compat.ts +0 -12
- package/src/utils/createDefaultMultiServerTokenStorageStrategy.ts +0 -35
- package/src/utils/createDefaultOfflineStrategy.ts +0 -34
- package/src/utils/createDefaultTokenStorageStrategy.ts +0 -33
- package/src/utils/reactive.ts +0 -243
- package/src/utils/stream-utils.node.ts +0 -12
package/src/api/Organization.ts
DELETED
|
@@ -1,771 +0,0 @@
|
|
|
1
|
-
import { ApiError } from "../error.js";
|
|
2
|
-
import { BaseEntity } from "./BaseEntity.js";
|
|
3
|
-
import { createSocialTransform } from "../types/transforms.js";
|
|
4
|
-
|
|
5
|
-
import type { PaginatorPage, PaginatorState } from "./BaseEntity.js";
|
|
6
|
-
import type {
|
|
7
|
-
AddOrganizationData,
|
|
8
|
-
GetMembersAdminData,
|
|
9
|
-
GetMembersNoAdminData
|
|
10
|
-
} from "./EndpointApi.types.js";
|
|
11
|
-
import type { OpeningHoursEntry } from "./serverDataType/common.js";
|
|
12
|
-
import type { OrganizationItemNormalized } from "./serverDataType/Organization.js";
|
|
13
|
-
import type { User } from "./User.js";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export class Organization extends BaseEntity<OrganizationItemNormalized> {
|
|
17
|
-
static override entityType = "organizations";
|
|
18
|
-
|
|
19
|
-
static override entityTag = "Organization";
|
|
20
|
-
|
|
21
|
-
/** Bloc de création où injecter les champs costum (CostumScope). */
|
|
22
|
-
static override COSTUM_ADD_CONSTANT = "ADD_ORGANIZATION";
|
|
23
|
-
|
|
24
|
-
static override SCHEMA_CONSTANTS: string[] = [
|
|
25
|
-
"ADD_ORGANIZATION",
|
|
26
|
-
"UPDATE_BLOCK_DESCRIPTION",
|
|
27
|
-
"UPDATE_BLOCK_INFO",
|
|
28
|
-
"UPDATE_BLOCK_SOCIAL",
|
|
29
|
-
"UPDATE_BLOCK_LOCALITY",
|
|
30
|
-
"UPDATE_BLOCK_SLUG",
|
|
31
|
-
"PROFIL_IMAGE",
|
|
32
|
-
"VIRTUAL_OPENING_HOURS",
|
|
33
|
-
"VIRTUAL_ORG_BASE_FIELDS"
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
static override VIRTUAL_SCHEMAS = {
|
|
37
|
-
VIRTUAL_OPENING_HOURS: {
|
|
38
|
-
type: "object",
|
|
39
|
-
properties: {
|
|
40
|
-
openingHours: {
|
|
41
|
-
type: "array",
|
|
42
|
-
description: "Horaires d'ouverture (7 jours de la semaine)",
|
|
43
|
-
minItems: 7,
|
|
44
|
-
maxItems: 7,
|
|
45
|
-
items: {
|
|
46
|
-
oneOf: [
|
|
47
|
-
{
|
|
48
|
-
type: "string",
|
|
49
|
-
const: ""
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: "object",
|
|
53
|
-
properties: {
|
|
54
|
-
dayOfWeek: {
|
|
55
|
-
type: "string",
|
|
56
|
-
enum: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
|
57
|
-
description: "Jour de la semaine"
|
|
58
|
-
},
|
|
59
|
-
hours: {
|
|
60
|
-
type: "array",
|
|
61
|
-
description: "Liste des créneaux horaires",
|
|
62
|
-
items: {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {
|
|
65
|
-
opens: {
|
|
66
|
-
type: "string",
|
|
67
|
-
pattern: "^([01]\\d|2[0-3]):[0-5]\\d$",
|
|
68
|
-
description: "Heure d'ouverture (HH:MM)"
|
|
69
|
-
},
|
|
70
|
-
closes: {
|
|
71
|
-
type: "string",
|
|
72
|
-
pattern: "^([01]\\d|2[0-3]):[0-5]\\d$",
|
|
73
|
-
description: "Heure de fermeture (HH:MM)"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
required: ["opens", "closes"],
|
|
77
|
-
additionalProperties: false
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
required: ["dayOfWeek", "hours"],
|
|
82
|
-
additionalProperties: false
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* Champs de BASE (DATA_BINDING) sans `UPDATE_BLOCK_*` dédié : `telephone`/`video`. Déclarés ici
|
|
91
|
-
* pour être writable sur le draft, persistés à l'édition via CUSTOM_FIELD_HANDLERS → UPDATE_PATH_VALUE.
|
|
92
|
-
* (Les champs TIERS-LIEU costum — holderOrganization/manageModel/typePlace/buildingSurfaceArea/
|
|
93
|
-
* siteSurfaceArea/openingDate — sont désormais gérés par CostumScope/auto-derive, cf. inc1b/inc2.)
|
|
94
|
-
*/
|
|
95
|
-
VIRTUAL_ORG_BASE_FIELDS: {
|
|
96
|
-
type: "object",
|
|
97
|
-
properties: {
|
|
98
|
-
telephone: { type: "string" },
|
|
99
|
-
video: { type: "array", items: { type: "string" } }
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
static override CUSTOM_FIELD_HANDLERS = new Map([
|
|
105
|
-
["openingHours", {
|
|
106
|
-
updateMethod: "updateOpeningHours",
|
|
107
|
-
schemaConstant: "VIRTUAL_OPENING_HOURS"
|
|
108
|
-
}],
|
|
109
|
-
["telephone", { updateMethod: "updateTelephone", schemaConstant: "VIRTUAL_ORG_BASE_FIELDS" }],
|
|
110
|
-
["video", { updateMethod: "updateVideo", schemaConstant: "VIRTUAL_ORG_BASE_FIELDS" }]
|
|
111
|
-
] as const);
|
|
112
|
-
|
|
113
|
-
static ADD_BLOCKS = new Map([
|
|
114
|
-
["ADD_ORGANIZATION", "addOrganization"],
|
|
115
|
-
["UPDATE_BLOCK_SOCIAL", "updateSocial"],
|
|
116
|
-
["PROFIL_IMAGE", "updateImageProfil"]
|
|
117
|
-
] as const);
|
|
118
|
-
|
|
119
|
-
static UPDATE_BLOCKS = new Map([
|
|
120
|
-
["UPDATE_BLOCK_DESCRIPTION", "updateDescription"],
|
|
121
|
-
["UPDATE_BLOCK_SOCIAL", "updateSocial"],
|
|
122
|
-
["UPDATE_BLOCK_LOCALITY", "updateLocality"],
|
|
123
|
-
["UPDATE_BLOCK_INFO", "updateInfo"],
|
|
124
|
-
["UPDATE_BLOCK_SLUG", "updateSlug"],
|
|
125
|
-
["PROFIL_IMAGE", "updateImageProfil"]
|
|
126
|
-
] as const);
|
|
127
|
-
|
|
128
|
-
override defaultFields: Record<string, any> = {
|
|
129
|
-
typeElement: this.getEntityType()
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
override removeFields: string[] = [
|
|
133
|
-
"typeElement"
|
|
134
|
-
];
|
|
135
|
-
|
|
136
|
-
// role = admin c'est bizarre car en faite c'est gérer dans links sur user et l'orga
|
|
137
|
-
// links.members.${this.userId}.isAdmin === true
|
|
138
|
-
override transforms: Record<string, (val: any, full: any) => any> = {
|
|
139
|
-
github: createSocialTransform("github"),
|
|
140
|
-
gitlab: createSocialTransform("gitlab"),
|
|
141
|
-
facebook: createSocialTransform("facebook"),
|
|
142
|
-
twitter: createSocialTransform("twitter"),
|
|
143
|
-
instagram: createSocialTransform("instagram"),
|
|
144
|
-
diaspora: createSocialTransform("diaspora"),
|
|
145
|
-
mastodon: createSocialTransform("mastodon"),
|
|
146
|
-
telegram: createSocialTransform("telegram"),
|
|
147
|
-
signal: createSocialTransform("signal")
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Transforme les Answer docs imbriqués dans `data.answers` (renvoyé par /costum/navigator/gettl)
|
|
152
|
-
* en instances d'entité Answer. Le payload backend fait un PHDB::find(Answer::COLLECTION, ...) brut,
|
|
153
|
-
* donc on injecte `collection: "answers"` avant linkage pour rester cohérent avec les autres entités.
|
|
154
|
-
*
|
|
155
|
-
* Structure : `data.answers = { [formId]: AnswerDoc[] }` → `{ [formId]: Answer[] }`
|
|
156
|
-
* (le formId reste une string ; charger le Form se fait via `api.form({ id: formId })`).
|
|
157
|
-
*
|
|
158
|
-
* @protected
|
|
159
|
-
*/
|
|
160
|
-
protected override _transformServerData(data: OrganizationItemNormalized): OrganizationItemNormalized {
|
|
161
|
-
const rawAnswers = (data as Record<string, unknown>).answers as Record<string, unknown[]> | undefined;
|
|
162
|
-
if (rawAnswers && typeof rawAnswers === "object") {
|
|
163
|
-
const linkedAnswers: Record<string, unknown[]> = {};
|
|
164
|
-
for (const [formId, docs] of Object.entries(rawAnswers)) {
|
|
165
|
-
// Le backend renvoie tantôt un tableau `[doc, ...]`, tantôt une map indexée
|
|
166
|
-
// par id `{ answerId: doc }`. On normalise vers un tableau dans les deux cas.
|
|
167
|
-
const list = Array.isArray(docs)
|
|
168
|
-
? docs
|
|
169
|
-
: (docs && typeof docs === "object" ? Object.values(docs) : []);
|
|
170
|
-
linkedAnswers[formId] = list.map((doc) =>
|
|
171
|
-
doc && typeof doc === "object"
|
|
172
|
-
? this._linkEntity("answers", { ...(doc as Record<string, unknown>), collection: "answers" })
|
|
173
|
-
: doc
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
(data as Record<string, unknown>).answers = linkedAnswers;
|
|
177
|
-
}
|
|
178
|
-
return data;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
override _add = async (payload: Record<string, any>): Promise<void> => {
|
|
182
|
-
if (!this._calledFromSave) {
|
|
183
|
-
throw new ApiError("utilisation invalide de _add, utilisez save", 400);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
payload.id = this._newId?.();
|
|
187
|
-
if (payload.slug) delete payload.slug;
|
|
188
|
-
|
|
189
|
-
for (const [constant, methodName] of Array.from(Organization.ADD_BLOCKS)) {
|
|
190
|
-
const isCreateBlock = constant === "ADD_ORGANIZATION";
|
|
191
|
-
|
|
192
|
-
// Pour les blocks secondaires (UPDATE_BLOCK_SOCIAL, PROFIL_IMAGE), on aligne sur
|
|
193
|
-
// la logique de `_update` : on retire `id` du payload et on filtre via removeFields
|
|
194
|
-
// (typeElement). Ces auto-fields sont ré-injectés par la méthode block via `this.id`
|
|
195
|
-
// / `getEntityType()`. Sans ça, le block est invoqué dès qu'il y a un auto-field
|
|
196
|
-
// dans l'extraction et AJV rejette pour anyOf manquant (ex: UPDATE_BLOCK_SOCIAL
|
|
197
|
-
// sans aucun champ social).
|
|
198
|
-
const blockPayload: Record<string, any> = { ...payload, ...this.defaultFields };
|
|
199
|
-
if (!isCreateBlock) delete blockPayload.id;
|
|
200
|
-
|
|
201
|
-
const blockData = this._extractChangedFieldsFromSchema(
|
|
202
|
-
this.apiClient,
|
|
203
|
-
constant,
|
|
204
|
-
blockPayload,
|
|
205
|
-
() => {},
|
|
206
|
-
isCreateBlock ? [] : this.removeFields
|
|
207
|
-
);
|
|
208
|
-
if (blockData && Object.keys(blockData).length > 0) {
|
|
209
|
-
const data = await this._invokeBlockMethod(Organization.ADD_BLOCKS, methodName, blockData);
|
|
210
|
-
if (!this.id && data?.map?.id) {
|
|
211
|
-
this._draftData.id = data.map.id;
|
|
212
|
-
this._draftData.slug = data.map.slug;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
override _update = async (payload: Record<string, any>): Promise<boolean> => {
|
|
219
|
-
if(!this.isAdmin()){
|
|
220
|
-
throw new ApiError("Vous n'avez pas les droits pour modifier cette organisation", 403);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (!this._calledFromSave) {
|
|
224
|
-
throw new ApiError("utilisation invalide de _update, utilisez save", 400);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Entité costum-scopée : tout l'UPDATE part en UN `element/save` (pendant de l'ADD, hooks costum). cf. BaseEntity.
|
|
228
|
-
if (this._costumCtx) return this._saveCostumViaElementSave(payload);
|
|
229
|
-
|
|
230
|
-
if (payload.id) delete payload.id;
|
|
231
|
-
let hasChanged = false;
|
|
232
|
-
|
|
233
|
-
// 1. Traiter les champs personnalisés AVANT les block updates
|
|
234
|
-
const customHandlers = Organization.CUSTOM_FIELD_HANDLERS;
|
|
235
|
-
if (customHandlers) {
|
|
236
|
-
const processedFields = new Set<string>();
|
|
237
|
-
|
|
238
|
-
for (const [fieldName, config] of customHandlers) {
|
|
239
|
-
if (fieldName in payload && this._hasFieldChanged(fieldName)) {
|
|
240
|
-
await this._invokeCustomFieldHandler(
|
|
241
|
-
config.updateMethod,
|
|
242
|
-
payload[fieldName],
|
|
243
|
-
fieldName
|
|
244
|
-
);
|
|
245
|
-
processedFields.add(fieldName);
|
|
246
|
-
hasChanged = true;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Retirer les champs traités du payload pour éviter qu'ils soient traités par les blocks
|
|
251
|
-
processedFields.forEach(f => delete payload[f]);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// 2. Traiter les block updates normaux
|
|
255
|
-
for (const [constant, methodName] of Array.from(Organization.UPDATE_BLOCKS)) {
|
|
256
|
-
const blockData = this._extractChangedFieldsFromSchema(
|
|
257
|
-
this.apiClient,
|
|
258
|
-
constant,
|
|
259
|
-
{ ...payload, ...this.defaultFields },
|
|
260
|
-
() => this.initialDraftData,
|
|
261
|
-
this.removeFields
|
|
262
|
-
);
|
|
263
|
-
if (blockData && Object.keys(blockData).length > 0) {
|
|
264
|
-
await this._invokeBlockMethod(Organization.UPDATE_BLOCKS, methodName, blockData);
|
|
265
|
-
hasChanged = true;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return hasChanged;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Ajoute une organisation.
|
|
274
|
-
*
|
|
275
|
-
* @param data - Données de l'organisation à ajouter.
|
|
276
|
-
* @throws {ApiError} - Si l'utilisateur n'est pas connecté ou si l'entité n'est pas enregistrée.
|
|
277
|
-
*/
|
|
278
|
-
async addOrganization(data: AddOrganizationData): Promise<unknown> {
|
|
279
|
-
return this.callIsConnected(() => this.endpointApi.addOrganization(data));
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Supprime cette organisation via `DELETE_ELEMENT` (`type=organizations`).
|
|
284
|
-
*
|
|
285
|
-
* **Garde** : auteur (`serverData.creator`) OU administrateur direct de l'org
|
|
286
|
-
* (`userContext.links.memberOf[id].isAdmin`). Pas de hiérarchie parent (une org
|
|
287
|
-
* est racine). cf. {@link BaseEntity#_deleteViaElement}.
|
|
288
|
-
*
|
|
289
|
-
* ⚠️ **Destructif** : supprime l'organisation et potentiellement ses rattachements
|
|
290
|
-
* (projets/events/membres) côté serveur. À utiliser avec précaution.
|
|
291
|
-
*
|
|
292
|
-
* Après succès : données vidées + `_isDeleted = true`.
|
|
293
|
-
*
|
|
294
|
-
* @param reason - Raison transmise au backend (audit). Défaut `"delete organization"`.
|
|
295
|
-
* @throws {ApiError} 400 si l'org n'a pas d'id.
|
|
296
|
-
* @throws {ApiError} 403 si ni auteur ni admin.
|
|
297
|
-
*/
|
|
298
|
-
async delete(reason: string = "delete organization"): Promise<void> {
|
|
299
|
-
await this._deleteViaElement(this.getEntityType(), reason);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
override async getOrganizations(): Promise<never> {
|
|
303
|
-
throw new ApiError("getOrganizations n'existe pas dans Organization", 404);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* {@inheritDoc BaseEntity#getProjects}
|
|
308
|
-
*
|
|
309
|
-
* Récupère les projets de l'organisation.
|
|
310
|
-
*/
|
|
311
|
-
override async getProjects(data: Parameters<BaseEntity<OrganizationItemNormalized>["getProjects"]>[0] = {}) {
|
|
312
|
-
return super.getProjects(data);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* {@inheritDoc BaseEntity#getEvents}
|
|
317
|
-
*
|
|
318
|
-
* Récupère les événements de l'organisation.
|
|
319
|
-
*/
|
|
320
|
-
override async getEvents(data: Parameters<BaseEntity<OrganizationItemNormalized>["getEvents"]>[0] = {}) {
|
|
321
|
-
return super.getEvents(data);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* {@inheritDoc BaseEntity#getPois}
|
|
326
|
-
*
|
|
327
|
-
* Récupère les points d'intérêt de l'organisation.
|
|
328
|
-
*/
|
|
329
|
-
override async getPois(data: Parameters<BaseEntity<OrganizationItemNormalized>["getPois"]>[0] = {}) {
|
|
330
|
-
return super.getPois(data);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* {@inheritDoc BaseEntity#getBadgesIssuer}
|
|
335
|
-
*
|
|
336
|
-
* Récupère les émetteurs de badges de l'organisation.
|
|
337
|
-
*/
|
|
338
|
-
override async getBadgesIssuer(data: Parameters<BaseEntity<OrganizationItemNormalized>["getBadgesIssuer"]>[0] = {}) {
|
|
339
|
-
return super.getBadgesIssuer(data);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* {@inheritDoc BaseEntity#getNews}
|
|
344
|
-
*
|
|
345
|
-
* Récupère les actualités de l'organisation.
|
|
346
|
-
*/
|
|
347
|
-
override async getNews(data: Parameters<BaseEntity<OrganizationItemNormalized>["getNews"]>[0] = {}) {
|
|
348
|
-
return super.getNews(data);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* {@inheritDoc BaseEntity#getSubscribers}
|
|
353
|
-
*
|
|
354
|
-
* Récupère les abonnés de l'organisation.
|
|
355
|
-
*/
|
|
356
|
-
override async getSubscribers(data: Parameters<BaseEntity<OrganizationItemNormalized>["getSubscribers"]>[0] = {}) {
|
|
357
|
-
return super.getSubscribers(data);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Récupérer les membres de l'organisation.
|
|
363
|
-
* Constant : GET_MEMBERS_ADMIN / GET_MEMBERS_NO_ADMIN
|
|
364
|
-
* @param data - Paramètres (partiels) de recherche/pagination.
|
|
365
|
-
* @param options - Options supplémentaires.
|
|
366
|
-
* @param options.toBeValidated - Indique si les membres doivent être validés.
|
|
367
|
-
* @param options.isAdmin - Indique si l'utilisateur est admin.
|
|
368
|
-
* @param options.isAdminPending - Indique si l'utilisateur est en attente de validation pour être admin.
|
|
369
|
-
* @param options.isInviting - Indique si l'utilisateur est en attente d'invitation.
|
|
370
|
-
* @param options.roles - Liste des rôles à filtrer.
|
|
371
|
-
* @returns - Un objet contenant le nombre de membres et la liste des membres.
|
|
372
|
-
* @throws {ApiResponseError} - Si une erreur se produit lors de la récupération des contributeurs.
|
|
373
|
-
*
|
|
374
|
-
* @example
|
|
375
|
-
* // Récupérer tous les membres
|
|
376
|
-
* const members = await organization.getMembers();
|
|
377
|
-
*
|
|
378
|
-
* // Récupérer les membres avec validation en attente
|
|
379
|
-
* const membersToBeValidated = await organization.getMembers({}, { toBeValidated: true });
|
|
380
|
-
*
|
|
381
|
-
* // Récupérer les membres avec un rôle spécifique
|
|
382
|
-
* const membersWithRole = await organization.getMembers({}, { roles: ['admin'] });
|
|
383
|
-
*
|
|
384
|
-
* // Récupérer les membres en attente d'invitation
|
|
385
|
-
* const invitingMembers = await organization.getMembers({}, { isInviting: true });
|
|
386
|
-
*
|
|
387
|
-
* // Récupérer les membres admin
|
|
388
|
-
* const adminMembers = await organization.getMembers({}, { isAdmin: true });
|
|
389
|
-
*
|
|
390
|
-
* // Récupérer les membres admin et en attente d'invitation
|
|
391
|
-
* const adminInvitingMembers = await organization.getMembers({}, { isAdmin: true, isInviting: true });
|
|
392
|
-
*
|
|
393
|
-
* // Récupérer les membres avec validation en attente et admin
|
|
394
|
-
* const adminToBeValidatedMembers = await organization.getMembers({}, { toBeValidated: true, isAdmin: true });
|
|
395
|
-
*
|
|
396
|
-
* // Récupérer les membres en attente de validation pour être admin
|
|
397
|
-
* const adminPendingMembers = await organization.getMembers({}, { isAdminPending: true });
|
|
398
|
-
*
|
|
399
|
-
* // Restreindre la recherche : uniquement les citoyens
|
|
400
|
-
* const onlyCitoyens = await organization.getMembers({}, { searchType: "citoyens" });
|
|
401
|
-
*
|
|
402
|
-
* // Restreindre la recherche : uniquement les organisations
|
|
403
|
-
* const onlyOrgas = await organization.getMembers({}, { searchType: "organizations" });
|
|
404
|
-
*/
|
|
405
|
-
async getMembers(
|
|
406
|
-
data: Partial<GetMembersAdminData | GetMembersNoAdminData> = {},
|
|
407
|
-
options: {
|
|
408
|
-
toBeValidated?: boolean;
|
|
409
|
-
isAdmin?: boolean;
|
|
410
|
-
isAdminPending?: boolean;
|
|
411
|
-
isInviting?: boolean;
|
|
412
|
-
roles?: any[];
|
|
413
|
-
searchType?: "all" | "citoyens" | "organizations";
|
|
414
|
-
restoredState?: PaginatorState;
|
|
415
|
-
} = {}
|
|
416
|
-
): Promise<PaginatorPage<User | Organization>> {
|
|
417
|
-
|
|
418
|
-
if(!this.id) {
|
|
419
|
-
throw new ApiError("L'organisation n'est pas définie, impossible de récupérer les membres", 400);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/** « Snapshot » local, typé string */
|
|
423
|
-
const orgId = this.id as string;
|
|
424
|
-
|
|
425
|
-
const allTypes = this._getDefaultFromEndpoint("GET_MEMBERS_ADMIN", "searchType") as GetMembersAdminData["searchType"];
|
|
426
|
-
if (options.searchType === "citoyens") {
|
|
427
|
-
data.searchType = ["citoyens"];
|
|
428
|
-
} else if (options.searchType === "organizations") {
|
|
429
|
-
data.searchType = allTypes.filter(t => t !== "citoyens") as GetMembersAdminData["searchType"];
|
|
430
|
-
} else {
|
|
431
|
-
data.searchType = allTypes;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
const paginator = this._createPaginatorEngine({
|
|
435
|
-
initialData: data,
|
|
436
|
-
methodName: "getMembers",
|
|
437
|
-
restoredState: options?.restoredState,
|
|
438
|
-
finalizer: async (finalData) => {
|
|
439
|
-
|
|
440
|
-
const { toBeValidated, isAdmin, isAdminPending, isInviting, roles = [] } = options;
|
|
441
|
-
|
|
442
|
-
if(this.isMe){
|
|
443
|
-
finalData.pathParams = { id: this.id };
|
|
444
|
-
// finalData.filters = {
|
|
445
|
-
// [`links.memberOf.${this.id}`]: { "$exists": true },
|
|
446
|
-
// [`links.memberOf.${this.id}.toBeValidated`]: { "$exists": false },
|
|
447
|
-
// [`links.memberOf.${this.id}.isInviting`]: { "$exists": false }
|
|
448
|
-
// };
|
|
449
|
-
finalData.filters = this._buildLinkFilters(orgId, { linkType: "memberOf", toBeValidated, isAdmin, isAdminPending, isInviting, roles });
|
|
450
|
-
} else {
|
|
451
|
-
delete finalData?.pathParams;
|
|
452
|
-
finalData.filters = this._buildLinkFilters(orgId, { linkType: "memberOf", toBeValidated: false, isAdmin, isInviting, roles });
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
const fetchFn = this.isMe
|
|
456
|
-
? () => this.callIsMe(() => this.endpointApi.getMembersAdmin(finalData))
|
|
457
|
-
: () => this.endpointApi.getMembersNoAdmin(finalData);
|
|
458
|
-
|
|
459
|
-
return fetchFn();
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
return paginator.next() as Promise<PaginatorPage<User | Organization>>;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Récupère les organisations dont **cette** organisation est membre
|
|
468
|
-
* (lien montant : réseau, fédération, collectif… dont l'orga fait partie).
|
|
469
|
-
*
|
|
470
|
-
* C'est le miroir de {@link Organization#getMembers} : `getMembers()` liste
|
|
471
|
-
* *qui* est membre de cette orga, tandis que `getMemberOf()` liste *les orgas
|
|
472
|
-
* dont cette orga est elle-même membre*.
|
|
473
|
-
*
|
|
474
|
-
* Contrairement à {@link BaseEntity#getOrganizations} (désactivée ici car pensée
|
|
475
|
-
* pour un citoyen via `GET_ORGANIZATIONS_*`), on passe par la recherche réseau
|
|
476
|
-
* globale `searchCostum` : on cible `searchType: ["organizations"]` et on filtre
|
|
477
|
-
* sur `links.members.{thisOrgId}`. Seules les adhésions **confirmées** sont
|
|
478
|
-
* retournées (les liens `toBeValidated` et `isInviting` sont exclus).
|
|
479
|
-
*
|
|
480
|
-
* La pagination (`hasNext`/`next()`) et la restauration via `restoredState`
|
|
481
|
-
* fonctionnent comme pour `searchCostum` : le filtre membership est conservé
|
|
482
|
-
* d'une page à l'autre.
|
|
483
|
-
*
|
|
484
|
-
* @param data - Paramètres de recherche/pagination additionnels (`name`, `indexStep`,
|
|
485
|
-
* `sortBy`, `locality`, `filters` complémentaires…). Les `filters` fournis sont
|
|
486
|
-
* fusionnés avec le filtre membership, ce dernier restant prioritaire.
|
|
487
|
-
* @param options - Options. `restoredState` pour reprendre une pagination sérialisée.
|
|
488
|
-
* @returns Première page paginée d'organisations.
|
|
489
|
-
* @throws {ApiError} Si l'organisation n'a pas d'`id`.
|
|
490
|
-
*
|
|
491
|
-
* @example
|
|
492
|
-
* // Toutes les orgas dont cette orga est membre
|
|
493
|
-
* const page = await org.getMemberOf();
|
|
494
|
-
* console.log(page.results, page.count.total);
|
|
495
|
-
*
|
|
496
|
-
* @example
|
|
497
|
-
* // Filtrer par nom + pagination plus large
|
|
498
|
-
* const page = await org.getMemberOf({ name: "réseau", indexStep: 50 });
|
|
499
|
-
* if (page.hasNext) await page.next();
|
|
500
|
-
*/
|
|
501
|
-
async getMemberOf(
|
|
502
|
-
data: Parameters<BaseEntity<OrganizationItemNormalized>["searchCostum"]>[0] = {},
|
|
503
|
-
options: { restoredState?: PaginatorState } = {}
|
|
504
|
-
): Promise<PaginatorPage<Organization>> {
|
|
505
|
-
if (!this.id) {
|
|
506
|
-
throw new ApiError("L'organisation n'est pas définie, impossible de récupérer ses adhésions", 400);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const path = `links.members.${this.id}`;
|
|
510
|
-
const membershipFilters = {
|
|
511
|
-
[path]: { $exists: true },
|
|
512
|
-
[`${path}.toBeValidated`]: { $exists: false },
|
|
513
|
-
[`${path}.isInviting`]: { $exists: false }
|
|
514
|
-
};
|
|
515
|
-
const callerFilters = (data?.filters && typeof data.filters === "object") ? data.filters : {};
|
|
516
|
-
|
|
517
|
-
const orgParam: Parameters<typeof this.searchCostum>[0] = {
|
|
518
|
-
indexMin: 0,
|
|
519
|
-
indexStep: 20,
|
|
520
|
-
notSourceKey: true,
|
|
521
|
-
...data,
|
|
522
|
-
// Champs imposés (le caller ne peut pas casser la sémantique « adhésions »)
|
|
523
|
-
searchType: ["organizations"],
|
|
524
|
-
countType: ["organizations"],
|
|
525
|
-
count: true,
|
|
526
|
-
filters: { ...callerFilters, ...membershipFilters }
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
return this.searchCostum(orgParam, options) as Promise<PaginatorPage<Organization>>;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* {@inheritDoc BaseEntity#getGallery}
|
|
534
|
-
*
|
|
535
|
-
* Récupère la galerie de l'organisation.
|
|
536
|
-
*/
|
|
537
|
-
override async getGallery(data: Parameters<BaseEntity<OrganizationItemNormalized>["getGallery"]>[0] = {}) {
|
|
538
|
-
return super.getGallery(data);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* {@inheritDoc BaseEntity#project}
|
|
543
|
-
*
|
|
544
|
-
* Crée une instance de projet et récupère son profil si nécessaire.
|
|
545
|
-
*/
|
|
546
|
-
override async project(projectData: Parameters<BaseEntity<OrganizationItemNormalized>["project"]>[0] = {}) {
|
|
547
|
-
if(!this.isAdmin()){
|
|
548
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un projet dans cette organisation", 403);
|
|
549
|
-
}
|
|
550
|
-
return super.project(projectData);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* {@inheritDoc BaseEntity#poi}
|
|
555
|
-
*
|
|
556
|
-
* Crée une instance de POI et la récupère si nécessaire.
|
|
557
|
-
*/
|
|
558
|
-
override async poi(poiData: Parameters<BaseEntity<OrganizationItemNormalized>["poi"]>[0] = {}) {
|
|
559
|
-
if(!this.isAdmin()){
|
|
560
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un poi dans cette organisation", 403);
|
|
561
|
-
}
|
|
562
|
-
return super.poi(poiData);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* {@inheritDoc BaseEntity#event}
|
|
567
|
-
*
|
|
568
|
-
* Crée une instance d'événement et la récupère si nécessaire.
|
|
569
|
-
*/
|
|
570
|
-
override async event(eventData: Parameters<BaseEntity<OrganizationItemNormalized>["event"]>[0] = {}) {
|
|
571
|
-
if(!this.isAdmin()){
|
|
572
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un event dans cette organisation", 403);
|
|
573
|
-
}
|
|
574
|
-
return super.event(eventData);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* {@inheritDoc BaseEntity#badge}
|
|
579
|
-
*
|
|
580
|
-
* Crée une instance de badge et la récupère si nécessaire.
|
|
581
|
-
*/
|
|
582
|
-
override async badge(badgeData: Parameters<BaseEntity<OrganizationItemNormalized>["badge"]>[0] = {}) {
|
|
583
|
-
if(!this.isAdmin()){
|
|
584
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un badge dans cette organisation", 403);
|
|
585
|
-
}
|
|
586
|
-
return super.badge(badgeData);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* {@inheritDoc BaseEntity#news}
|
|
591
|
-
*
|
|
592
|
-
* Crée une instance de news et la récupère si nécessaire.
|
|
593
|
-
*/
|
|
594
|
-
override async news(newsData: Parameters<BaseEntity<OrganizationItemNormalized>["news"]>[0] = {}) {
|
|
595
|
-
// TODO: qui peut créer une news sur l'organisation ?
|
|
596
|
-
return super.news(newsData);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* {@inheritDoc BaseEntity#form}
|
|
601
|
-
*
|
|
602
|
-
* Crée une instance de Form dans le contexte de cette organisation : le Form aura
|
|
603
|
-
* `this.parent = Organization`, ce qui permet à `form.getAnswers()` de déléguer
|
|
604
|
-
* `coformAnswersSearch` avec le bon costumContext.
|
|
605
|
-
*/
|
|
606
|
-
override async form(formData: Parameters<BaseEntity<OrganizationItemNormalized>["form"]>[0] = {}) {
|
|
607
|
-
return super.form(formData);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Met à jour les horaires d'ouverture de l'organisation.
|
|
612
|
-
* Utilise UPDATE_PATH_VALUE pour modifier le champ openingHours.
|
|
613
|
-
*
|
|
614
|
-
* @param hours - Tableau de 7 entrées (une par jour de la semaine)
|
|
615
|
-
* @returns Résultat de l'appel API
|
|
616
|
-
* @throws {ApiError} Si l'organisation n'a pas d'ID
|
|
617
|
-
*
|
|
618
|
-
* @example
|
|
619
|
-
* const openingHours = [
|
|
620
|
-
* { dayOfWeek: "Mo", hours: [{ opens: "09:00", closes: "18:00" }] },
|
|
621
|
-
* { dayOfWeek: "Tu", hours: [{ opens: "09:00", closes: "18:00" }] },
|
|
622
|
-
* // ... pour les 7 jours
|
|
623
|
-
* ];
|
|
624
|
-
* await org.updateOpeningHours(openingHours);
|
|
625
|
-
*/
|
|
626
|
-
async updateOpeningHours(hours: OpeningHoursEntry[]): Promise<unknown> {
|
|
627
|
-
const result = await this.updateField("openingHours", hours);
|
|
628
|
-
await this._refreshIfDirect();
|
|
629
|
-
return result;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* ───────────────────────────────
|
|
634
|
-
* Champs de BASE sans `UPDATE_BLOCK_*` dédié : `telephone` / `video` (dispatch UPDATE_PATH_VALUE).
|
|
635
|
-
* Les champs TIERS-LIEU costum (holderOrganization/manageModel/typePlace/buildingSurfaceArea/
|
|
636
|
-
* siteSurfaceArea/openingDate) sont gérés par CostumScope (création) + auto-derive de `_costumCtx`
|
|
637
|
-
* depuis `source.key` (chargement) → dispatch générique `_dispatchCostumFieldUpdates`. cf. inc1b/inc2.
|
|
638
|
-
* ───────────────────────────────
|
|
639
|
-
*/
|
|
640
|
-
|
|
641
|
-
/** Met à jour `telephone` (téléphone de la structure, distinct des champs citoyen fixe/mobile). */
|
|
642
|
-
async updateTelephone(value: string): Promise<unknown> {
|
|
643
|
-
const result = await this.updateField("telephone", value);
|
|
644
|
-
await this._refreshIfDirect();
|
|
645
|
-
return result;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
/** Met à jour `video` (liste d'URLs de vidéos de présentation). */
|
|
649
|
-
async updateVideo(value: string[]): Promise<unknown> {
|
|
650
|
-
if (!Array.isArray(value)) {
|
|
651
|
-
throw new ApiError(`video: attendu tableau d'URLs. Reçu: ${JSON.stringify(value)}`, 400);
|
|
652
|
-
}
|
|
653
|
-
const result = await this.updateField("video", value);
|
|
654
|
-
await this._refreshIfDirect();
|
|
655
|
-
return result;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* ───────────────────────────────
|
|
660
|
-
* Lien utilisateur ↔ organisation
|
|
661
|
-
* (rejoindre, valider, quitter, devenir admin)
|
|
662
|
-
* ───────────────────────────────
|
|
663
|
-
*/
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* {@inheritDoc BaseEntity#requestToJoin}
|
|
668
|
-
*
|
|
669
|
-
* Envoie une demande pour rejoindre l'organisation en tant que membre.
|
|
670
|
-
* L'action est soumise à validation par un administrateur de l'organisation.
|
|
671
|
-
*/
|
|
672
|
-
override async requestToJoin() {
|
|
673
|
-
return super.requestToJoin();
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* {@inheritDoc BaseEntity#requestToJoinAdmin}
|
|
678
|
-
*
|
|
679
|
-
* Envoie une demande pour rejoindre l'organisation en tant qu'administrateur.
|
|
680
|
-
* L'action est soumise à validation par un administrateur existant.
|
|
681
|
-
*/
|
|
682
|
-
override async requestToJoinAdmin() {
|
|
683
|
-
return super.requestToJoinAdmin();
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* {@inheritDoc BaseEntity#acceptInvitation}
|
|
688
|
-
*
|
|
689
|
-
* Accepte une invitation à rejoindre l'organisation.
|
|
690
|
-
* Cette action valide un lien en attente avec l'option `isInviting`.
|
|
691
|
-
*/
|
|
692
|
-
override async acceptInvitation() {
|
|
693
|
-
return super.acceptInvitation();
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* {@inheritDoc BaseEntity#requestPromoteToAdmin}
|
|
698
|
-
*
|
|
699
|
-
* Envoie une demande de promotion en tant qu'administrateur de l'organisation.
|
|
700
|
-
* L'utilisateur doit déjà être membre de l'organisation.
|
|
701
|
-
*/
|
|
702
|
-
override requestPromoteToAdmin() {
|
|
703
|
-
return super.requestPromoteToAdmin();
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* {@inheritDoc BaseEntity#leave}
|
|
708
|
-
*
|
|
709
|
-
* Quitte l'organisation, que ce soit en tant que membre ou administrateur.
|
|
710
|
-
* Cette action supprime le lien entre l'utilisateur et l'organisation.
|
|
711
|
-
*/
|
|
712
|
-
override async leave() {
|
|
713
|
-
return super.leave();
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* {@inheritDoc BaseEntity#follow}
|
|
718
|
-
*
|
|
719
|
-
* Suivre une organisation.
|
|
720
|
-
* Cette action permet à l'utilisateur de suivre l'organisation.
|
|
721
|
-
*/
|
|
722
|
-
override async follow() {
|
|
723
|
-
return super.follow();
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* {@inheritDoc BaseEntity#unfollow}
|
|
728
|
-
*
|
|
729
|
-
* Se désabonne d'une organisation.
|
|
730
|
-
*/
|
|
731
|
-
override async unfollow() {
|
|
732
|
-
return super.unfollow();
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
/**
|
|
736
|
-
* ───────────────────────────────
|
|
737
|
-
* costum
|
|
738
|
-
* ───────────────────────────────
|
|
739
|
-
*/
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* {@inheritDoc BaseEntity#getCostumJson}
|
|
743
|
-
*
|
|
744
|
-
* Récupère le JSON personnalisé de l'organisation.
|
|
745
|
-
*/
|
|
746
|
-
override async getCostumJson() {
|
|
747
|
-
return super.getCostumJson();
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* {@inheritDoc BaseEntity#searchCostum}
|
|
752
|
-
*
|
|
753
|
-
* Cette surcharge précise que la recherche est faite dans le contexte de l'organisation.
|
|
754
|
-
*/
|
|
755
|
-
override async searchCostum(
|
|
756
|
-
data: Parameters<BaseEntity<OrganizationItemNormalized>["searchCostum"]>[0],
|
|
757
|
-
options?: Parameters<BaseEntity<OrganizationItemNormalized>["searchCostum"]>[1]
|
|
758
|
-
) {
|
|
759
|
-
return super.searchCostum(data, options);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* {@inheritDoc BaseEntity#coformAnswersSearch}
|
|
764
|
-
*
|
|
765
|
-
* Cette méthode est redéfinie ici pour fournir des types spécifiques à l'entité Answer.
|
|
766
|
-
*/
|
|
767
|
-
override async coformAnswersSearch(data: Parameters<BaseEntity<OrganizationItemNormalized>["coformAnswersSearch"]>[0]) {
|
|
768
|
-
return super.coformAnswersSearch(data);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
}
|