@lcas58/esmi-api-types 1.0.26 → 1.0.28

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.
Files changed (42) hide show
  1. package/dist/src/routes/events/events.handlers.js +20 -4
  2. package/dist/src/routes/events/events.index.d.ts +26 -19
  3. package/dist/src/routes/events/events.routes.d.ts +60 -39
  4. package/dist/src/routes/events/schemas/event.schemas.d.ts +20 -8
  5. package/dist/src/routes/events/schemas/event.schemas.js +3 -0
  6. package/dist/src/routes/groups/groups.handlers.d.ts +7 -0
  7. package/dist/src/routes/groups/groups.handlers.js +205 -0
  8. package/dist/src/routes/groups/groups.index.d.ts +337 -0
  9. package/dist/src/routes/groups/groups.index.js +10 -0
  10. package/dist/src/routes/{events/discover.routes.d.ts → groups/groups.routes.d.ts} +719 -47
  11. package/dist/src/routes/groups/groups.routes.js +77 -0
  12. package/dist/src/routes/groups/schemas/group.schemas.d.ts +214 -0
  13. package/dist/src/routes/groups/schemas/group.schemas.js +48 -0
  14. package/dist/src/routes/groups/schemas/index.d.ts +1 -0
  15. package/dist/src/routes/groups/schemas/index.js +1 -0
  16. package/dist/src/shared/client-types.d.ts +2 -1
  17. package/package.json +1 -1
  18. package/dist/src/routes/events/discover.handlers.d.ts +0 -3
  19. package/dist/src/routes/events/discover.handlers.js +0 -15
  20. package/dist/src/routes/events/discover.index.d.ts +0 -72
  21. package/dist/src/routes/events/discover.index.js +0 -6
  22. package/dist/src/routes/events/discover.routes.js +0 -26
  23. package/dist/src/routes/leagues/leagues.handlers.d.ts +0 -3
  24. package/dist/src/routes/leagues/leagues.handlers.js +0 -50
  25. package/dist/src/routes/leagues/leagues.index.d.ts +0 -53
  26. package/dist/src/routes/leagues/leagues.index.js +0 -6
  27. package/dist/src/routes/leagues/leagues.routes.d.ts +0 -137
  28. package/dist/src/routes/leagues/leagues.routes.js +0 -47
  29. package/dist/src/routes/organizations/organizations.handlers.d.ts +0 -74
  30. package/dist/src/routes/organizations/organizations.handlers.js +0 -485
  31. package/dist/src/routes/organizations/organizations.index.d.ts +0 -517
  32. package/dist/src/routes/organizations/organizations.index.js +0 -12
  33. package/dist/src/routes/organizations/organizations.routes.d.ts +0 -1236
  34. package/dist/src/routes/organizations/organizations.routes.js +0 -137
  35. package/dist/src/routes/organizations/tasks.test.d.ts +0 -0
  36. package/dist/src/routes/organizations/tasks.test.js +0 -181
  37. package/dist/src/routes/tags/tags.handlers.d.ts +0 -3
  38. package/dist/src/routes/tags/tags.handlers.js +0 -15
  39. package/dist/src/routes/tags/tags.index.d.ts +0 -24
  40. package/dist/src/routes/tags/tags.index.js +0 -6
  41. package/dist/src/routes/tags/tags.routes.d.ts +0 -68
  42. 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
- // City/state locationIds → events (case-insensitive)
38
- if (city || state) {
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));
@@ -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;
@@ -41,6 +44,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
41
44
  source: "external" | "community";
42
45
  thumbnailUrl: string | null;
43
46
  createdByUserId: string | null;
47
+ groupId: string | null;
44
48
  creator: {
45
49
  image: string | null;
46
50
  id: string;
@@ -68,22 +72,22 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
68
72
  metadata: any;
69
73
  id: string;
70
74
  title: string;
75
+ sportId: string;
71
76
  createdAt: string;
72
77
  sport: {
73
78
  id: string;
74
79
  name: string;
75
80
  icon: string | null;
76
81
  } | null;
77
- sportId: string;
78
82
  startsAt: string;
79
83
  endsAt: string | null;
80
84
  timezone: string;
81
85
  location: {
82
86
  id: string;
83
87
  name: string;
84
- formattedAddress: string;
85
88
  city: string | null;
86
89
  state: string | null;
90
+ formattedAddress: string;
87
91
  latitude: number | null;
88
92
  longitude: number | null;
89
93
  } | null;
@@ -92,6 +96,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
92
96
  source: "external" | "community";
93
97
  thumbnailUrl: string | null;
94
98
  createdByUserId: string | null;
99
+ groupId: string | null;
95
100
  creator: {
96
101
  image: string | null;
97
102
  id: string;
@@ -123,9 +128,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
123
128
  $post: {
124
129
  input: {
125
130
  json: {
126
- sportId: string;
127
131
  city: string;
128
132
  state: string;
133
+ sportId: string;
129
134
  from?: string | undefined;
130
135
  to?: string | undefined;
131
136
  refresh?: boolean | undefined;
@@ -135,22 +140,22 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
135
140
  metadata: any;
136
141
  id: string;
137
142
  title: string;
143
+ sportId: string;
138
144
  createdAt: string;
139
145
  sport: {
140
146
  id: string;
141
147
  name: string;
142
148
  icon: string | null;
143
149
  } | null;
144
- sportId: string;
145
150
  startsAt: string;
146
151
  endsAt: string | null;
147
152
  timezone: string;
148
153
  location: {
149
154
  id: string;
150
155
  name: string;
151
- formattedAddress: string;
152
156
  city: string | null;
153
157
  state: string | null;
158
+ formattedAddress: string;
154
159
  latitude: number | null;
155
160
  longitude: number | null;
156
161
  } | null;
@@ -159,6 +164,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
159
164
  source: "external" | "community";
160
165
  thumbnailUrl: string | null;
161
166
  createdByUserId: string | null;
167
+ groupId: string | null;
162
168
  creator: {
163
169
  image: string | null;
164
170
  id: string;
@@ -175,9 +181,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
175
181
  } | {
176
182
  input: {
177
183
  json: {
178
- sportId: string;
179
184
  city: string;
180
185
  state: string;
186
+ sportId: string;
181
187
  from?: string | undefined;
182
188
  to?: string | undefined;
183
189
  refresh?: boolean | undefined;
@@ -195,9 +201,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
195
201
  $post: {
196
202
  input: {
197
203
  json: {
198
- sportId: string;
199
204
  city: string;
200
205
  state: string;
206
+ sportId: string;
201
207
  from?: string | undefined;
202
208
  to?: string | undefined;
203
209
  refresh?: boolean | undefined;
@@ -211,9 +217,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
211
217
  } | {
212
218
  input: {
213
219
  json: {
214
- sportId: string;
215
220
  city: string;
216
221
  state: string;
222
+ sportId: string;
217
223
  from?: string | undefined;
218
224
  to?: string | undefined;
219
225
  refresh?: boolean | undefined;
@@ -242,6 +248,8 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
242
248
  $post: {
243
249
  input: {
244
250
  json: {
251
+ city: string;
252
+ state: string;
245
253
  events: {
246
254
  url: string;
247
255
  id: string;
@@ -256,30 +264,28 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
256
264
  description?: string | undefined;
257
265
  endsAt?: string | undefined;
258
266
  }[];
259
- city: string;
260
- state: string;
261
267
  };
262
268
  };
263
269
  output: {
264
270
  metadata: any;
265
271
  id: string;
266
272
  title: string;
273
+ sportId: string;
267
274
  createdAt: string;
268
275
  sport: {
269
276
  id: string;
270
277
  name: string;
271
278
  icon: string | null;
272
279
  } | null;
273
- sportId: string;
274
280
  startsAt: string;
275
281
  endsAt: string | null;
276
282
  timezone: string;
277
283
  location: {
278
284
  id: string;
279
285
  name: string;
280
- formattedAddress: string;
281
286
  city: string | null;
282
287
  state: string | null;
288
+ formattedAddress: string;
283
289
  latitude: number | null;
284
290
  longitude: number | null;
285
291
  } | null;
@@ -288,6 +294,7 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
288
294
  source: "external" | "community";
289
295
  thumbnailUrl: string | null;
290
296
  createdByUserId: string | null;
297
+ groupId: string | null;
291
298
  creator: {
292
299
  image: string | null;
293
300
  id: string;
@@ -304,6 +311,8 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
304
311
  } | {
305
312
  input: {
306
313
  json: {
314
+ city: string;
315
+ state: string;
307
316
  events: {
308
317
  url: string;
309
318
  id: string;
@@ -318,8 +327,6 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
318
327
  description?: string | undefined;
319
328
  endsAt?: string | undefined;
320
329
  }[];
321
- city: string;
322
- state: string;
323
330
  };
324
331
  };
325
332
  output: {
@@ -335,9 +342,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
335
342
  input: {
336
343
  json: {
337
344
  message: string;
338
- sportId: string;
339
345
  city: string;
340
346
  state: string;
347
+ sportId: string;
341
348
  sportName: string;
342
349
  history?: {
343
350
  content: string;
@@ -355,9 +362,9 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
355
362
  input: {
356
363
  json: {
357
364
  message: string;
358
- sportId: string;
359
365
  city: string;
360
366
  state: string;
367
+ sportId: string;
361
368
  sportName: string;
362
369
  history?: {
363
370
  content: string;