@communecter/cocolight-api-client 1.0.154 → 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 +24 -0
- package/types/api/EndpointApi.d.ts +4 -4
- package/types/api/EndpointApi.types.d.ts +3 -3
- 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 -6338
- 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/Project.ts
DELETED
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import { ApiError } from "../error.js";
|
|
2
|
-
import { BaseEntity } from "./BaseEntity.js";
|
|
3
|
-
import { createSocialTransform, transformEntityRefs } from "../types/transforms.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import type { Action } from "./Action.js";
|
|
7
|
-
import type { PaginatorPage, PaginatorState } from "./BaseEntity.js";
|
|
8
|
-
import type { AddProjectData, GetContributorsAdminData, GetContributorsNoAdminData } from "./EndpointApi.types.js";
|
|
9
|
-
import type { Organization } from "./Organization.js";
|
|
10
|
-
import type { User } from "./User.js";
|
|
11
|
-
import type { ProjectTransforms } from "../types/transforms.js";
|
|
12
|
-
|
|
13
|
-
type ProjectItemNormalized = import("./serverDataType/Project.js").ProjectItemNormalized;
|
|
14
|
-
|
|
15
|
-
export class Project extends BaseEntity<ProjectItemNormalized> {
|
|
16
|
-
static override entityType = "projects";
|
|
17
|
-
|
|
18
|
-
static override entityTag = "Project";
|
|
19
|
-
|
|
20
|
-
/** Bloc de création où injecter les champs costum (CostumScope). */
|
|
21
|
-
static override COSTUM_ADD_CONSTANT = "ADD_PROJECT";
|
|
22
|
-
|
|
23
|
-
static override SCHEMA_CONSTANTS: string[] = [
|
|
24
|
-
"ADD_PROJECT",
|
|
25
|
-
"UPDATE_BLOCK_DESCRIPTION",
|
|
26
|
-
"UPDATE_BLOCK_INFO",
|
|
27
|
-
"UPDATE_BLOCK_SOCIAL",
|
|
28
|
-
"UPDATE_BLOCK_LOCALITY",
|
|
29
|
-
"UPDATE_BLOCK_SLUG",
|
|
30
|
-
"PROFIL_IMAGE"
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
static ADD_BLOCKS = new Map([
|
|
34
|
-
["ADD_PROJECT", "addProject"],
|
|
35
|
-
["PROFIL_IMAGE", "updateImageProfil"]
|
|
36
|
-
] as const);
|
|
37
|
-
|
|
38
|
-
static UPDATE_BLOCKS = new Map([
|
|
39
|
-
["UPDATE_BLOCK_DESCRIPTION", "updateDescription"],
|
|
40
|
-
["UPDATE_BLOCK_SOCIAL", "updateSocial"],
|
|
41
|
-
["UPDATE_BLOCK_LOCALITY", "updateLocality"],
|
|
42
|
-
["UPDATE_BLOCK_INFO", "updateInfo"],
|
|
43
|
-
["UPDATE_BLOCK_SLUG", "updateSlug"],
|
|
44
|
-
["PROFIL_IMAGE", "updateImageProfil"]
|
|
45
|
-
] as const);
|
|
46
|
-
|
|
47
|
-
override defaultFields: Record<string, any> = {
|
|
48
|
-
typeElement: this.getEntityType()
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
override removeFields: string[] = [
|
|
52
|
-
"typeElement"
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
// links.contributors.${this.userId}.isAdmin === true
|
|
56
|
-
override transforms: ProjectTransforms = {
|
|
57
|
-
github: createSocialTransform("github"),
|
|
58
|
-
gitlab: createSocialTransform("gitlab"),
|
|
59
|
-
facebook: createSocialTransform("facebook"),
|
|
60
|
-
twitter: createSocialTransform("twitter"),
|
|
61
|
-
instagram: createSocialTransform("instagram"),
|
|
62
|
-
diaspora: createSocialTransform("diaspora"),
|
|
63
|
-
mastodon: createSocialTransform("mastodon"),
|
|
64
|
-
telegram: createSocialTransform("telegram"),
|
|
65
|
-
signal: createSocialTransform("signal"),
|
|
66
|
-
parent: transformEntityRefs
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Transforme les Answer docs imbriqués dans `data.answers` (renvoyé par /costum/navigator/gettl)
|
|
71
|
-
* en instances d'entité Answer. Voir `Organization._transformServerData` pour le même pattern.
|
|
72
|
-
*
|
|
73
|
-
* @protected
|
|
74
|
-
*/
|
|
75
|
-
protected override _transformServerData(data: ProjectItemNormalized): ProjectItemNormalized {
|
|
76
|
-
const rawAnswers = (data as Record<string, unknown>).answers as Record<string, unknown[]> | undefined;
|
|
77
|
-
if (rawAnswers && typeof rawAnswers === "object") {
|
|
78
|
-
const linkedAnswers: Record<string, unknown[]> = {};
|
|
79
|
-
for (const [formId, docs] of Object.entries(rawAnswers)) {
|
|
80
|
-
// Le backend renvoie tantôt un tableau `[doc, ...]`, tantôt une map indexée
|
|
81
|
-
// par id `{ answerId: doc }`. On normalise vers un tableau dans les deux cas.
|
|
82
|
-
const list = Array.isArray(docs)
|
|
83
|
-
? docs
|
|
84
|
-
: (docs && typeof docs === "object" ? Object.values(docs) : []);
|
|
85
|
-
linkedAnswers[formId] = list.map((doc) =>
|
|
86
|
-
doc && typeof doc === "object"
|
|
87
|
-
? this._linkEntity("answers", { ...(doc as Record<string, unknown>), collection: "answers" })
|
|
88
|
-
: doc
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
(data as Record<string, unknown>).answers = linkedAnswers;
|
|
92
|
-
}
|
|
93
|
-
return data;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
override _add = async (payload: Record<string, any>): Promise<void> => {
|
|
97
|
-
if (!this._calledFromSave) {
|
|
98
|
-
throw new ApiError("utilisation invalide de _add, utilisez save", 400);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
payload.id = this._newId?.();
|
|
102
|
-
if (payload.slug) delete payload.slug;
|
|
103
|
-
|
|
104
|
-
for (const [constant, methodName] of Array.from(Project.ADD_BLOCKS)) {
|
|
105
|
-
const blockData = this._extractChangedFieldsFromSchema(
|
|
106
|
-
this.apiClient,
|
|
107
|
-
constant,
|
|
108
|
-
{ ...payload, ...this.defaultFields },
|
|
109
|
-
() => {}
|
|
110
|
-
);
|
|
111
|
-
if (blockData && Object.keys(blockData).length > 0) {
|
|
112
|
-
const data = await this._invokeBlockMethod(Project.ADD_BLOCKS, methodName, blockData);
|
|
113
|
-
if (!this.id && data?.map?.id) {
|
|
114
|
-
this._draftData.id = data.map.id;
|
|
115
|
-
this._draftData.slug = data.map.slug;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
override _update = async (payload: Record<string, any>): Promise<boolean> => {
|
|
122
|
-
if(!this.isAdmin()){
|
|
123
|
-
throw new ApiError("Vous n'avez pas les droits pour modifier ce projet", 403);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (!this._calledFromSave) {
|
|
127
|
-
throw new ApiError("utilisation invalide de _update, utilisez save", 400);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Entité costum-scopée : tout l'UPDATE part en UN `element/save` (pendant de l'ADD, hooks costum). cf. BaseEntity.
|
|
131
|
-
if (this._costumCtx) return this._saveCostumViaElementSave(payload);
|
|
132
|
-
|
|
133
|
-
if (payload.id) delete payload.id;
|
|
134
|
-
let hasChanged = false;
|
|
135
|
-
|
|
136
|
-
for (const [constant, methodName] of Array.from(Project.UPDATE_BLOCKS)) {
|
|
137
|
-
const blockData = this._extractChangedFieldsFromSchema(
|
|
138
|
-
this.apiClient,
|
|
139
|
-
constant,
|
|
140
|
-
{ ...payload, ...this.defaultFields },
|
|
141
|
-
() => this.initialDraftData,
|
|
142
|
-
this.removeFields
|
|
143
|
-
);
|
|
144
|
-
if (blockData && Object.keys(blockData).length > 0) {
|
|
145
|
-
await this._invokeBlockMethod(Project.UPDATE_BLOCKS, methodName, blockData);
|
|
146
|
-
hasChanged = true;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return hasChanged;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Ajoute un projet.
|
|
155
|
-
*
|
|
156
|
-
* @param data - Données du projet à ajouter.
|
|
157
|
-
* @returns - Résultat de l'ajout du projet.
|
|
158
|
-
* @throws {ApiError} - Si l'utilisateur n'est pas connecté ou si l'entité n'est pas enregistrée.
|
|
159
|
-
*/
|
|
160
|
-
async addProject(data: Partial<AddProjectData> = {}): Promise<unknown> {
|
|
161
|
-
|
|
162
|
-
// Si le parent direct n'est pas l'utilisateur connecté (ex: création via une org),
|
|
163
|
-
// on injecte le parent dans le payload. Sans ça, le default schéma `{ "@userId": ... }`
|
|
164
|
-
// pose me comme parent — ce qui est faux pour `me.org().project()`.
|
|
165
|
-
// NB: this.isMe est trompeur ici car userContext propage jusqu'au User connecté
|
|
166
|
-
// (donc isMe=true même quand le parent direct est une org).
|
|
167
|
-
// Si le caller fournit déjà `data.parent`, on respecte sa valeur (pas de merge automatique).
|
|
168
|
-
if (this.parent && this.parent.id && this.parent.id !== this.userId && !data.parent) {
|
|
169
|
-
data.parent = {};
|
|
170
|
-
data.parent[`${this.parent.id}`] = {
|
|
171
|
-
type: this.parent.getEntityType(),
|
|
172
|
-
name: (this.parent as any).name
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return this.callIsConnected(() => this.endpointApi.addProject(data as AddProjectData));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Supprime ce projet via `DELETE_ELEMENT` (`type=projects`).
|
|
181
|
-
*
|
|
182
|
-
* **Garde** : auteur (`serverData.creator`) OU administrateur — direct
|
|
183
|
-
* (`links.projects[id].isAdmin`) ou de l'organisation parente (via
|
|
184
|
-
* `serverData.parent` × hiérarchie). cf. {@link BaseEntity#_deleteViaElement}.
|
|
185
|
-
*
|
|
186
|
-
* ⚠️ **Destructif** : supprime le projet et potentiellement ses rattachements
|
|
187
|
-
* (actions/events/membres) côté serveur. À utiliser avec précaution.
|
|
188
|
-
*
|
|
189
|
-
* Après succès : données vidées + `_isDeleted = true`.
|
|
190
|
-
*
|
|
191
|
-
* @param reason - Raison transmise au backend (audit). Défaut `"delete project"`.
|
|
192
|
-
* @throws {ApiError} 400 si le projet n'a pas d'id.
|
|
193
|
-
* @throws {ApiError} 403 si ni auteur ni admin.
|
|
194
|
-
*/
|
|
195
|
-
async delete(reason: string = "delete project"): Promise<void> {
|
|
196
|
-
await this._deleteViaElement(this.getEntityType(), reason);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
override async getOrganizations(): Promise<never> {
|
|
201
|
-
throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`, 501);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* {@inheritDoc BaseEntity#getProjects}
|
|
206
|
-
*
|
|
207
|
-
* Récupère les projets du projet.
|
|
208
|
-
*/
|
|
209
|
-
override async getProjects(data: Parameters<BaseEntity<ProjectItemNormalized>["getProjects"]>[0] = {}) {
|
|
210
|
-
return super.getProjects(data);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* {@inheritDoc BaseEntity#getEvents}
|
|
216
|
-
*
|
|
217
|
-
* Récupère les événements d'un projet.
|
|
218
|
-
*/
|
|
219
|
-
override async getEvents(data: Parameters<BaseEntity<ProjectItemNormalized>["getEvents"]>[0] = {}) {
|
|
220
|
-
return super.getEvents(data);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* {@inheritDoc BaseEntity#getPois}
|
|
225
|
-
*
|
|
226
|
-
* Récupère les points d'intérêt d'un projet.
|
|
227
|
-
*/
|
|
228
|
-
override async getPois(data: Parameters<BaseEntity<ProjectItemNormalized>["getPois"]>[0] = {}) {
|
|
229
|
-
return super.getPois(data);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* {@inheritDoc BaseEntity#getBadgesIssuer}
|
|
234
|
-
*
|
|
235
|
-
* Récupère les émetteurs de badges d'un projet.
|
|
236
|
-
*/
|
|
237
|
-
override async getBadgesIssuer(data: Parameters<BaseEntity<ProjectItemNormalized>["getBadgesIssuer"]>[0] = {}) {
|
|
238
|
-
return super.getBadgesIssuer(data);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* {@inheritDoc BaseEntity#getNews}
|
|
243
|
-
*
|
|
244
|
-
* Récupère les actualités d'un projet.
|
|
245
|
-
*/
|
|
246
|
-
override async getNews(data: Parameters<BaseEntity<ProjectItemNormalized>["getNews"]>[0] = {}) {
|
|
247
|
-
return super.getNews(data);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* {@inheritDoc BaseEntity#getSubscribers}
|
|
252
|
-
*
|
|
253
|
-
* Récupère les abonnés d'un projet.
|
|
254
|
-
*/
|
|
255
|
-
override async getSubscribers(data: Parameters<BaseEntity<ProjectItemNormalized>["getSubscribers"]>[0] = {}) {
|
|
256
|
-
return super.getSubscribers(data);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Récupérer les contributeurs d'un projet.
|
|
261
|
-
* Constant : GET_CONTRIBUTORS_ADMIN / GET_CONTRIBUTORS_NO_ADMIN
|
|
262
|
-
* @param data - Paramètres (partiels) de recherche/pagination.
|
|
263
|
-
* @param options - Options supplémentaires.
|
|
264
|
-
* @param options.toBeValidated - Indique si les contributeurs doivent être validés.
|
|
265
|
-
* @param options.isAdmin - Indique si l'utilisateur est admin.
|
|
266
|
-
* @param options.isInviting - Indique si l'utilisateur est en attente d'invitation.
|
|
267
|
-
* @param options.roles - Liste des rôles à filtrer.
|
|
268
|
-
* @param isNext - Indique si c'est une recherche suivante (pagination).
|
|
269
|
-
* @returns - Un objet contenant le nombre de contributeurs et la liste des contributeurs.
|
|
270
|
-
* @throws {ApiResponseError} - Si une erreur se produit lors de la récupération des contributeurs.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* // Récupérer tous les contributeurs
|
|
274
|
-
* const contributors = await project.getContributors();
|
|
275
|
-
*
|
|
276
|
-
* // Récupérer les contributeurs avec validation en attente
|
|
277
|
-
* const contributorsToBeValidated = await project.getContributors({}, { toBeValidated: true });
|
|
278
|
-
*
|
|
279
|
-
* // Récupérer les contributeurs avec un rôle spécifique
|
|
280
|
-
* const contributorsWithRole = await project.getContributors({}, { roles: ["admin"] });
|
|
281
|
-
*
|
|
282
|
-
* // Récupérer les contributeurs administrateurs
|
|
283
|
-
* const adminContributors = await project.getContributors({}, { isAdmin: true });
|
|
284
|
-
*
|
|
285
|
-
* // Récupérer les contributeurs en attente d'invitation
|
|
286
|
-
* const invitingContributors = await project.getContributors({}, { isInviting: true });
|
|
287
|
-
*
|
|
288
|
-
* // Restreindre la recherche : uniquement les citoyens
|
|
289
|
-
* const onlyCitoyens = await project.getContributors({}, { searchType: "citoyens" });
|
|
290
|
-
*
|
|
291
|
-
* // Restreindre la recherche : uniquement les organisations
|
|
292
|
-
* const onlyOrgas = await project.getContributors({}, { searchType: "organizations" });
|
|
293
|
-
*/
|
|
294
|
-
async getContributors(
|
|
295
|
-
data: Partial<GetContributorsAdminData | GetContributorsNoAdminData> = {},
|
|
296
|
-
options: {
|
|
297
|
-
toBeValidated?: boolean;
|
|
298
|
-
isAdmin?: boolean;
|
|
299
|
-
isAdminPending?: boolean;
|
|
300
|
-
isInviting?: boolean;
|
|
301
|
-
roles?: any[];
|
|
302
|
-
searchType?: "all" | "citoyens" | "organizations";
|
|
303
|
-
restoredState?: PaginatorState;
|
|
304
|
-
} = {}
|
|
305
|
-
): Promise<PaginatorPage<User | Organization>> {
|
|
306
|
-
const allTypes = this._getDefaultFromEndpoint("GET_CONTRIBUTORS_ADMIN", "searchType") as GetContributorsAdminData["searchType"];
|
|
307
|
-
if (options.searchType === "citoyens") {
|
|
308
|
-
data.searchType = ["citoyens"];
|
|
309
|
-
} else if (options.searchType === "organizations") {
|
|
310
|
-
data.searchType = allTypes.filter(t => t !== "citoyens") as GetContributorsAdminData["searchType"];
|
|
311
|
-
} else {
|
|
312
|
-
// "all" ou omis : on initialise explicitement (le paginator exige searchType avant la validation AJV)
|
|
313
|
-
data.searchType = allTypes;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const paginator = this._createPaginatorEngine({
|
|
317
|
-
initialData: data,
|
|
318
|
-
methodName: "getContributors",
|
|
319
|
-
restoredState: options?.restoredState,
|
|
320
|
-
finalizer: async (finalData) => {
|
|
321
|
-
|
|
322
|
-
const { toBeValidated, isAdmin, isInviting, isAdminPending, roles = [] } = options;
|
|
323
|
-
|
|
324
|
-
if(this.isMe){
|
|
325
|
-
finalData.pathParams = { id: this.id };
|
|
326
|
-
// NOTE : dans le schema je crois que si pas de finalData.filters alors le default ce fait avec finalData.pathParams
|
|
327
|
-
// finalData.filters = {
|
|
328
|
-
// [`links.projects.${this.id}`]: { "$exists": true },
|
|
329
|
-
// [`links.projects.${this.id}.toBeValidated`]: { "$exists": false },
|
|
330
|
-
// [`links.projects.${this.id}.isInviting`]: { "$exists": false }
|
|
331
|
-
// };
|
|
332
|
-
finalData.filters = this._buildLinkFilters(this.id, { linkType: "projects", toBeValidated, isAdmin, isAdminPending, isInviting, roles });
|
|
333
|
-
} else {
|
|
334
|
-
delete finalData?.pathParams;
|
|
335
|
-
finalData.filters = this._buildLinkFilters(this.id, { linkType: "projects", toBeValidated: false, isAdmin, isInviting, roles });
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const fetchFn = this.isMe
|
|
339
|
-
? () => this.callIsMe(() => this.endpointApi.getContributorsAdmin(finalData))
|
|
340
|
-
: () => this.endpointApi.getContributorsNoAdmin(finalData);
|
|
341
|
-
|
|
342
|
-
return fetchFn();
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
return paginator.next() as Promise<PaginatorPage<User | Organization>>;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* {@inheritDoc BaseEntity#getGallery}
|
|
351
|
-
*
|
|
352
|
-
* Récupère la galerie d'un projet.
|
|
353
|
-
*/
|
|
354
|
-
override async getGallery(data: Parameters<BaseEntity<ProjectItemNormalized>["getGallery"]>[0] = {}) {
|
|
355
|
-
return super.getGallery(data);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* {@inheritDoc BaseEntity#searchCostum}
|
|
360
|
-
*
|
|
361
|
-
* Cette surcharge précise que la recherche est faite dans le contexte du projet.
|
|
362
|
-
*/
|
|
363
|
-
override async searchCostum(
|
|
364
|
-
data: Parameters<BaseEntity<ProjectItemNormalized>["searchCostum"]>[0],
|
|
365
|
-
options?: Parameters<BaseEntity<ProjectItemNormalized>["searchCostum"]>[1]
|
|
366
|
-
) {
|
|
367
|
-
return super.searchCostum(data, options);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* {@inheritDoc BaseEntity#project}
|
|
372
|
-
*
|
|
373
|
-
* Crée une instance de projet et récupère son profil si nécessaire.
|
|
374
|
-
*/
|
|
375
|
-
override async project(projectData: Parameters<BaseEntity<ProjectItemNormalized>["project"]>[0] = {}) {
|
|
376
|
-
if(!this.isAdmin()){
|
|
377
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un projet dans ce projet", 403);
|
|
378
|
-
}
|
|
379
|
-
return super.project(projectData);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* {@inheritDoc BaseEntity#poi}
|
|
384
|
-
*
|
|
385
|
-
* Crée une instance de POI et la récupère si nécessaire.
|
|
386
|
-
*/
|
|
387
|
-
override async poi(poiData: Parameters<BaseEntity<ProjectItemNormalized>["poi"]>[0] = {}) {
|
|
388
|
-
if(!this.isAdmin()){
|
|
389
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un POI dans ce projet", 403);
|
|
390
|
-
}
|
|
391
|
-
return super.poi(poiData);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* {@inheritDoc BaseEntity#event}
|
|
396
|
-
*
|
|
397
|
-
* Crée une instance d'événement et la récupère si nécessaire.
|
|
398
|
-
*/
|
|
399
|
-
override async event(eventData: Parameters<BaseEntity<ProjectItemNormalized>["event"]>[0] = {}) {
|
|
400
|
-
if(!this.isAdmin()){
|
|
401
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un événement dans ce projet", 403);
|
|
402
|
-
}
|
|
403
|
-
return super.event(eventData);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* {@inheritDoc BaseEntity#badge}
|
|
408
|
-
*
|
|
409
|
-
* Crée une instance de badge et la récupère si nécessaire.
|
|
410
|
-
*/
|
|
411
|
-
override async badge(badgeData: Parameters<BaseEntity<ProjectItemNormalized>["badge"]>[0] = {}) {
|
|
412
|
-
if(!this.isAdmin()){
|
|
413
|
-
throw new ApiError("Vous n'avez pas les droits pour créer un badge dans ce projet", 403);
|
|
414
|
-
}
|
|
415
|
-
return super.badge(badgeData);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* {@inheritDoc BaseEntity#form}
|
|
421
|
-
*
|
|
422
|
-
* Crée une instance de Form dans le contexte de ce projet : le Form aura
|
|
423
|
-
* `this.parent = Project`, ce qui permet à `form.getAnswers()` de déléguer
|
|
424
|
-
* `coformAnswersSearch` avec le bon costumContext.
|
|
425
|
-
*/
|
|
426
|
-
override async form(formData: Parameters<BaseEntity<ProjectItemNormalized>["form"]>[0] = {}) {
|
|
427
|
-
return super.form(formData);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* {@inheritDoc BaseEntity#news}
|
|
432
|
-
*
|
|
433
|
-
* Crée une instance de news et la récupère si nécessaire.
|
|
434
|
-
*/
|
|
435
|
-
override async news(newsData: Parameters<BaseEntity<ProjectItemNormalized>["news"]>[0] = {}) {
|
|
436
|
-
if(!newsData?.id && !this.isContributor()){
|
|
437
|
-
throw new ApiError("Vous n'avez pas les droits pour créer une news dans ce projet", 403);
|
|
438
|
-
}
|
|
439
|
-
return super.news(newsData);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Vérifie qu'un milestoneId existe dans `serverData.oceco.milestones[]`.
|
|
444
|
-
* Sert à valider une référence avant d'attacher une entité (Action) à un milestone.
|
|
445
|
-
*
|
|
446
|
-
* @param milestoneId - L'ID du milestone à chercher.
|
|
447
|
-
* @returns `true` si trouvé, `false` sinon (y compris si oceco/milestones absents).
|
|
448
|
-
*/
|
|
449
|
-
hasMilestone(milestoneId: string): boolean {
|
|
450
|
-
if (typeof milestoneId !== "string" || milestoneId.length === 0) return false;
|
|
451
|
-
const milestones = (this.serverData.oceco as { milestones?: Array<{ milestoneId?: string }> } | undefined)?.milestones;
|
|
452
|
-
if (!Array.isArray(milestones)) return false;
|
|
453
|
-
return milestones.some(m => m?.milestoneId === milestoneId);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* {@inheritDoc BaseEntity#action}
|
|
458
|
-
*
|
|
459
|
-
* Crée une instance d'Action liée à ce projet et la récupère si nécessaire.
|
|
460
|
-
*/
|
|
461
|
-
override async action(actionData: Parameters<BaseEntity<ProjectItemNormalized>["action"]>[0] = {}) {
|
|
462
|
-
if(!actionData?.id && !this.isAdmin()){
|
|
463
|
-
throw new ApiError("Vous n'avez pas les droits pour créer une action dans ce projet", 403);
|
|
464
|
-
}
|
|
465
|
-
const entity = await this.entity("actions", actionData);
|
|
466
|
-
return entity as Action;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* ───────────────────────────────
|
|
471
|
-
* Lien utilisateur ↔ projet
|
|
472
|
-
* (rejoindre, valider, quitter, devenir admin)
|
|
473
|
-
* ───────────────────────────────
|
|
474
|
-
*/
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* {@inheritDoc BaseEntity#requestToJoin}
|
|
478
|
-
*
|
|
479
|
-
* Envoie une demande pour rejoindre le projet en tant que contributeur.
|
|
480
|
-
* L'action est soumise à validation par un administrateur du projet.
|
|
481
|
-
*/
|
|
482
|
-
override async requestToJoin() {
|
|
483
|
-
return super.requestToJoin();
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* {@inheritDoc BaseEntity#requestToJoinAdmin}
|
|
488
|
-
*
|
|
489
|
-
* Envoie une demande pour devenir administrateur du projet.
|
|
490
|
-
* L'action est soumise à validation par un administrateur existant.
|
|
491
|
-
*/
|
|
492
|
-
override async requestToJoinAdmin() {
|
|
493
|
-
return super.requestToJoinAdmin();
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* {@inheritDoc BaseEntity#acceptInvitation}
|
|
498
|
-
*
|
|
499
|
-
* Accepte une invitation à rejoindre le projet.
|
|
500
|
-
* Cette action valide un lien en attente avec l'option `isInviting`.
|
|
501
|
-
*/
|
|
502
|
-
override async acceptInvitation() {
|
|
503
|
-
return super.acceptInvitation();
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* {@inheritDoc BaseEntity#requestPromoteToAdmin}
|
|
508
|
-
*
|
|
509
|
-
* Envoie une demande de promotion en tant qu'administrateur du projet.
|
|
510
|
-
* L'utilisateur doit déjà être contributeur du projet.
|
|
511
|
-
*/
|
|
512
|
-
override requestPromoteToAdmin() {
|
|
513
|
-
return super.requestPromoteToAdmin();
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* {@inheritDoc BaseEntity#leave}
|
|
518
|
-
*
|
|
519
|
-
* Quitte le projet, que ce soit en tant que contributeur ou administrateur.
|
|
520
|
-
* Cette action supprime le lien entre l'utilisateur et le projet.
|
|
521
|
-
*/
|
|
522
|
-
override async leave() {
|
|
523
|
-
return super.leave();
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* {@inheritDoc BaseEntity#follow}
|
|
528
|
-
*
|
|
529
|
-
* Suivre un projet.
|
|
530
|
-
* Cette action permet à l'utilisateur de suivre le projet.
|
|
531
|
-
*/
|
|
532
|
-
override async follow() {
|
|
533
|
-
return super.follow();
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* {@inheritDoc BaseEntity#unfollow}
|
|
538
|
-
*
|
|
539
|
-
* Se désabonne d'un projet.
|
|
540
|
-
*/
|
|
541
|
-
override async unfollow() {
|
|
542
|
-
return super.unfollow();
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
}
|