need4deed-sdk 0.0.195 → 0.0.197

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/README.md CHANGED
@@ -7,3 +7,11 @@ Shared types for need4deed.org
7
7
  `TranslationFieldsByEntity` exports the registered translation fields for each entity. Backend registry validation can use this map to keep accepted fields aligned with the SDK.
8
8
 
9
9
  Opportunity translation endpoints use `info` for the field exposed as `description` by `ApiOpportunityGet` and `ApiOpportunityPatch`. Translation requests must use `info`; ordinary opportunity requests use `description`.
10
+
11
+ ## District aggregate contract
12
+
13
+ District aggregate responses include every configured district, including
14
+ districts with a count of zero. Volunteers are placed and counted in the
15
+ district of their home postcode, not their preferred districts. Each volunteer
16
+ is counted once. Aggregate requests use the same profile-specific `filter`
17
+ types as district marker requests.
@@ -0,0 +1,17 @@
1
+ import { ApiAgentDistrictFilters, ApiDistrictMarkerFilters, ApiOpportunityDistrictFilters, ApiVolunteerDistrictFilters } from "./district-marker";
2
+ export type ApiDistrictAggregateDistrict = {
3
+ districtId: number;
4
+ count: number;
5
+ };
6
+ export type ApiDistrictAggregateQuery<TFilters = ApiDistrictMarkerFilters> = {
7
+ filter?: TFilters;
8
+ };
9
+ export type ApiAgentDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiAgentDistrictFilters>;
10
+ export type ApiOpportunityDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiOpportunityDistrictFilters>;
11
+ export type ApiVolunteerDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiVolunteerDistrictFilters>;
12
+ export type ApiDistrictAggregate = {
13
+ districts: ApiDistrictAggregateDistrict[];
14
+ unassignedBerlin: number;
15
+ outsideBerlin: number;
16
+ remote: number;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ import { EntityTableName, Id, Lang } from "../core";
2
+ import { AgentType } from "./agent";
3
+ import { ApiLanguage } from "./language";
4
+ import { District } from "./location";
5
+ import { ApiAvailability } from "./time";
6
+ import { VolunteerType } from "./volunteer";
7
+ export declare const apiDistrictMarkerMaxEntities = 500;
8
+ export type ApiDistrictMarkerFilterValue = string | number | boolean | Array<string | number>;
9
+ export type ApiAgentDistrictFilters = Partial<Record<"type" | "status" | "engagementStatus" | "services" | "volunteerSearch", ApiDistrictMarkerFilterValue>>;
10
+ export type ApiOpportunityDistrictFilters = Partial<Record<"type" | "status" | "activity" | "skill" | "match" | "agentId" | "language" | "availability", ApiDistrictMarkerFilterValue>>;
11
+ export type ApiVolunteerDistrictFilters = Partial<Record<"type" | "language" | "activity" | "skill" | "availability" | "engagement" | "match", ApiDistrictMarkerFilterValue>>;
12
+ export type ApiDistrictMarkerFilters = ApiAgentDistrictFilters | ApiOpportunityDistrictFilters | ApiVolunteerDistrictFilters;
13
+ export type ApiDistrictMarkerQuery<TFilters = ApiDistrictMarkerFilters> = {
14
+ districtId: number;
15
+ language: Lang;
16
+ filter?: TFilters;
17
+ };
18
+ export type ApiAgentDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiAgentDistrictFilters>;
19
+ export type ApiOpportunityDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiOpportunityDistrictFilters>;
20
+ export type ApiVolunteerDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiVolunteerDistrictFilters>;
21
+ export type ApiDistrictMarkerChild = {
22
+ id: Id;
23
+ title: string;
24
+ languages?: ApiLanguage[];
25
+ availability?: ApiAvailability[];
26
+ type?: AgentType;
27
+ statusTypes?: VolunteerType[];
28
+ district?: District;
29
+ };
30
+ export type ApiDistrictMarker = {
31
+ lat: number | null;
32
+ lon: number | null;
33
+ districtId: number;
34
+ children: Array<ApiDistrictMarkerChild>;
35
+ entity: EntityTableName.AGENT | EntityTableName.OPPORTUNITY | EntityTableName.VOLUNTEER;
36
+ };
37
+ export type ApiDistrictMarkerGet = {
38
+ markers: ApiDistrictMarker[];
39
+ total: number;
40
+ maxEntities: number;
41
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiDistrictMarkerMaxEntities = void 0;
4
+ exports.apiDistrictMarkerMaxEntities = 500;
@@ -5,7 +5,9 @@ export * from "./appreciation";
5
5
  export * from "./comment";
6
6
  export * from "./common";
7
7
  export * from "./communication";
8
+ export * from "./district-aggregate";
8
9
  export * from "./district-geometry";
10
+ export * from "./district-marker";
9
11
  export * from "./document";
10
12
  export * from "./event";
11
13
  export * from "./language";
@@ -21,7 +21,9 @@ __exportStar(require("./appreciation"), exports);
21
21
  __exportStar(require("./comment"), exports);
22
22
  __exportStar(require("./common"), exports);
23
23
  __exportStar(require("./communication"), exports);
24
+ __exportStar(require("./district-aggregate"), exports);
24
25
  __exportStar(require("./district-geometry"), exports);
26
+ __exportStar(require("./district-marker"), exports);
25
27
  __exportStar(require("./document"), exports);
26
28
  __exportStar(require("./event"), exports);
27
29
  __exportStar(require("./language"), exports);
@@ -125,6 +125,7 @@ export interface OpportunityCreateFormDataProps {
125
125
  accomp_information?: string;
126
126
  accomp_translation?: `${TranslatedIntoType}`;
127
127
  districtIds?: number[];
128
+ address?: ApiOpportunityAddress;
128
129
  languageIds: number[];
129
130
  activityIds: number[];
130
131
  skillIds: number[];
@@ -138,6 +139,11 @@ export interface OpportunityCreateFormDataProps {
138
139
  language: `${Lang}`;
139
140
  }
140
141
  export type OpportunityFormDataWithAgentSubmitter = VoidableUndefined<OpportunityCreateFormDataProps>;
142
+ export interface ApiOpportunityAddress {
143
+ street: string;
144
+ postcode: string;
145
+ city: string;
146
+ }
141
147
  export interface ApiOpportunityAgent {
142
148
  id: number;
143
149
  type: AgentType;
@@ -189,6 +195,7 @@ export interface ApiOpportunityGet extends ApiOpportunityGetList {
189
195
  time: string;
190
196
  };
191
197
  myMatchStatus?: OpportunityVolunteerStatusType | null;
198
+ address?: ApiOpportunityAddress | null;
192
199
  }
193
200
  export type ApiOpportunityLean = Omit<ApiOpportunityGet, "comments">;
194
201
  export type ApiOpportunityPatch = VoidableProps<{
@@ -215,6 +222,7 @@ export type ApiOpportunityPatch = VoidableProps<{
215
222
  name?: string;
216
223
  };
217
224
  accompanyingDetails: ApiOpportunityAccompanyingDetails;
225
+ address: ApiOpportunityAddress;
218
226
  }> & {
219
227
  originalLanguage?: Lang;
220
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "need4deed-sdk",
3
- "version": "0.0.195",
3
+ "version": "0.0.197",
4
4
  "description": "Need4Deed.org SDK",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",