@lcas58/esmi-api-types 1.0.25 → 1.0.27
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.js +21 -4
- package/dist/src/routes/events/events.index.d.ts +26 -21
- package/dist/src/routes/events/events.routes.d.ts +62 -47
- package/dist/src/routes/events/events.routes.js +3 -2
- package/dist/src/routes/events/schemas/event.schemas.d.ts +17 -8
- package/dist/src/routes/events/schemas/event.schemas.js +3 -0
- package/package.json +1 -1
- package/dist/src/routes/events/discover.handlers.d.ts +0 -3
- package/dist/src/routes/events/discover.handlers.js +0 -15
- package/dist/src/routes/events/discover.index.d.ts +0 -72
- package/dist/src/routes/events/discover.index.js +0 -6
- package/dist/src/routes/events/discover.routes.d.ts +0 -333
- package/dist/src/routes/events/discover.routes.js +0 -26
- package/dist/src/routes/leagues/leagues.handlers.d.ts +0 -3
- package/dist/src/routes/leagues/leagues.handlers.js +0 -50
- package/dist/src/routes/leagues/leagues.index.d.ts +0 -53
- package/dist/src/routes/leagues/leagues.index.js +0 -6
- package/dist/src/routes/leagues/leagues.routes.d.ts +0 -137
- package/dist/src/routes/leagues/leagues.routes.js +0 -47
- package/dist/src/routes/organizations/organizations.handlers.d.ts +0 -74
- package/dist/src/routes/organizations/organizations.handlers.js +0 -485
- package/dist/src/routes/organizations/organizations.index.d.ts +0 -517
- package/dist/src/routes/organizations/organizations.index.js +0 -12
- package/dist/src/routes/organizations/organizations.routes.d.ts +0 -1236
- package/dist/src/routes/organizations/organizations.routes.js +0 -137
- package/dist/src/routes/organizations/tasks.test.d.ts +0 -0
- package/dist/src/routes/organizations/tasks.test.js +0 -181
- package/dist/src/routes/tags/tags.handlers.d.ts +0 -3
- package/dist/src/routes/tags/tags.handlers.js +0 -15
- package/dist/src/routes/tags/tags.index.d.ts +0 -24
- package/dist/src/routes/tags/tags.index.js +0 -6
- package/dist/src/routes/tags/tags.routes.d.ts +0 -68
- package/dist/src/routes/tags/tags.routes.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { and, eq, gte, ilike, inArray, isNotNull, lte } from "drizzle-orm";
|
|
1
|
+
import { and, between, eq, gte, ilike, inArray, isNotNull, lte } from "drizzle-orm";
|
|
2
2
|
import { streamSSE } from "hono/streaming";
|
|
3
3
|
import * as HttpStatusCodes from "stoker/http-status-codes";
|
|
4
4
|
import * as HttpStatusPhrases from "stoker/http-status-phrases";
|
|
@@ -11,7 +11,7 @@ import { chatRequestSchema } from "./events.routes.js";
|
|
|
11
11
|
export const list = async (c) => {
|
|
12
12
|
const { db } = createDb(c.env);
|
|
13
13
|
const query = c.req.valid("query");
|
|
14
|
-
const { sportId, source } = query;
|
|
14
|
+
const { sportId, source, latitude, longitude, radius } = query;
|
|
15
15
|
const limit = query.limit ?? 20;
|
|
16
16
|
const offset = query.offset ?? 0;
|
|
17
17
|
const city = query.city?.trim();
|
|
@@ -34,8 +34,24 @@ export const list = async (c) => {
|
|
|
34
34
|
// Time filtering (recommended for feed relevance)
|
|
35
35
|
whereConditions.push(gte(event.startsAt, from));
|
|
36
36
|
whereConditions.push(lte(event.startsAt, to));
|
|
37
|
-
//
|
|
38
|
-
if (
|
|
37
|
+
// Location filtering: geo radius (preferred) or city/state string match (fallback)
|
|
38
|
+
if (latitude != null && longitude != null) {
|
|
39
|
+
const r = radius ?? 30;
|
|
40
|
+
const latDelta = r / 69;
|
|
41
|
+
const lngDelta = r / (69 * Math.cos((latitude * Math.PI) / 180));
|
|
42
|
+
const locations = await db.query.location.findMany({
|
|
43
|
+
where: and(isNotNull(location.latitude), isNotNull(location.longitude), between(location.latitude, latitude - latDelta, latitude + latDelta), between(location.longitude, longitude - lngDelta, longitude + lngDelta)),
|
|
44
|
+
columns: { id: true },
|
|
45
|
+
limit: 1000,
|
|
46
|
+
});
|
|
47
|
+
if (locations.length === 0) {
|
|
48
|
+
return c.json([], HttpStatusCodes.OK);
|
|
49
|
+
}
|
|
50
|
+
const locationIds = locations.map((l) => l.id);
|
|
51
|
+
whereConditions.push(isNotNull(event.locationId));
|
|
52
|
+
whereConditions.push(inArray(event.locationId, locationIds));
|
|
53
|
+
}
|
|
54
|
+
else if (city || state) {
|
|
39
55
|
const locationConditions = [];
|
|
40
56
|
if (city) {
|
|
41
57
|
locationConditions.push(ilike(location.city, city));
|
|
@@ -238,6 +254,7 @@ export const chatStream = async (c) => {
|
|
|
238
254
|
history: body.history,
|
|
239
255
|
city: body.city,
|
|
240
256
|
state: body.state,
|
|
257
|
+
enableWebSearch: body.enableWebSearch,
|
|
241
258
|
}, writer);
|
|
242
259
|
}
|
|
243
260
|
catch (err) {
|
|
@@ -3,10 +3,13 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
3
3
|
$get: {
|
|
4
4
|
input: {
|
|
5
5
|
query: {
|
|
6
|
-
sportId?: string | string[] | undefined;
|
|
7
6
|
city?: string | string[] | undefined;
|
|
8
7
|
state?: string | string[] | undefined;
|
|
8
|
+
sportId?: string | string[] | undefined;
|
|
9
|
+
latitude?: string | string[] | undefined;
|
|
10
|
+
longitude?: string | string[] | undefined;
|
|
9
11
|
source?: string | string[] | undefined;
|
|
12
|
+
radius?: string | string[] | undefined;
|
|
10
13
|
from?: string | string[] | undefined;
|
|
11
14
|
to?: string | string[] | undefined;
|
|
12
15
|
limit?: string | string[] | undefined;
|
|
@@ -17,22 +20,22 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
17
20
|
metadata: any;
|
|
18
21
|
id: string;
|
|
19
22
|
title: string;
|
|
23
|
+
sportId: string;
|
|
20
24
|
createdAt: string;
|
|
21
25
|
sport: {
|
|
22
26
|
id: string;
|
|
23
27
|
name: string;
|
|
24
28
|
icon: string | null;
|
|
25
29
|
} | null;
|
|
26
|
-
sportId: string;
|
|
27
30
|
startsAt: string;
|
|
28
31
|
endsAt: string | null;
|
|
29
32
|
timezone: string;
|
|
30
33
|
location: {
|
|
31
34
|
id: string;
|
|
32
35
|
name: string;
|
|
33
|
-
formattedAddress: string;
|
|
34
36
|
city: string | null;
|
|
35
37
|
state: string | null;
|
|
38
|
+
formattedAddress: string;
|
|
36
39
|
latitude: number | null;
|
|
37
40
|
longitude: number | null;
|
|
38
41
|
} | null;
|
|
@@ -68,22 +71,22 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
68
71
|
metadata: any;
|
|
69
72
|
id: string;
|
|
70
73
|
title: string;
|
|
74
|
+
sportId: string;
|
|
71
75
|
createdAt: string;
|
|
72
76
|
sport: {
|
|
73
77
|
id: string;
|
|
74
78
|
name: string;
|
|
75
79
|
icon: string | null;
|
|
76
80
|
} | null;
|
|
77
|
-
sportId: string;
|
|
78
81
|
startsAt: string;
|
|
79
82
|
endsAt: string | null;
|
|
80
83
|
timezone: string;
|
|
81
84
|
location: {
|
|
82
85
|
id: string;
|
|
83
86
|
name: string;
|
|
84
|
-
formattedAddress: string;
|
|
85
87
|
city: string | null;
|
|
86
88
|
state: string | null;
|
|
89
|
+
formattedAddress: string;
|
|
87
90
|
latitude: number | null;
|
|
88
91
|
longitude: number | null;
|
|
89
92
|
} | null;
|
|
@@ -123,9 +126,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
123
126
|
$post: {
|
|
124
127
|
input: {
|
|
125
128
|
json: {
|
|
126
|
-
sportId: string;
|
|
127
129
|
city: string;
|
|
128
130
|
state: string;
|
|
131
|
+
sportId: string;
|
|
129
132
|
from?: string | undefined;
|
|
130
133
|
to?: string | undefined;
|
|
131
134
|
refresh?: boolean | undefined;
|
|
@@ -135,22 +138,22 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
135
138
|
metadata: any;
|
|
136
139
|
id: string;
|
|
137
140
|
title: string;
|
|
141
|
+
sportId: string;
|
|
138
142
|
createdAt: string;
|
|
139
143
|
sport: {
|
|
140
144
|
id: string;
|
|
141
145
|
name: string;
|
|
142
146
|
icon: string | null;
|
|
143
147
|
} | null;
|
|
144
|
-
sportId: string;
|
|
145
148
|
startsAt: string;
|
|
146
149
|
endsAt: string | null;
|
|
147
150
|
timezone: string;
|
|
148
151
|
location: {
|
|
149
152
|
id: string;
|
|
150
153
|
name: string;
|
|
151
|
-
formattedAddress: string;
|
|
152
154
|
city: string | null;
|
|
153
155
|
state: string | null;
|
|
156
|
+
formattedAddress: string;
|
|
154
157
|
latitude: number | null;
|
|
155
158
|
longitude: number | null;
|
|
156
159
|
} | null;
|
|
@@ -175,9 +178,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
175
178
|
} | {
|
|
176
179
|
input: {
|
|
177
180
|
json: {
|
|
178
|
-
sportId: string;
|
|
179
181
|
city: string;
|
|
180
182
|
state: string;
|
|
183
|
+
sportId: string;
|
|
181
184
|
from?: string | undefined;
|
|
182
185
|
to?: string | undefined;
|
|
183
186
|
refresh?: boolean | undefined;
|
|
@@ -195,9 +198,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
195
198
|
$post: {
|
|
196
199
|
input: {
|
|
197
200
|
json: {
|
|
198
|
-
sportId: string;
|
|
199
201
|
city: string;
|
|
200
202
|
state: string;
|
|
203
|
+
sportId: string;
|
|
201
204
|
from?: string | undefined;
|
|
202
205
|
to?: string | undefined;
|
|
203
206
|
refresh?: boolean | undefined;
|
|
@@ -211,9 +214,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
211
214
|
} | {
|
|
212
215
|
input: {
|
|
213
216
|
json: {
|
|
214
|
-
sportId: string;
|
|
215
217
|
city: string;
|
|
216
218
|
state: string;
|
|
219
|
+
sportId: string;
|
|
217
220
|
from?: string | undefined;
|
|
218
221
|
to?: string | undefined;
|
|
219
222
|
refresh?: boolean | undefined;
|
|
@@ -242,6 +245,8 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
242
245
|
$post: {
|
|
243
246
|
input: {
|
|
244
247
|
json: {
|
|
248
|
+
city: string;
|
|
249
|
+
state: string;
|
|
245
250
|
events: {
|
|
246
251
|
url: string;
|
|
247
252
|
id: string;
|
|
@@ -256,30 +261,28 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
256
261
|
description?: string | undefined;
|
|
257
262
|
endsAt?: string | undefined;
|
|
258
263
|
}[];
|
|
259
|
-
city: string;
|
|
260
|
-
state: string;
|
|
261
264
|
};
|
|
262
265
|
};
|
|
263
266
|
output: {
|
|
264
267
|
metadata: any;
|
|
265
268
|
id: string;
|
|
266
269
|
title: string;
|
|
270
|
+
sportId: string;
|
|
267
271
|
createdAt: string;
|
|
268
272
|
sport: {
|
|
269
273
|
id: string;
|
|
270
274
|
name: string;
|
|
271
275
|
icon: string | null;
|
|
272
276
|
} | null;
|
|
273
|
-
sportId: string;
|
|
274
277
|
startsAt: string;
|
|
275
278
|
endsAt: string | null;
|
|
276
279
|
timezone: string;
|
|
277
280
|
location: {
|
|
278
281
|
id: string;
|
|
279
282
|
name: string;
|
|
280
|
-
formattedAddress: string;
|
|
281
283
|
city: string | null;
|
|
282
284
|
state: string | null;
|
|
285
|
+
formattedAddress: string;
|
|
283
286
|
latitude: number | null;
|
|
284
287
|
longitude: number | null;
|
|
285
288
|
} | null;
|
|
@@ -304,6 +307,8 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
304
307
|
} | {
|
|
305
308
|
input: {
|
|
306
309
|
json: {
|
|
310
|
+
city: string;
|
|
311
|
+
state: string;
|
|
307
312
|
events: {
|
|
308
313
|
url: string;
|
|
309
314
|
id: string;
|
|
@@ -318,8 +323,6 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
318
323
|
description?: string | undefined;
|
|
319
324
|
endsAt?: string | undefined;
|
|
320
325
|
}[];
|
|
321
|
-
city: string;
|
|
322
|
-
state: string;
|
|
323
326
|
};
|
|
324
327
|
};
|
|
325
328
|
output: {
|
|
@@ -335,14 +338,15 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
335
338
|
input: {
|
|
336
339
|
json: {
|
|
337
340
|
message: string;
|
|
341
|
+
city: string;
|
|
342
|
+
state: string;
|
|
338
343
|
sportId: string;
|
|
339
344
|
sportName: string;
|
|
340
|
-
city?: string | undefined;
|
|
341
|
-
state?: string | undefined;
|
|
342
345
|
history?: {
|
|
343
346
|
content: string;
|
|
344
347
|
role: "user" | "assistant";
|
|
345
348
|
}[] | undefined;
|
|
349
|
+
enableWebSearch?: boolean | undefined;
|
|
346
350
|
};
|
|
347
351
|
};
|
|
348
352
|
output: {
|
|
@@ -354,14 +358,15 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
|
|
|
354
358
|
input: {
|
|
355
359
|
json: {
|
|
356
360
|
message: string;
|
|
361
|
+
city: string;
|
|
362
|
+
state: string;
|
|
357
363
|
sportId: string;
|
|
358
364
|
sportName: string;
|
|
359
|
-
city?: string | undefined;
|
|
360
|
-
state?: string | undefined;
|
|
361
365
|
history?: {
|
|
362
366
|
content: string;
|
|
363
367
|
role: "user" | "assistant";
|
|
364
368
|
}[] | undefined;
|
|
369
|
+
enableWebSearch?: boolean | undefined;
|
|
365
370
|
};
|
|
366
371
|
};
|
|
367
372
|
output: {
|