@lcas58/esmi-api-types 1.0.6 → 1.0.7
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/src/app.d.ts +1 -1
- package/dist/src/app.js +0 -1
- package/dist/src/routes/events/events.handlers.d.ts +20 -0
- package/dist/src/routes/events/events.handlers.js +177 -0
- package/dist/src/routes/events/events.index.d.ts +501 -0
- package/dist/src/routes/events/events.index.js +9 -0
- package/dist/src/routes/events/events.routes.d.ts +1375 -0
- package/dist/src/routes/events/events.routes.js +72 -0
- package/dist/src/routes/events/schemas/event.schemas.d.ts +896 -0
- package/dist/src/routes/events/schemas/event.schemas.js +49 -0
- package/dist/src/routes/events/schemas/index.d.ts +1 -0
- package/dist/src/routes/events/schemas/index.js +1 -0
- package/dist/src/routes/index.route.d.ts +13 -0
- package/dist/src/routes/index.route.js +19 -0
- package/dist/src/routes/leagues/leagues.handlers.d.ts +3 -0
- package/dist/src/routes/leagues/leagues.handlers.js +49 -0
- package/dist/src/routes/leagues/leagues.index.d.ts +53 -0
- package/dist/src/routes/leagues/leagues.index.js +6 -0
- package/dist/src/routes/leagues/leagues.routes.d.ts +137 -0
- package/dist/src/routes/leagues/leagues.routes.js +47 -0
- package/dist/src/routes/marketing/marketing.handlers.d.ts +4 -0
- package/dist/src/routes/marketing/marketing.handlers.js +20 -0
- package/dist/src/routes/marketing/marketing.index.d.ts +58 -0
- package/dist/src/routes/marketing/marketing.index.js +7 -0
- package/dist/src/routes/marketing/marketing.routes.d.ts +154 -0
- package/dist/src/routes/marketing/marketing.routes.js +27 -0
- package/dist/src/routes/organizations/organizations.handlers.d.ts +74 -0
- package/dist/src/routes/organizations/organizations.handlers.js +485 -0
- package/dist/src/routes/organizations/organizations.index.d.ts +517 -0
- package/dist/src/routes/organizations/organizations.index.js +12 -0
- package/dist/src/routes/organizations/organizations.routes.d.ts +1236 -0
- package/dist/src/routes/organizations/organizations.routes.js +137 -0
- package/dist/src/routes/organizations/tasks.test.d.ts +0 -0
- package/dist/src/routes/organizations/tasks.test.js +181 -0
- package/dist/src/routes/tags/tags.handlers.d.ts +3 -0
- package/dist/src/routes/tags/tags.handlers.js +15 -0
- package/dist/src/routes/tags/tags.index.d.ts +24 -0
- package/dist/src/routes/tags/tags.index.js +6 -0
- package/dist/src/routes/tags/tags.routes.d.ts +68 -0
- package/dist/src/routes/tags/tags.routes.js +25 -0
- package/dist/src/shared/client-types.d.ts +8 -3
- package/dist/src/shared/client-types.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createRoute, z } from "@hono/zod-openapi";
|
|
2
|
+
import * as HttpStatusCodes from "stoker/http-status-codes";
|
|
3
|
+
import { jsonContent, jsonContentRequired } from "stoker/openapi/helpers";
|
|
4
|
+
import { createErrorSchema } from "stoker/openapi/schemas";
|
|
5
|
+
import { notFoundSchema, unauthorizedSchema } from "../../lib/constants.js";
|
|
6
|
+
import { uuidParamsSchema } from "../../lib/openapi-schemas.js";
|
|
7
|
+
import { isAuth } from "../../middlewares/is-auth.js";
|
|
8
|
+
import { createEventSchema, eventResponseSchema, eventsListResponseSchema, listEventsQuerySchema, patchEventSchema, } from "./schemas/index.js";
|
|
9
|
+
import { countStatsResponseSchema } from "./schemas/event.schemas.js";
|
|
10
|
+
const tags = ["Events"];
|
|
11
|
+
export const list = createRoute({
|
|
12
|
+
path: "/events",
|
|
13
|
+
method: "get",
|
|
14
|
+
tags,
|
|
15
|
+
request: {
|
|
16
|
+
query: listEventsQuerySchema,
|
|
17
|
+
},
|
|
18
|
+
responses: {
|
|
19
|
+
[HttpStatusCodes.OK]: jsonContent(eventsListResponseSchema, "The list of events"),
|
|
20
|
+
[HttpStatusCodes.NOT_FOUND]: jsonContent(notFoundSchema, "No events found"),
|
|
21
|
+
[HttpStatusCodes.UNPROCESSABLE_ENTITY]: jsonContent(createErrorSchema(listEventsQuerySchema), "Invalid query parameters error"),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const create = createRoute({
|
|
25
|
+
path: "/events",
|
|
26
|
+
method: "post",
|
|
27
|
+
tags,
|
|
28
|
+
middleware: [isAuth()],
|
|
29
|
+
request: {
|
|
30
|
+
body: jsonContentRequired(createEventSchema, "The event to create"),
|
|
31
|
+
},
|
|
32
|
+
responses: {
|
|
33
|
+
[HttpStatusCodes.CREATED]: jsonContent(eventResponseSchema, "The created event"),
|
|
34
|
+
[HttpStatusCodes.UNPROCESSABLE_ENTITY]: jsonContent(createErrorSchema(createEventSchema), "The validation error(s)"),
|
|
35
|
+
[HttpStatusCodes.UNAUTHORIZED]: jsonContent(unauthorizedSchema, "Unauthorized"),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const patch = createRoute({
|
|
39
|
+
path: "/events/{id}",
|
|
40
|
+
method: "patch",
|
|
41
|
+
tags,
|
|
42
|
+
middleware: [isAuth()],
|
|
43
|
+
request: {
|
|
44
|
+
params: uuidParamsSchema("id"),
|
|
45
|
+
body: jsonContentRequired(patchEventSchema, "The event to update"),
|
|
46
|
+
},
|
|
47
|
+
responses: {
|
|
48
|
+
[HttpStatusCodes.OK]: jsonContent(eventResponseSchema, "The updated event"),
|
|
49
|
+
[HttpStatusCodes.NOT_FOUND]: jsonContent(notFoundSchema, "Event not found"),
|
|
50
|
+
[HttpStatusCodes.UNPROCESSABLE_ENTITY]: jsonContent(createErrorSchema(uuidParamsSchema("id"))
|
|
51
|
+
.or(createErrorSchema(patchEventSchema)), "The validation error(s)"),
|
|
52
|
+
[HttpStatusCodes.UNAUTHORIZED]: jsonContent(unauthorizedSchema, "Unauthorized"),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export const getCountStats = createRoute({
|
|
56
|
+
path: "/events/count-stats",
|
|
57
|
+
method: "get",
|
|
58
|
+
tags,
|
|
59
|
+
request: {
|
|
60
|
+
query: z.object({
|
|
61
|
+
organizationId: z.string(),
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
responses: {
|
|
65
|
+
[HttpStatusCodes.OK]: jsonContent(countStatsResponseSchema, "The count stats"),
|
|
66
|
+
[HttpStatusCodes.UNPROCESSABLE_ENTITY]: jsonContent(createErrorSchema(z.object({
|
|
67
|
+
organizationId: z.string(),
|
|
68
|
+
})), "Invalid organizationId error"),
|
|
69
|
+
[HttpStatusCodes.NOT_FOUND]: jsonContent(notFoundSchema, "No count stats found for the given organization"),
|
|
70
|
+
[HttpStatusCodes.UNAUTHORIZED]: jsonContent(unauthorizedSchema, "Unauthorized"),
|
|
71
|
+
},
|
|
72
|
+
});
|