@lcas58/esmi-api-types 1.0.8 → 1.0.10
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/routes/events/events.handlers.d.ts +2 -18
- package/dist/src/routes/events/events.handlers.js +24 -154
- package/dist/src/routes/events/events.index.d.ts +47 -442
- package/dist/src/routes/events/events.index.js +1 -3
- package/dist/src/routes/events/events.routes.d.ts +347 -1194
- package/dist/src/routes/events/events.routes.js +11 -53
- package/dist/src/routes/events/schemas/event.schemas.d.ts +173 -824
- package/dist/src/routes/events/schemas/event.schemas.js +26 -46
- package/dist/src/routes/events/schemas/index.d.ts +1 -1
- package/dist/src/routes/events/schemas/index.js +1 -1
- package/dist/src/routes/leagues/leagues.handlers.js +2 -1
- package/dist/src/routes/marketing/marketing.index.d.ts +15 -15
- package/dist/src/routes/marketing/marketing.routes.d.ts +5 -5
- package/dist/src/routes/organizations/organizations.index.d.ts +6 -6
- package/dist/src/routes/sports/sports.handlers.d.ts +4 -0
- package/dist/src/routes/sports/sports.handlers.js +23 -0
- package/dist/src/routes/sports/sports.index.d.ts +45 -0
- package/dist/src/routes/sports/sports.index.js +7 -0
- package/dist/src/routes/sports/sports.routes.d.ts +90 -0
- package/dist/src/routes/sports/sports.routes.js +27 -0
- package/dist/src/routes/webhooks/webhooks.handlers.d.ts +3 -0
- package/dist/src/routes/webhooks/webhooks.handlers.js +14 -0
- package/dist/src/routes/webhooks/webhooks.index.d.ts +32 -0
- package/dist/src/routes/webhooks/webhooks.index.js +6 -0
- package/dist/src/routes/webhooks/webhooks.routes.d.ts +65 -0
- package/dist/src/routes/webhooks/webhooks.routes.js +26 -0
- package/dist/src/shared/client-types.d.ts +3 -16
- package/dist/src/shared/client-types.js +0 -12
- package/package.json +25 -32
- package/dist/src/app.d.ts +0 -2
- package/dist/src/app.js +0 -22
- package/dist/src/db/schema/event.d.ts +0 -264
- package/dist/src/db/schema/event.js +0 -38
- package/dist/src/db/schema/index.d.ts +0 -8
- package/dist/src/db/schema/index.js +0 -8
- package/dist/src/db/schema/league.d.ts +0 -261
- package/dist/src/db/schema/league.js +0 -27
- package/dist/src/db/schema/location.d.ts +0 -239
- package/dist/src/db/schema/location.js +0 -22
- package/dist/src/db/schema/marketing.d.ts +0 -77
- package/dist/src/db/schema/marketing.js +0 -16
- package/dist/src/db/schema/organization.d.ts +0 -882
- package/dist/src/db/schema/organization.js +0 -174
- package/dist/src/db/schema/pickup.d.ts +0 -417
- package/dist/src/db/schema/pickup.js +0 -42
- package/dist/src/db/schema/tag.d.ts +0 -261
- package/dist/src/db/schema/tag.js +0 -55
- package/dist/src/db/schema/user.d.ts +0 -597
- package/dist/src/db/schema/user.js +0 -45
- package/dist/src/lib/types.d.ts +0 -14
- package/dist/src/shared/index.d.ts +0 -7
- package/dist/src/shared/index.js +0 -28
|
@@ -1,49 +1,29 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { selectEventSchema } from "../../../db/schema/
|
|
3
|
-
import { insertLocationSchema, selectLocationSchema } from "../../../db/schema/location.js";
|
|
4
|
-
import { selectOrganizationSchema } from "../../../db/schema/organization.js";
|
|
5
|
-
import { selectUserSchema } from "../../../db/schema/user.js";
|
|
6
|
-
export const createEventSchema = z.object({
|
|
7
|
-
name: selectEventSchema.shape.name,
|
|
8
|
-
description: selectEventSchema.shape.description,
|
|
9
|
-
location: insertLocationSchema,
|
|
10
|
-
type: selectEventSchema.shape.type,
|
|
11
|
-
organizationId: selectEventSchema.shape.organizationId,
|
|
12
|
-
ageGroup: selectEventSchema.shape.ageGroup,
|
|
13
|
-
gender: selectEventSchema.shape.gender,
|
|
14
|
-
}).refine(data => data.location, {
|
|
15
|
-
message: "Location details must be provided",
|
|
16
|
-
});
|
|
17
|
-
// Patch event schema (all fields optional)
|
|
18
|
-
export const patchEventSchema = z.object({
|
|
19
|
-
name: selectEventSchema.shape.name.min(1).optional(),
|
|
20
|
-
description: selectEventSchema.shape.description,
|
|
21
|
-
location: insertLocationSchema.optional(),
|
|
22
|
-
type: selectEventSchema.shape.type.optional(),
|
|
23
|
-
organizationId: selectEventSchema.shape.organizationId.optional(),
|
|
24
|
-
mode: selectEventSchema.shape.mode.optional(),
|
|
25
|
-
ageGroup: selectEventSchema.shape.ageGroup.optional(),
|
|
26
|
-
gender: selectEventSchema.shape.gender,
|
|
27
|
-
status: selectEventSchema.shape.status.optional(),
|
|
28
|
-
});
|
|
29
|
-
// Query schema for list endpoint using Drizzle schema shape
|
|
30
|
-
export const listEventsQuerySchema = z.object({
|
|
31
|
-
status: selectEventSchema.shape.status.optional(),
|
|
32
|
-
type: selectEventSchema.shape.type.optional(),
|
|
33
|
-
organizationId: selectEventSchema.shape.organizationId.optional(),
|
|
34
|
-
});
|
|
35
|
-
// Response schemas with relations
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { selectEventSchema } from "../../../db/schema/index.js";
|
|
36
3
|
export const eventWithRelationsSchema = selectEventSchema.extend({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
4
|
+
sport: z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
icon: z.string().nullable(),
|
|
8
|
+
}).nullable(),
|
|
9
|
+
location: z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
name: z.string(),
|
|
12
|
+
formattedAddress: z.string(),
|
|
13
|
+
city: z.string().nullable(),
|
|
14
|
+
state: z.string().nullable(),
|
|
15
|
+
latitude: z.number().nullable(),
|
|
16
|
+
longitude: z.number().nullable(),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
externalLink: z.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
url: z.string(),
|
|
21
|
+
domain: z.string(),
|
|
22
|
+
}).nullable(),
|
|
40
23
|
});
|
|
41
|
-
export const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
upcoming: z.number(),
|
|
47
|
-
inProgress: z.number(),
|
|
48
|
-
completed: z.number(),
|
|
24
|
+
export const listEventsQuerySchema = z.object({
|
|
25
|
+
sportId: z.string().optional(),
|
|
26
|
+
source: z.enum(["external", "community"]).optional(),
|
|
27
|
+
limit: z.coerce.number().min(1).max(100).default(20).optional(),
|
|
28
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
49
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { eventWithRelationsSchema, listEventsQuerySchema, type EventWithRelations, type ListEventsQuery, } from "./event.schemas.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { eventWithRelationsSchema, listEventsQuerySchema, } from "./event.schemas.js";
|
|
@@ -33,13 +33,14 @@ export const list = async (c) => {
|
|
|
33
33
|
tags: sql `array_agg(json_build_object('id', ${tags.id}, 'name', ${tags.name}))`.as("tags"),
|
|
34
34
|
})
|
|
35
35
|
.from(event)
|
|
36
|
+
.innerJoin(leagues, eq(leagues.eventId, event.id))
|
|
36
37
|
.innerJoin(location, eq(event.locationId, location.id))
|
|
37
38
|
.innerJoin(organization, eq(event.organizationId, organization.id))
|
|
38
39
|
.innerJoin(user, eq(organization.ownerId, user.id))
|
|
39
40
|
.innerJoin(eventTags, eq(event.id, eventTags.eventId))
|
|
40
41
|
.innerJoin(tags, eq(eventTags.tagId, tags.id))
|
|
41
42
|
.where(eq(event.locationId, locationId))
|
|
42
|
-
.groupBy(event.id,
|
|
43
|
+
.groupBy(event.id, leagues.id, location.id, organization.id, user.id);
|
|
43
44
|
if (data.length === 0) {
|
|
44
45
|
return c.json({
|
|
45
46
|
message: HttpStatusPhrases.NOT_FOUND,
|
|
@@ -11,8 +11,8 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
11
11
|
input: {};
|
|
12
12
|
output: {
|
|
13
13
|
id: number;
|
|
14
|
-
email: string;
|
|
15
14
|
createdAt: string | null;
|
|
15
|
+
email: string;
|
|
16
16
|
}[];
|
|
17
17
|
outputFormat: "text" | "json";
|
|
18
18
|
status: 200;
|
|
@@ -27,18 +27,12 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
output: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
path: (string | number)[];
|
|
34
|
-
message?: string | undefined;
|
|
35
|
-
}[];
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
38
|
-
success: boolean;
|
|
30
|
+
id: number;
|
|
31
|
+
createdAt: string | null;
|
|
32
|
+
email: string;
|
|
39
33
|
};
|
|
40
34
|
outputFormat: "text" | "json";
|
|
41
|
-
status:
|
|
35
|
+
status: 200;
|
|
42
36
|
} | {
|
|
43
37
|
input: {
|
|
44
38
|
json: {
|
|
@@ -46,12 +40,18 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
46
40
|
};
|
|
47
41
|
};
|
|
48
42
|
output: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
error: {
|
|
44
|
+
issues: {
|
|
45
|
+
code: string;
|
|
46
|
+
path: (string | number)[];
|
|
47
|
+
message?: string | undefined | undefined;
|
|
48
|
+
}[];
|
|
49
|
+
name: string;
|
|
50
|
+
};
|
|
51
|
+
success: boolean;
|
|
52
52
|
};
|
|
53
53
|
outputFormat: "text" | "json";
|
|
54
|
-
status:
|
|
54
|
+
status: 422;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
}, "/">;
|
|
@@ -13,12 +13,12 @@ export declare const list: {
|
|
|
13
13
|
createdAt: z.ZodNullable<z.ZodDate>;
|
|
14
14
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
15
15
|
id: number;
|
|
16
|
-
email: string;
|
|
17
16
|
createdAt: Date | null;
|
|
17
|
+
email: string;
|
|
18
18
|
}, {
|
|
19
19
|
id: number;
|
|
20
|
-
email: string;
|
|
21
20
|
createdAt: Date | null;
|
|
21
|
+
email: string;
|
|
22
22
|
}>, "many">;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
@@ -53,8 +53,8 @@ export declare const create: {
|
|
|
53
53
|
"application/json": {
|
|
54
54
|
schema: z.ZodObject<Omit<{
|
|
55
55
|
id: z.ZodOptional<z.ZodNumber>;
|
|
56
|
-
email: z.ZodString;
|
|
57
56
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
57
|
+
email: z.ZodString;
|
|
58
58
|
}, "id" | "createdAt">, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
59
59
|
email: string;
|
|
60
60
|
}, {
|
|
@@ -75,12 +75,12 @@ export declare const create: {
|
|
|
75
75
|
createdAt: z.ZodNullable<z.ZodDate>;
|
|
76
76
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
77
77
|
id: number;
|
|
78
|
-
email: string;
|
|
79
78
|
createdAt: Date | null;
|
|
79
|
+
email: string;
|
|
80
80
|
}, {
|
|
81
81
|
id: number;
|
|
82
|
-
email: string;
|
|
83
82
|
createdAt: Date | null;
|
|
83
|
+
email: string;
|
|
84
84
|
}>;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
@@ -49,7 +49,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
49
49
|
issues: {
|
|
50
50
|
code: string;
|
|
51
51
|
path: (string | number)[];
|
|
52
|
-
message?: string | undefined;
|
|
52
|
+
message?: string | undefined | undefined;
|
|
53
53
|
}[];
|
|
54
54
|
name: string;
|
|
55
55
|
};
|
|
@@ -124,7 +124,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
124
124
|
issues: {
|
|
125
125
|
code: string;
|
|
126
126
|
path: (string | number)[];
|
|
127
|
-
message?: string | undefined;
|
|
127
|
+
message?: string | undefined | undefined;
|
|
128
128
|
}[];
|
|
129
129
|
name: string;
|
|
130
130
|
};
|
|
@@ -206,7 +206,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
206
206
|
issues: {
|
|
207
207
|
code: string;
|
|
208
208
|
path: (string | number)[];
|
|
209
|
-
message?: string | undefined;
|
|
209
|
+
message?: string | undefined | undefined;
|
|
210
210
|
}[];
|
|
211
211
|
name: string;
|
|
212
212
|
};
|
|
@@ -358,7 +358,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
358
358
|
issues: {
|
|
359
359
|
code: string;
|
|
360
360
|
path: (string | number)[];
|
|
361
|
-
message?: string | undefined;
|
|
361
|
+
message?: string | undefined | undefined;
|
|
362
362
|
}[];
|
|
363
363
|
name: string;
|
|
364
364
|
};
|
|
@@ -438,7 +438,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
438
438
|
issues: {
|
|
439
439
|
code: string;
|
|
440
440
|
path: (string | number)[];
|
|
441
|
-
message?: string | undefined;
|
|
441
|
+
message?: string | undefined | undefined;
|
|
442
442
|
}[];
|
|
443
443
|
name: string;
|
|
444
444
|
};
|
|
@@ -481,7 +481,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
481
481
|
issues: {
|
|
482
482
|
code: string;
|
|
483
483
|
path: (string | number)[];
|
|
484
|
-
message?: string | undefined;
|
|
484
|
+
message?: string | undefined | undefined;
|
|
485
485
|
}[];
|
|
486
486
|
name: string;
|
|
487
487
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import * as HttpStatusCodes from "stoker/http-status-codes";
|
|
3
|
+
import * as HttpStatusPhrases from "stoker/http-status-phrases";
|
|
4
|
+
import { createDb } from "../../db/index.js";
|
|
5
|
+
import { sport } from "../../db/schema/index.js";
|
|
6
|
+
export const list = async (c) => {
|
|
7
|
+
const { db } = createDb(c.env);
|
|
8
|
+
const sports = await db.query.sport.findMany({
|
|
9
|
+
orderBy: (sport, { asc }) => [asc(sport.name)],
|
|
10
|
+
});
|
|
11
|
+
return c.json(sports, HttpStatusCodes.OK);
|
|
12
|
+
};
|
|
13
|
+
export const getOne = async (c) => {
|
|
14
|
+
const { db } = createDb(c.env);
|
|
15
|
+
const { id } = c.req.valid("param");
|
|
16
|
+
const foundSport = await db.query.sport.findFirst({
|
|
17
|
+
where: eq(sport.id, id),
|
|
18
|
+
});
|
|
19
|
+
if (!foundSport) {
|
|
20
|
+
return c.json({ message: HttpStatusPhrases.NOT_FOUND }, HttpStatusCodes.NOT_FOUND);
|
|
21
|
+
}
|
|
22
|
+
return c.json(foundSport, HttpStatusCodes.OK);
|
|
23
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shared/index.js").AppBindings, {
|
|
2
|
+
"/sports": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {};
|
|
5
|
+
output: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
icon: string | null;
|
|
10
|
+
}[];
|
|
11
|
+
outputFormat: "text" | "json";
|
|
12
|
+
status: 200;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} & {
|
|
16
|
+
"/sports/:id": {
|
|
17
|
+
$get: {
|
|
18
|
+
input: {
|
|
19
|
+
param: {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
output: {
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
outputFormat: "text" | "json";
|
|
27
|
+
status: 404;
|
|
28
|
+
} | {
|
|
29
|
+
input: {
|
|
30
|
+
param: {
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
output: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
icon: string | null;
|
|
39
|
+
};
|
|
40
|
+
outputFormat: "text" | "json";
|
|
41
|
+
status: 200;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, "/">;
|
|
45
|
+
export default router;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRouter } from "../../lib/create-app.js";
|
|
2
|
+
import * as handlers from "./sports.handlers.js";
|
|
3
|
+
import * as routes from "./sports.routes.js";
|
|
4
|
+
const router = createRouter()
|
|
5
|
+
.openapi(routes.list, handlers.list)
|
|
6
|
+
.openapi(routes.getOne, handlers.getOne);
|
|
7
|
+
export default router;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const list: {
|
|
3
|
+
path: "/sports";
|
|
4
|
+
method: "get";
|
|
5
|
+
tags: string[];
|
|
6
|
+
responses: {
|
|
7
|
+
200: {
|
|
8
|
+
content: {
|
|
9
|
+
"application/json": {
|
|
10
|
+
schema: z.ZodArray<z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
icon: z.ZodNullable<z.ZodString>;
|
|
14
|
+
createdAt: z.ZodDate;
|
|
15
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
icon: string | null;
|
|
20
|
+
}, {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
icon: string | null;
|
|
25
|
+
}>, "many">;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
} & {
|
|
32
|
+
getRoutingPath(): "/sports";
|
|
33
|
+
};
|
|
34
|
+
export declare const getOne: {
|
|
35
|
+
path: "/sports/{id}";
|
|
36
|
+
method: "get";
|
|
37
|
+
tags: string[];
|
|
38
|
+
request: {
|
|
39
|
+
params: z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
id: string;
|
|
43
|
+
}, {
|
|
44
|
+
id: string;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
responses: {
|
|
48
|
+
200: {
|
|
49
|
+
content: {
|
|
50
|
+
"application/json": {
|
|
51
|
+
schema: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
icon: z.ZodNullable<z.ZodString>;
|
|
55
|
+
createdAt: z.ZodDate;
|
|
56
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
createdAt: Date;
|
|
60
|
+
icon: string | null;
|
|
61
|
+
}, {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
createdAt: Date;
|
|
65
|
+
icon: string | null;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
404: {
|
|
72
|
+
content: {
|
|
73
|
+
"application/json": {
|
|
74
|
+
schema: z.ZodObject<{
|
|
75
|
+
message: z.ZodString;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
message: string;
|
|
78
|
+
}, {
|
|
79
|
+
message: string;
|
|
80
|
+
}>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
} & {
|
|
87
|
+
getRoutingPath(): "/sports/:id";
|
|
88
|
+
};
|
|
89
|
+
export type ListRoute = typeof list;
|
|
90
|
+
export type GetOneRoute = typeof getOne;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRoute, z } from "@hono/zod-openapi";
|
|
2
|
+
import * as HttpStatusCodes from "stoker/http-status-codes";
|
|
3
|
+
import { jsonContent } from "stoker/openapi/helpers";
|
|
4
|
+
import { selectSportSchema } from "../../db/schema/index.js";
|
|
5
|
+
import { notFoundSchema } from "../../lib/constants.js";
|
|
6
|
+
export const list = createRoute({
|
|
7
|
+
path: "/sports",
|
|
8
|
+
method: "get",
|
|
9
|
+
tags: ["Sports"],
|
|
10
|
+
responses: {
|
|
11
|
+
[HttpStatusCodes.OK]: jsonContent(z.array(selectSportSchema), "List of sports"),
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export const getOne = createRoute({
|
|
15
|
+
path: "/sports/{id}",
|
|
16
|
+
method: "get",
|
|
17
|
+
tags: ["Sports"],
|
|
18
|
+
request: {
|
|
19
|
+
params: z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
responses: {
|
|
24
|
+
[HttpStatusCodes.OK]: jsonContent(selectSportSchema, "Sport details"),
|
|
25
|
+
[HttpStatusCodes.NOT_FOUND]: jsonContent(notFoundSchema, "Sport not found"),
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const verify = async (c) => {
|
|
2
|
+
const { url, eventType } = c.req.valid("json");
|
|
3
|
+
// TODO: Implement actual URL verification logic
|
|
4
|
+
// This could include:
|
|
5
|
+
// - Sending a challenge request to the URL
|
|
6
|
+
// - Verifying the URL responds correctly
|
|
7
|
+
// - Checking for proper SSL/TLS
|
|
8
|
+
// - Validating response format
|
|
9
|
+
return c.json({
|
|
10
|
+
verified: true,
|
|
11
|
+
url,
|
|
12
|
+
message: "URL verification pending implementation",
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shared/index.js").AppBindings, {
|
|
2
|
+
"/webhooks/verify": {
|
|
3
|
+
$post: {
|
|
4
|
+
input: {
|
|
5
|
+
json: {
|
|
6
|
+
url: string;
|
|
7
|
+
eventType?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
output: {
|
|
11
|
+
message: string;
|
|
12
|
+
url: string;
|
|
13
|
+
verified: boolean;
|
|
14
|
+
};
|
|
15
|
+
outputFormat: "text" | "json";
|
|
16
|
+
status: 200;
|
|
17
|
+
} | {
|
|
18
|
+
input: {
|
|
19
|
+
json: {
|
|
20
|
+
url: string;
|
|
21
|
+
eventType?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
output: {
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
outputFormat: "text" | "json";
|
|
28
|
+
status: 400;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}, "/">;
|
|
32
|
+
export default router;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const verify: {
|
|
3
|
+
method: "post";
|
|
4
|
+
path: "/webhooks/verify";
|
|
5
|
+
tags: string[];
|
|
6
|
+
middleware: import("hono").MiddlewareHandler[];
|
|
7
|
+
request: {
|
|
8
|
+
body: {
|
|
9
|
+
content: {
|
|
10
|
+
"application/json": {
|
|
11
|
+
schema: z.ZodObject<{
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
eventType: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
url: string;
|
|
16
|
+
eventType?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
url: string;
|
|
19
|
+
eventType?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
responses: {
|
|
27
|
+
200: {
|
|
28
|
+
content: {
|
|
29
|
+
"application/json": {
|
|
30
|
+
schema: z.ZodObject<{
|
|
31
|
+
verified: z.ZodBoolean;
|
|
32
|
+
url: z.ZodString;
|
|
33
|
+
message: z.ZodString;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
message: string;
|
|
36
|
+
url: string;
|
|
37
|
+
verified: boolean;
|
|
38
|
+
}, {
|
|
39
|
+
message: string;
|
|
40
|
+
url: string;
|
|
41
|
+
verified: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
400: {
|
|
48
|
+
content: {
|
|
49
|
+
"application/json": {
|
|
50
|
+
schema: z.ZodObject<{
|
|
51
|
+
message: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
message: string;
|
|
54
|
+
}, {
|
|
55
|
+
message: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
} & {
|
|
63
|
+
getRoutingPath(): "/webhooks/verify";
|
|
64
|
+
};
|
|
65
|
+
export type VerifyRoute = typeof verify;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isAuth } from "../../middlewares/is-auth.js";
|
|
2
|
+
import { createRoute, z } from "@hono/zod-openapi";
|
|
3
|
+
import * as HttpStatusCodes from "stoker/http-status-codes";
|
|
4
|
+
import { jsonContent } from "stoker/openapi/helpers";
|
|
5
|
+
export const verify = createRoute({
|
|
6
|
+
method: "post",
|
|
7
|
+
path: "/webhooks/verify",
|
|
8
|
+
tags: ["Webhooks"],
|
|
9
|
+
middleware: [isAuth()],
|
|
10
|
+
request: {
|
|
11
|
+
body: jsonContent(z.object({
|
|
12
|
+
url: z.string().url(),
|
|
13
|
+
eventType: z.string().optional(),
|
|
14
|
+
}), "URL verification request"),
|
|
15
|
+
},
|
|
16
|
+
responses: {
|
|
17
|
+
[HttpStatusCodes.OK]: jsonContent(z.object({
|
|
18
|
+
verified: z.boolean(),
|
|
19
|
+
url: z.string(),
|
|
20
|
+
message: z.string(),
|
|
21
|
+
}), "URL verification result"),
|
|
22
|
+
[HttpStatusCodes.BAD_REQUEST]: jsonContent(z.object({
|
|
23
|
+
message: z.string(),
|
|
24
|
+
}), "Invalid request"),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type exports for Hono RPC client usage
|
|
3
|
-
*
|
|
4
|
-
* Usage in frontend:
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import { hc } from 'hono/client';
|
|
7
|
-
* import type { AppType } from '@lcas58/esmi-api-types/client-types';
|
|
8
|
-
*
|
|
9
|
-
* const client = hc<AppType>('https://api.example.com');
|
|
10
|
-
* const res = await client.events.$get();
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
1
|
import type events from "../routes/events/events.index.js";
|
|
14
2
|
import type index from "../routes/index.route.js";
|
|
15
|
-
import type leagues from "../routes/leagues/leagues.index.js";
|
|
16
3
|
import type marketing from "../routes/marketing/marketing.index.js";
|
|
17
|
-
import type
|
|
18
|
-
import type
|
|
19
|
-
export type AppType = typeof index | typeof
|
|
4
|
+
import type sports from "../routes/sports/sports.index.js";
|
|
5
|
+
import type webhooks from "../routes/webhooks/webhooks.index.js";
|
|
6
|
+
export type AppType = typeof index | typeof events | typeof sports | typeof marketing | typeof webhooks;
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type exports for Hono RPC client usage
|
|
3
|
-
*
|
|
4
|
-
* Usage in frontend:
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import { hc } from 'hono/client';
|
|
7
|
-
* import type { AppType } from '@lcas58/esmi-api-types/client-types';
|
|
8
|
-
*
|
|
9
|
-
* const client = hc<AppType>('https://api.example.com');
|
|
10
|
-
* const res = await client.events.$get();
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
1
|
export {};
|