@assemblis/contracts 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +347 -1
- package/dist/schemas/api.d.ts +2450 -0
- package/dist/schemas/base.d.ts +363 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/legacy.d.ts +1276 -0
- package/dist/schemas/utils.d.ts +11 -0
- package/dist/types/api.d.ts +57 -0
- package/dist/types/enums.d.ts +27 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/types.d.ts +5 -0
- package/package.json +1 -1
- package/src/schemas/api.ts +43 -0
- package/src/schemas/base.ts +58 -0
- package/src/schemas/index.ts +2 -0
- package/src/{schemas.ts → schemas/legacy.ts} +70 -88
- package/src/schemas/utils.ts +5 -0
- package/src/{types.ts → types/api.ts} +10 -34
- package/src/types/enums.ts +30 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.ts +6 -0
- package/dist/schemas.d.ts +0 -613
- package/dist/types.d.ts +0 -50
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z, { ZodType } from 'zod';
|
|
2
|
+
export declare const isoDateString: z.ZodISODateTime;
|
|
3
|
+
export declare const maybe: <T extends ZodType<unknown>>(
|
|
4
|
+
_: T
|
|
5
|
+
) => z.ZodPipe<
|
|
6
|
+
z.ZodOptional<z.ZodNullable<T>>,
|
|
7
|
+
z.ZodTransform<
|
|
8
|
+
Awaited<NonNullable<z.core.output<T>>> | null,
|
|
9
|
+
z.core.output<T> | null | undefined
|
|
10
|
+
>
|
|
11
|
+
>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
AssembliesListSchema,
|
|
4
|
+
AssemblyDetailSchema,
|
|
5
|
+
AssemblyOverviewSchema,
|
|
6
|
+
FeedbackSchema,
|
|
7
|
+
LogSchema,
|
|
8
|
+
PatchAccountReportsIdPublishSchema,
|
|
9
|
+
PinListSchema,
|
|
10
|
+
PinSchema,
|
|
11
|
+
PostAccountReportsIdCoverImageSchema,
|
|
12
|
+
RegisterSchema,
|
|
13
|
+
SurveyResponseSchema,
|
|
14
|
+
SurveySchema
|
|
15
|
+
} from '../schemas';
|
|
16
|
+
export type PublishReportPayload = z.infer<
|
|
17
|
+
(typeof PatchAccountReportsIdPublishSchema)['payload']
|
|
18
|
+
>;
|
|
19
|
+
export type ImageMetadataPayload = z.infer<
|
|
20
|
+
(typeof PostAccountReportsIdCoverImageSchema)['payload']
|
|
21
|
+
>;
|
|
22
|
+
export type AssemblyDetailPayload = z.infer<
|
|
23
|
+
(typeof AssemblyDetailSchema)['payload']
|
|
24
|
+
>;
|
|
25
|
+
export type AssemblyOverviewPayload = z.infer<
|
|
26
|
+
(typeof AssemblyOverviewSchema)['payload']
|
|
27
|
+
>;
|
|
28
|
+
export type AssembliesListPayload = z.infer<
|
|
29
|
+
(typeof AssembliesListSchema)['payload']
|
|
30
|
+
>;
|
|
31
|
+
export type FeedbackPayload = z.infer<(typeof FeedbackSchema)['payload']>;
|
|
32
|
+
export type LogPayload = z.infer<(typeof LogSchema)['payload']>;
|
|
33
|
+
export type PinPayload = z.infer<(typeof PinSchema)['payload']>;
|
|
34
|
+
export type PinListPayload = z.infer<(typeof PinListSchema)['payload']>;
|
|
35
|
+
export type RegisterPayload = z.infer<(typeof RegisterSchema)['payload']>;
|
|
36
|
+
export type SurveyPayload = z.infer<(typeof SurveySchema)['payload']>;
|
|
37
|
+
export type SurveyResponsePayload = z.infer<
|
|
38
|
+
(typeof SurveyResponseSchema)['payload']
|
|
39
|
+
>;
|
|
40
|
+
export type AssemblyDetailResponse = z.infer<
|
|
41
|
+
(typeof AssemblyDetailSchema)['response']
|
|
42
|
+
>;
|
|
43
|
+
export type AssemblyOverviewResponse = z.infer<
|
|
44
|
+
(typeof AssemblyOverviewSchema)['response']
|
|
45
|
+
>;
|
|
46
|
+
export type AssembliesListResponse = z.infer<
|
|
47
|
+
(typeof AssembliesListSchema)['response']
|
|
48
|
+
>;
|
|
49
|
+
export type FeedbackResponse = z.infer<(typeof FeedbackSchema)['response']>;
|
|
50
|
+
export type LogResponse = z.infer<(typeof LogSchema)['response']>;
|
|
51
|
+
export type PinResponse = z.infer<(typeof PinSchema)['response']>;
|
|
52
|
+
export type PinListResponse = z.infer<(typeof PinListSchema)['response']>;
|
|
53
|
+
export type RegisterResponse = z.infer<(typeof RegisterSchema)['response']>;
|
|
54
|
+
export type SurveyResponse = z.infer<(typeof SurveySchema)['response']>;
|
|
55
|
+
export type SurveyResponseResponse = z.infer<
|
|
56
|
+
(typeof SurveyResponseSchema)['response']
|
|
57
|
+
>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum ApiRestMethod {
|
|
2
|
+
GET = 'GET',
|
|
3
|
+
POST = 'POST',
|
|
4
|
+
PUT = 'PUT',
|
|
5
|
+
PATCH = 'PATCH'
|
|
6
|
+
}
|
|
7
|
+
export declare enum ApiRouteParameter {
|
|
8
|
+
ID = ':ID',
|
|
9
|
+
NAME = ':NAME'
|
|
10
|
+
}
|
|
11
|
+
export declare enum ApiEndpoint {
|
|
12
|
+
ACCOUNT_REPORTS = '/account/reports',
|
|
13
|
+
ASSEMBLIES = '/assemblies',
|
|
14
|
+
FEEDBACK = '/feedback',
|
|
15
|
+
INTEREST_ASSEMBLIS = '/interest/assemblis',
|
|
16
|
+
INTEREST_MUTIRAO = '/interest/mutirao',
|
|
17
|
+
LOGS = '/logs',
|
|
18
|
+
PINS = '/pins',
|
|
19
|
+
SURVEYS = '/surveys',
|
|
20
|
+
SURVEY_RESPONSES = '/assemblies/:ID/survey-responses/:NAME'
|
|
21
|
+
}
|
|
22
|
+
export declare enum SurveyName {
|
|
23
|
+
DELIBERATION = 'deliberation',
|
|
24
|
+
DEMOGRAPHIC_DATA = 'demographic-data',
|
|
25
|
+
PRE_ASSEMBLY = 'pre-assembly',
|
|
26
|
+
POST_ASSEMBLY = 'post-assembly'
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { ReportSchema, UserSchema, ReportContentSchema } from '../schemas/base';
|
|
3
|
+
export type Report = z.infer<typeof ReportSchema>;
|
|
4
|
+
export type ReportContent = z.infer<typeof ReportContentSchema>;
|
|
5
|
+
export type User = z.infer<typeof UserSchema>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { ImageSchema, ReportContentSchema, ReportSchema } from './base';
|
|
3
|
+
import { isoDateString, maybe } from './utils';
|
|
4
|
+
|
|
5
|
+
export const GetAccountReportsSchema = {
|
|
6
|
+
payload: z.never(),
|
|
7
|
+
response: z.object({ reports: ReportSchema.array() })
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const GetAccountReportsIdSchema = {
|
|
11
|
+
payload: z.never(),
|
|
12
|
+
response: ReportSchema
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const PostAccountReportsSchema = {
|
|
16
|
+
payload: maybe(ReportContentSchema.omit({ cover_image_id: true })),
|
|
17
|
+
response: ReportSchema
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const PutAccountReportsIdContentSchema = {
|
|
21
|
+
payload: ReportContentSchema.omit({ cover_image_id: true }),
|
|
22
|
+
response: ReportSchema
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const PatchAccountReportsIdDiscardSchema = {
|
|
26
|
+
payload: z.never(),
|
|
27
|
+
response: maybe(ReportSchema)
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const PatchAccountReportsIdPublishSchema = {
|
|
31
|
+
payload: z.object({ published_at: isoDateString }),
|
|
32
|
+
response: ReportSchema
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const PatchAccountReportsIdUnpublishSchema = {
|
|
36
|
+
payload: z.never(),
|
|
37
|
+
response: ReportSchema
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const PostAccountReportsIdCoverImageSchema = {
|
|
41
|
+
payload: ImageSchema.pick({ alt: true }),
|
|
42
|
+
response: ReportSchema
|
|
43
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Base type schemas
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
import { isoDateString, maybe } from './utils';
|
|
5
|
+
|
|
6
|
+
export const ImageSchema = z.object({
|
|
7
|
+
id: z.uuid(),
|
|
8
|
+
created_at: isoDateString,
|
|
9
|
+
updated_at: isoDateString,
|
|
10
|
+
uri: z.string(),
|
|
11
|
+
alt: z.string(),
|
|
12
|
+
src: z.string(),
|
|
13
|
+
sizes: z.string(),
|
|
14
|
+
srcset: z.string()
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const OptionSchema = z.object({
|
|
18
|
+
label: z.string(),
|
|
19
|
+
value: z.coerce.number().int()
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const ReportContentSchema = z.object({
|
|
23
|
+
published_at: maybe(isoDateString),
|
|
24
|
+
title: maybe(z.string()),
|
|
25
|
+
description: maybe(z.string()),
|
|
26
|
+
location: maybe(z.string()),
|
|
27
|
+
outputs: maybe(z.string().array()),
|
|
28
|
+
initiation_type: maybe(z.string()),
|
|
29
|
+
recruitment_method: maybe(z.string()),
|
|
30
|
+
recruitment_description: maybe(z.string()),
|
|
31
|
+
participant_count: maybe(z.int()),
|
|
32
|
+
organiser_reflections: maybe(z.string()),
|
|
33
|
+
organiser_report_url: maybe(z.string()),
|
|
34
|
+
location_details: maybe(z.string()),
|
|
35
|
+
date: maybe(z.string()),
|
|
36
|
+
duration: maybe(z.int()),
|
|
37
|
+
contact_information_url: maybe(z.string()),
|
|
38
|
+
cover_image_id: maybe(z.string())
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const ReportSchema = z.object({
|
|
42
|
+
id: z.uuid(),
|
|
43
|
+
created_at: isoDateString,
|
|
44
|
+
updated_at: isoDateString,
|
|
45
|
+
published_at: maybe(isoDateString),
|
|
46
|
+
viewer_password: z.string(),
|
|
47
|
+
draft_content: maybe(ReportContentSchema),
|
|
48
|
+
published_content: maybe(ReportContentSchema),
|
|
49
|
+
media: z.object({ images: ImageSchema.array() })
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const UserSchema = z.object({
|
|
53
|
+
id: z.uuid(),
|
|
54
|
+
created_at: isoDateString,
|
|
55
|
+
updated_at: isoDateString,
|
|
56
|
+
sub: z.string(),
|
|
57
|
+
is_mutirao: z.boolean()
|
|
58
|
+
});
|
|
@@ -1,24 +1,43 @@
|
|
|
1
|
-
import z
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { isoDateString, maybe } from './utils';
|
|
3
|
+
import { OptionSchema } from './base';
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
+
export const FeedbackSchema = {
|
|
6
|
+
payload: z.object({
|
|
7
|
+
route: z.string(),
|
|
8
|
+
text: z.string(),
|
|
9
|
+
metadata: z.unknown()
|
|
10
|
+
}),
|
|
11
|
+
response: z.string()
|
|
12
|
+
};
|
|
5
13
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
export const LogSchema = {
|
|
15
|
+
payload: z.object({
|
|
16
|
+
message: z.string().optional(),
|
|
17
|
+
data: z.record(z.string(), z.string().optional()).optional(),
|
|
18
|
+
metadata: z.object({
|
|
19
|
+
origin: z.string(),
|
|
20
|
+
route: z.string(),
|
|
21
|
+
status: z.number()
|
|
22
|
+
})
|
|
23
|
+
}),
|
|
24
|
+
response: z.string()
|
|
25
|
+
};
|
|
10
26
|
|
|
11
|
-
export const
|
|
12
|
-
payload: z.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
27
|
+
export const RegisterSchema = {
|
|
28
|
+
payload: z.object({
|
|
29
|
+
type: z.literal('user.created'),
|
|
30
|
+
object: z.literal('event'),
|
|
31
|
+
data: z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
email_addresses: z.object({ email_address: z.string() }).array()
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
response: z.string()
|
|
20
37
|
};
|
|
21
38
|
|
|
39
|
+
/** Deprecated */
|
|
40
|
+
|
|
22
41
|
// Surveys
|
|
23
42
|
const SurveyQuestionSchema = z.object({
|
|
24
43
|
id: z.uuid(),
|
|
@@ -29,8 +48,8 @@ export const SurveySchema = {
|
|
|
29
48
|
payload: z.undefined(),
|
|
30
49
|
response: z.object({
|
|
31
50
|
id: z.uuid(),
|
|
32
|
-
created_at:
|
|
33
|
-
updated_at:
|
|
51
|
+
created_at: isoDateString,
|
|
52
|
+
updated_at: isoDateString,
|
|
34
53
|
name: z.string(),
|
|
35
54
|
sections: z
|
|
36
55
|
.object({
|
|
@@ -80,7 +99,7 @@ const TaskSchema = z.object({
|
|
|
80
99
|
|
|
81
100
|
// Assembly Overviews
|
|
82
101
|
const BaseAssemblyOverviewSchema = z.object({
|
|
83
|
-
published_at: maybe(
|
|
102
|
+
published_at: maybe(isoDateString),
|
|
84
103
|
name: z.string(),
|
|
85
104
|
about: maybe(z.string()),
|
|
86
105
|
topics: z.string().array(),
|
|
@@ -91,8 +110,8 @@ export const AssemblyOverviewSchema = {
|
|
|
91
110
|
payload: BaseAssemblyOverviewSchema,
|
|
92
111
|
response: BaseAssemblyOverviewSchema.extend({
|
|
93
112
|
id: z.uuid(),
|
|
94
|
-
created_at:
|
|
95
|
-
updated_at:
|
|
113
|
+
created_at: isoDateString,
|
|
114
|
+
updated_at: isoDateString,
|
|
96
115
|
image_src: maybe(z.string()),
|
|
97
116
|
has_image: z.boolean().meta({ deprecated: true }),
|
|
98
117
|
user_id: z.uuid().meta({ deprecated: true })
|
|
@@ -115,7 +134,7 @@ const OrganisationSchema = z.object({
|
|
|
115
134
|
const EventDetailsSchema = z.object({
|
|
116
135
|
visible_on_profile: z.boolean(),
|
|
117
136
|
registration_link: maybe(z.string()),
|
|
118
|
-
start_date: maybe(
|
|
137
|
+
start_date: maybe(isoDateString)
|
|
119
138
|
});
|
|
120
139
|
const StorySchema = z.object({
|
|
121
140
|
visible_on_profile: z.boolean(),
|
|
@@ -187,50 +206,50 @@ export const AssemblyDetailSchema = {
|
|
|
187
206
|
organisation: maybe(
|
|
188
207
|
OrganisationSchema.extend({
|
|
189
208
|
id: z.uuid(),
|
|
190
|
-
created_at:
|
|
191
|
-
updated_at:
|
|
209
|
+
created_at: isoDateString,
|
|
210
|
+
updated_at: isoDateString
|
|
192
211
|
})
|
|
193
212
|
),
|
|
194
213
|
event_details: maybe(
|
|
195
214
|
EventDetailsSchema.extend({
|
|
196
|
-
created_at:
|
|
197
|
-
updated_at:
|
|
215
|
+
created_at: isoDateString,
|
|
216
|
+
updated_at: isoDateString
|
|
198
217
|
})
|
|
199
218
|
),
|
|
200
219
|
story: maybe(
|
|
201
220
|
StorySchema.extend({
|
|
202
|
-
created_at:
|
|
203
|
-
updated_at:
|
|
221
|
+
created_at: isoDateString,
|
|
222
|
+
updated_at: isoDateString
|
|
204
223
|
})
|
|
205
224
|
),
|
|
206
225
|
supporters: maybe(
|
|
207
226
|
SupportersSchema.extend({
|
|
208
|
-
created_at:
|
|
209
|
-
updated_at:
|
|
227
|
+
created_at: isoDateString,
|
|
228
|
+
updated_at: isoDateString
|
|
210
229
|
})
|
|
211
230
|
),
|
|
212
231
|
funders: maybe(
|
|
213
232
|
FundersSchema.extend({
|
|
214
|
-
created_at:
|
|
215
|
-
updated_at:
|
|
233
|
+
created_at: isoDateString,
|
|
234
|
+
updated_at: isoDateString
|
|
216
235
|
})
|
|
217
236
|
),
|
|
218
237
|
facilitation: maybe(
|
|
219
238
|
FacilitationSchema.extend({
|
|
220
|
-
created_at:
|
|
221
|
-
updated_at:
|
|
239
|
+
created_at: isoDateString,
|
|
240
|
+
updated_at: isoDateString
|
|
222
241
|
})
|
|
223
242
|
),
|
|
224
243
|
participants: maybe(
|
|
225
244
|
ParticipantsSchema.extend({
|
|
226
|
-
created_at:
|
|
227
|
-
updated_at:
|
|
245
|
+
created_at: isoDateString,
|
|
246
|
+
updated_at: isoDateString
|
|
228
247
|
})
|
|
229
248
|
),
|
|
230
249
|
support: maybe(
|
|
231
250
|
SupportSchema.extend({
|
|
232
|
-
created_at:
|
|
233
|
-
updated_at:
|
|
251
|
+
created_at: isoDateString,
|
|
252
|
+
updated_at: isoDateString
|
|
234
253
|
})
|
|
235
254
|
),
|
|
236
255
|
action_plan: maybe(
|
|
@@ -238,37 +257,37 @@ export const AssemblyDetailSchema = {
|
|
|
238
257
|
actions: ActionSchema.omit({ assembly_id: true })
|
|
239
258
|
.extend({
|
|
240
259
|
id: z.uuid(),
|
|
241
|
-
created_at:
|
|
242
|
-
updated_at: z.coerce.date(),
|
|
260
|
+
created_at: isoDateString,
|
|
261
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
243
262
|
tasks: TaskSchema.omit({
|
|
244
263
|
action_id: true,
|
|
245
264
|
assembly_id: true
|
|
246
265
|
})
|
|
247
266
|
.extend({
|
|
248
267
|
id: z.uuid(),
|
|
249
|
-
created_at: z.coerce.date(),
|
|
250
|
-
updated_at: z.coerce.date()
|
|
268
|
+
created_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
269
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString())
|
|
251
270
|
})
|
|
252
271
|
.array(),
|
|
253
272
|
updates: z.unknown().array()
|
|
254
273
|
})
|
|
255
274
|
.extend({
|
|
256
|
-
created_at: z.coerce.date(),
|
|
257
|
-
updated_at: z.coerce.date()
|
|
275
|
+
created_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
276
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString())
|
|
258
277
|
})
|
|
259
278
|
.array(),
|
|
260
279
|
updates: z.unknown().array()
|
|
261
280
|
}).and(
|
|
262
281
|
z.object({
|
|
263
|
-
created_at: z.coerce.date(),
|
|
264
|
-
updated_at: z.coerce.date()
|
|
282
|
+
created_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
283
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString())
|
|
265
284
|
})
|
|
266
285
|
)
|
|
267
286
|
),
|
|
268
287
|
surveys: maybe(
|
|
269
288
|
SurveyDetailsSchema.extend({
|
|
270
|
-
created_at: z.coerce.date(),
|
|
271
|
-
updated_at: z.coerce.date()
|
|
289
|
+
created_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
290
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString())
|
|
272
291
|
}).extend({
|
|
273
292
|
data: z.record(
|
|
274
293
|
z.string(),
|
|
@@ -282,44 +301,7 @@ export const AssemblyDetailSchema = {
|
|
|
282
301
|
})
|
|
283
302
|
};
|
|
284
303
|
|
|
285
|
-
|
|
286
|
-
payload: z.object({
|
|
287
|
-
route: z.string(),
|
|
288
|
-
text: z.string(),
|
|
289
|
-
metadata: z.unknown()
|
|
290
|
-
}),
|
|
291
|
-
response: z.string()
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export const LogSchema = {
|
|
295
|
-
payload: z.object({
|
|
296
|
-
message: z.string().optional(),
|
|
297
|
-
data: z.record(z.string(), z.string().optional()).optional(),
|
|
298
|
-
metadata: z.object({
|
|
299
|
-
origin: z.string(),
|
|
300
|
-
route: z.string(),
|
|
301
|
-
status: z.number()
|
|
302
|
-
})
|
|
303
|
-
}),
|
|
304
|
-
response: z.string()
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
export const RegisterSchema = {
|
|
308
|
-
payload: z.object({
|
|
309
|
-
type: z.literal('user.created'),
|
|
310
|
-
object: z.literal('event'),
|
|
311
|
-
data: z.object({
|
|
312
|
-
id: z.string(),
|
|
313
|
-
email_addresses: z
|
|
314
|
-
.object({
|
|
315
|
-
email_address: z.string()
|
|
316
|
-
})
|
|
317
|
-
.array()
|
|
318
|
-
})
|
|
319
|
-
}),
|
|
320
|
-
response: z.string()
|
|
321
|
-
};
|
|
322
|
-
|
|
304
|
+
// Pins
|
|
323
305
|
export const PinSchema = {
|
|
324
306
|
payload: z.object({
|
|
325
307
|
country: z.string(),
|
|
@@ -328,8 +310,8 @@ export const PinSchema = {
|
|
|
328
310
|
}),
|
|
329
311
|
response: z.object({
|
|
330
312
|
id: z.uuid(),
|
|
331
|
-
created_at: z.coerce.date(),
|
|
332
|
-
updated_at: z.coerce.date(),
|
|
313
|
+
created_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
314
|
+
updated_at: z.coerce.date().transform((_) => _.toISOString()),
|
|
333
315
|
country: z.string(),
|
|
334
316
|
text: maybe(z.string()),
|
|
335
317
|
hide: z.boolean(),
|
|
@@ -5,43 +5,21 @@ import {
|
|
|
5
5
|
AssemblyOverviewSchema,
|
|
6
6
|
FeedbackSchema,
|
|
7
7
|
LogSchema,
|
|
8
|
+
PatchAccountReportsIdPublishSchema,
|
|
8
9
|
PinListSchema,
|
|
9
10
|
PinSchema,
|
|
11
|
+
PostAccountReportsIdCoverImageSchema,
|
|
10
12
|
RegisterSchema,
|
|
11
13
|
SurveyResponseSchema,
|
|
12
|
-
SurveySchema
|
|
13
|
-
|
|
14
|
-
} from './schemas';
|
|
14
|
+
SurveySchema
|
|
15
|
+
} from '../schemas';
|
|
15
16
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export enum ApiRouteParameter {
|
|
24
|
-
ID = ':ID',
|
|
25
|
-
NAME = ':NAME'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export enum ApiEndpoint {
|
|
29
|
-
ASSEMBLIES = '/assemblies',
|
|
30
|
-
FEEDBACK = '/feedback',
|
|
31
|
-
INTEREST_ASSEMBLIS = '/interest/assemblis',
|
|
32
|
-
INTEREST_MUTIRAO = '/interest/mutirao',
|
|
33
|
-
LOGS = '/logs',
|
|
34
|
-
PINS = '/pins',
|
|
35
|
-
SURVEYS = '/surveys',
|
|
36
|
-
SURVEY_RESPONSES = '/assemblies/:ID/survey-responses/:NAME'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export enum SurveyName {
|
|
40
|
-
DELIBERATION = 'deliberation',
|
|
41
|
-
DEMOGRAPHIC_DATA = 'demographic-data',
|
|
42
|
-
PRE_ASSEMBLY = 'pre-assembly',
|
|
43
|
-
POST_ASSEMBLY = 'post-assembly'
|
|
44
|
-
}
|
|
17
|
+
export type PublishReportPayload = z.infer<
|
|
18
|
+
(typeof PatchAccountReportsIdPublishSchema)['payload']
|
|
19
|
+
>;
|
|
20
|
+
export type ImageMetadataPayload = z.infer<
|
|
21
|
+
(typeof PostAccountReportsIdCoverImageSchema)['payload']
|
|
22
|
+
>;
|
|
45
23
|
|
|
46
24
|
export type AssemblyDetailPayload = z.infer<
|
|
47
25
|
(typeof AssemblyDetailSchema)['payload']
|
|
@@ -61,7 +39,6 @@ export type SurveyPayload = z.infer<(typeof SurveySchema)['payload']>;
|
|
|
61
39
|
export type SurveyResponsePayload = z.infer<
|
|
62
40
|
(typeof SurveyResponseSchema)['payload']
|
|
63
41
|
>;
|
|
64
|
-
export type UserPayload = z.infer<(typeof UserSchema)['payload']>;
|
|
65
42
|
|
|
66
43
|
export type AssemblyDetailResponse = z.infer<
|
|
67
44
|
(typeof AssemblyDetailSchema)['response']
|
|
@@ -81,4 +58,3 @@ export type SurveyResponse = z.infer<(typeof SurveySchema)['response']>;
|
|
|
81
58
|
export type SurveyResponseResponse = z.infer<
|
|
82
59
|
(typeof SurveyResponseSchema)['response']
|
|
83
60
|
>;
|
|
84
|
-
export type UserResponse = z.infer<(typeof UserSchema)['response']>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export enum ApiRestMethod {
|
|
2
|
+
GET = 'GET',
|
|
3
|
+
POST = 'POST',
|
|
4
|
+
PUT = 'PUT',
|
|
5
|
+
PATCH = 'PATCH'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum ApiRouteParameter {
|
|
9
|
+
ID = ':ID',
|
|
10
|
+
NAME = ':NAME'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum ApiEndpoint {
|
|
14
|
+
ACCOUNT_REPORTS = '/account/reports',
|
|
15
|
+
ASSEMBLIES = '/assemblies',
|
|
16
|
+
FEEDBACK = '/feedback',
|
|
17
|
+
INTEREST_ASSEMBLIS = '/interest/assemblis',
|
|
18
|
+
INTEREST_MUTIRAO = '/interest/mutirao',
|
|
19
|
+
LOGS = '/logs',
|
|
20
|
+
PINS = '/pins',
|
|
21
|
+
SURVEYS = '/surveys',
|
|
22
|
+
SURVEY_RESPONSES = '/assemblies/:ID/survey-responses/:NAME'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export enum SurveyName {
|
|
26
|
+
DELIBERATION = 'deliberation',
|
|
27
|
+
DEMOGRAPHIC_DATA = 'demographic-data',
|
|
28
|
+
PRE_ASSEMBLY = 'pre-assembly',
|
|
29
|
+
POST_ASSEMBLY = 'post-assembly'
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { ReportSchema, UserSchema, ReportContentSchema } from '../schemas/base';
|
|
3
|
+
|
|
4
|
+
export type Report = z.infer<typeof ReportSchema>;
|
|
5
|
+
export type ReportContent = z.infer<typeof ReportContentSchema>;
|
|
6
|
+
export type User = z.infer<typeof UserSchema>;
|