@lcas58/esmi-api-types 1.0.29 → 1.0.30

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.
@@ -1,8 +1,28 @@
1
- import { and, count, eq, gte, ilike, lte, or, sql } from "drizzle-orm";
1
+ import { and, count, eq, gte, ilike, inArray, lte, or, sql } from "drizzle-orm";
2
2
  import * as HttpStatusCodes from "stoker/http-status-codes";
3
3
  import * as HttpStatusPhrases from "stoker/http-status-phrases";
4
4
  import { createDb } from "../../db/index.js";
5
- import { event, group } from "../../db/schema/index.js";
5
+ import { event, group, groupTag, tag } from "../../db/schema/index.js";
6
+ function withTags(g) {
7
+ const { groupTags, ...rest } = g;
8
+ return { ...rest, tags: groupTags.map(gt => ({ id: gt.tag.id, name: gt.tag.name })) };
9
+ }
10
+ async function upsertTags(db, groupId, tagNames) {
11
+ if (tagNames.length === 0) {
12
+ await db.delete(groupTag).where(eq(groupTag.groupId, groupId));
13
+ return;
14
+ }
15
+ const slugs = tagNames.map(n => slugify(n));
16
+ await db.insert(tag)
17
+ .values(tagNames.map((name, i) => ({ name, slug: slugs[i] })))
18
+ .onConflictDoNothing({ target: tag.slug });
19
+ const tagRecords = await db.select({ id: tag.id, slug: tag.slug })
20
+ .from(tag)
21
+ .where(inArray(tag.slug, slugs));
22
+ await db.delete(groupTag).where(eq(groupTag.groupId, groupId));
23
+ await db.insert(groupTag)
24
+ .values(tagRecords.map(t => ({ groupId, tagId: t.id })));
25
+ }
6
26
  function slugify(name) {
7
27
  return name
8
28
  .toLowerCase()
@@ -46,6 +66,9 @@ export const list = async (c) => {
46
66
  image: true,
47
67
  },
48
68
  },
69
+ groupTags: {
70
+ with: { tag: true },
71
+ },
49
72
  },
50
73
  limit,
51
74
  offset,
@@ -66,7 +89,7 @@ export const list = async (c) => {
66
89
  eventCounts = Object.fromEntries(counts.map(r => [r.groupId, r.count]));
67
90
  }
68
91
  const result = groups.map(g => ({
69
- ...g,
92
+ ...withTags(g),
70
93
  _count: { events: eventCounts[g.id] ?? 0 },
71
94
  }));
72
95
  return c.json(result, HttpStatusCodes.OK);
@@ -85,12 +108,15 @@ export const getOne = async (c) => {
85
108
  image: true,
86
109
  },
87
110
  },
111
+ groupTags: {
112
+ with: { tag: true },
113
+ },
88
114
  },
89
115
  });
90
116
  if (!foundGroup) {
91
117
  return c.json({ message: HttpStatusPhrases.NOT_FOUND }, HttpStatusCodes.NOT_FOUND);
92
118
  }
93
- return c.json(foundGroup, HttpStatusCodes.OK);
119
+ return c.json(withTags(foundGroup), HttpStatusCodes.OK);
94
120
  };
95
121
  export const getEvents = async (c) => {
96
122
  const { db } = createDb(c.env);
@@ -149,8 +175,14 @@ export const create = async (c) => {
149
175
  city: body.city,
150
176
  state: body.state,
151
177
  imageUrl: body.imageUrl,
178
+ skillLevel: body.skillLevel,
179
+ vibe: body.vibe,
180
+ activityFrequency: body.activityFrequency,
152
181
  createdByUserId: user.id,
153
182
  }).returning();
183
+ if (body.tags?.length) {
184
+ await upsertTags(db, newGroup.id, body.tags);
185
+ }
154
186
  const result = await db.query.group.findFirst({
155
187
  where: eq(group.id, newGroup.id),
156
188
  with: {
@@ -162,9 +194,12 @@ export const create = async (c) => {
162
194
  image: true,
163
195
  },
164
196
  },
197
+ groupTags: {
198
+ with: { tag: true },
199
+ },
165
200
  },
166
201
  });
167
- return c.json(result, HttpStatusCodes.OK);
202
+ return c.json(withTags(result), HttpStatusCodes.OK);
168
203
  };
169
204
  export const update = async (c) => {
170
205
  const { db } = createDb(c.env);
@@ -183,10 +218,14 @@ export const update = async (c) => {
183
218
  if (existing.createdByUserId !== user.id) {
184
219
  return c.json({ message: HttpStatusPhrases.UNAUTHORIZED }, HttpStatusCodes.UNAUTHORIZED);
185
220
  }
221
+ const { tags: tagNames, ...groupFields } = body;
186
222
  await db.update(group).set({
187
- ...body,
223
+ ...groupFields,
188
224
  updatedAt: new Date(),
189
225
  }).where(eq(group.id, id));
226
+ if (tagNames !== undefined) {
227
+ await upsertTags(db, id, tagNames ?? []);
228
+ }
190
229
  const result = await db.query.group.findFirst({
191
230
  where: eq(group.id, id),
192
231
  with: {
@@ -198,7 +237,10 @@ export const update = async (c) => {
198
237
  image: true,
199
238
  },
200
239
  },
240
+ groupTags: {
241
+ with: { tag: true },
242
+ },
201
243
  },
202
244
  });
203
- return c.json(result, HttpStatusCodes.OK);
245
+ return c.json(withTags(result), HttpStatusCodes.OK);
204
246
  };
@@ -32,12 +32,19 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
32
32
  updatedAt: string;
33
33
  createdByUserId: string | null;
34
34
  imageUrl: string | null;
35
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
36
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
37
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
35
38
  isActive: boolean;
36
39
  creator: {
37
40
  image: string | null;
38
41
  id: string;
39
42
  name: string;
40
43
  } | null;
44
+ tags: {
45
+ id: string;
46
+ name: string;
47
+ }[];
41
48
  _count?: {
42
49
  events: number;
43
50
  } | undefined;
@@ -85,12 +92,19 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
85
92
  updatedAt: string;
86
93
  createdByUserId: string | null;
87
94
  imageUrl: string | null;
95
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
96
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
97
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
88
98
  isActive: boolean;
89
99
  creator: {
90
100
  image: string | null;
91
101
  id: string;
92
102
  name: string;
93
103
  } | null;
104
+ tags: {
105
+ id: string;
106
+ name: string;
107
+ }[];
94
108
  _count?: {
95
109
  events: number;
96
110
  } | undefined;
@@ -189,6 +203,10 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
189
203
  state?: string | undefined;
190
204
  slug?: string | undefined;
191
205
  imageUrl?: string | undefined;
206
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
207
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
208
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
209
+ tags?: string[] | undefined;
192
210
  };
193
211
  };
194
212
  output: {
@@ -206,6 +224,10 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
206
224
  state?: string | undefined;
207
225
  slug?: string | undefined;
208
226
  imageUrl?: string | undefined;
227
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
228
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
229
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
230
+ tags?: string[] | undefined;
209
231
  };
210
232
  };
211
233
  output: {
@@ -228,12 +250,19 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
228
250
  updatedAt: string;
229
251
  createdByUserId: string | null;
230
252
  imageUrl: string | null;
253
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
254
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
255
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
231
256
  isActive: boolean;
232
257
  creator: {
233
258
  image: string | null;
234
259
  id: string;
235
260
  name: string;
236
261
  } | null;
262
+ tags: {
263
+ id: string;
264
+ name: string;
265
+ }[];
237
266
  _count?: {
238
267
  events: number;
239
268
  } | undefined;
@@ -256,6 +285,10 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
256
285
  city?: string | undefined;
257
286
  state?: string | undefined;
258
287
  imageUrl?: string | null | undefined;
288
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
289
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
290
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
291
+ tags?: string[] | null | undefined;
259
292
  };
260
293
  };
261
294
  output: {
@@ -275,6 +308,10 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
275
308
  city?: string | undefined;
276
309
  state?: string | undefined;
277
310
  imageUrl?: string | null | undefined;
311
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
312
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
313
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
314
+ tags?: string[] | null | undefined;
278
315
  };
279
316
  };
280
317
  output: {
@@ -294,6 +331,10 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
294
331
  city?: string | undefined;
295
332
  state?: string | undefined;
296
333
  imageUrl?: string | null | undefined;
334
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
335
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
336
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
337
+ tags?: string[] | null | undefined;
297
338
  };
298
339
  };
299
340
  output: {
@@ -316,12 +357,19 @@ declare const router: import("@hono/zod-openapi").OpenAPIHono<import("../../shar
316
357
  updatedAt: string;
317
358
  createdByUserId: string | null;
318
359
  imageUrl: string | null;
360
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
361
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
362
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
319
363
  isActive: boolean;
320
364
  creator: {
321
365
  image: string | null;
322
366
  id: string;
323
367
  name: string;
324
368
  } | null;
369
+ tags: {
370
+ id: string;
371
+ name: string;
372
+ }[];
325
373
  _count?: {
326
374
  events: number;
327
375
  } | undefined;
@@ -47,6 +47,9 @@ export declare const list: {
47
47
  externalUrl: z.ZodNullable<z.ZodString>;
48
48
  createdByUserId: z.ZodNullable<z.ZodString>;
49
49
  imageUrl: z.ZodNullable<z.ZodString>;
50
+ skillLevel: z.ZodNullable<z.ZodString>;
51
+ vibe: z.ZodNullable<z.ZodString>;
52
+ activityFrequency: z.ZodNullable<z.ZodString>;
50
53
  isActive: z.ZodBoolean;
51
54
  createdAt: z.ZodDate;
52
55
  updatedAt: z.ZodDate;
@@ -77,6 +80,19 @@ export declare const list: {
77
80
  id: string;
78
81
  name: string;
79
82
  }>>;
83
+ skillLevel: z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
84
+ vibe: z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
85
+ activityFrequency: z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
86
+ tags: z.ZodArray<z.ZodObject<{
87
+ id: z.ZodString;
88
+ name: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ id: string;
91
+ name: string;
92
+ }, {
93
+ id: string;
94
+ name: string;
95
+ }>, "many">;
80
96
  _count: z.ZodOptional<z.ZodObject<{
81
97
  events: z.ZodNumber;
82
98
  }, "strip", z.ZodTypeAny, {
@@ -104,12 +120,19 @@ export declare const list: {
104
120
  updatedAt: Date;
105
121
  createdByUserId: string | null;
106
122
  imageUrl: string | null;
123
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
124
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
125
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
107
126
  isActive: boolean;
108
127
  creator: {
109
128
  image: string | null;
110
129
  id: string;
111
130
  name: string;
112
131
  } | null;
132
+ tags: {
133
+ id: string;
134
+ name: string;
135
+ }[];
113
136
  _count?: {
114
137
  events: number;
115
138
  } | undefined;
@@ -133,12 +156,19 @@ export declare const list: {
133
156
  updatedAt: Date;
134
157
  createdByUserId: string | null;
135
158
  imageUrl: string | null;
159
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
160
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
161
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
136
162
  isActive: boolean;
137
163
  creator: {
138
164
  image: string | null;
139
165
  id: string;
140
166
  name: string;
141
167
  } | null;
168
+ tags: {
169
+ id: string;
170
+ name: string;
171
+ }[];
142
172
  _count?: {
143
173
  events: number;
144
174
  } | undefined;
@@ -181,6 +211,9 @@ export declare const getOne: {
181
211
  externalUrl: z.ZodNullable<z.ZodString>;
182
212
  createdByUserId: z.ZodNullable<z.ZodString>;
183
213
  imageUrl: z.ZodNullable<z.ZodString>;
214
+ skillLevel: z.ZodNullable<z.ZodString>;
215
+ vibe: z.ZodNullable<z.ZodString>;
216
+ activityFrequency: z.ZodNullable<z.ZodString>;
184
217
  isActive: z.ZodBoolean;
185
218
  createdAt: z.ZodDate;
186
219
  updatedAt: z.ZodDate;
@@ -211,6 +244,19 @@ export declare const getOne: {
211
244
  id: string;
212
245
  name: string;
213
246
  }>>;
247
+ skillLevel: z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
248
+ vibe: z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
249
+ activityFrequency: z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
250
+ tags: z.ZodArray<z.ZodObject<{
251
+ id: z.ZodString;
252
+ name: z.ZodString;
253
+ }, "strip", z.ZodTypeAny, {
254
+ id: string;
255
+ name: string;
256
+ }, {
257
+ id: string;
258
+ name: string;
259
+ }>, "many">;
214
260
  _count: z.ZodOptional<z.ZodObject<{
215
261
  events: z.ZodNumber;
216
262
  }, "strip", z.ZodTypeAny, {
@@ -238,12 +284,19 @@ export declare const getOne: {
238
284
  updatedAt: Date;
239
285
  createdByUserId: string | null;
240
286
  imageUrl: string | null;
287
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
288
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
289
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
241
290
  isActive: boolean;
242
291
  creator: {
243
292
  image: string | null;
244
293
  id: string;
245
294
  name: string;
246
295
  } | null;
296
+ tags: {
297
+ id: string;
298
+ name: string;
299
+ }[];
247
300
  _count?: {
248
301
  events: number;
249
302
  } | undefined;
@@ -267,12 +320,19 @@ export declare const getOne: {
267
320
  updatedAt: Date;
268
321
  createdByUserId: string | null;
269
322
  imageUrl: string | null;
323
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
324
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
325
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
270
326
  isActive: boolean;
271
327
  creator: {
272
328
  image: string | null;
273
329
  id: string;
274
330
  name: string;
275
331
  } | null;
332
+ tags: {
333
+ id: string;
334
+ name: string;
335
+ }[];
276
336
  _count?: {
277
337
  events: number;
278
338
  } | undefined;
@@ -630,6 +690,10 @@ export declare const create: {
630
690
  city: z.ZodOptional<z.ZodString>;
631
691
  state: z.ZodOptional<z.ZodString>;
632
692
  imageUrl: z.ZodOptional<z.ZodString>;
693
+ skillLevel: z.ZodOptional<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
694
+ vibe: z.ZodOptional<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
695
+ activityFrequency: z.ZodOptional<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
696
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
633
697
  }, "strip", z.ZodTypeAny, {
634
698
  name: string;
635
699
  sportId: string;
@@ -638,6 +702,10 @@ export declare const create: {
638
702
  state?: string | undefined;
639
703
  slug?: string | undefined;
640
704
  imageUrl?: string | undefined;
705
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
706
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
707
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
708
+ tags?: string[] | undefined;
641
709
  }, {
642
710
  name: string;
643
711
  sportId: string;
@@ -646,6 +714,10 @@ export declare const create: {
646
714
  state?: string | undefined;
647
715
  slug?: string | undefined;
648
716
  imageUrl?: string | undefined;
717
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
718
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
719
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
720
+ tags?: string[] | undefined;
649
721
  }>;
650
722
  };
651
723
  };
@@ -669,6 +741,9 @@ export declare const create: {
669
741
  externalUrl: z.ZodNullable<z.ZodString>;
670
742
  createdByUserId: z.ZodNullable<z.ZodString>;
671
743
  imageUrl: z.ZodNullable<z.ZodString>;
744
+ skillLevel: z.ZodNullable<z.ZodString>;
745
+ vibe: z.ZodNullable<z.ZodString>;
746
+ activityFrequency: z.ZodNullable<z.ZodString>;
672
747
  isActive: z.ZodBoolean;
673
748
  createdAt: z.ZodDate;
674
749
  updatedAt: z.ZodDate;
@@ -699,6 +774,19 @@ export declare const create: {
699
774
  id: string;
700
775
  name: string;
701
776
  }>>;
777
+ skillLevel: z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
778
+ vibe: z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
779
+ activityFrequency: z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
780
+ tags: z.ZodArray<z.ZodObject<{
781
+ id: z.ZodString;
782
+ name: z.ZodString;
783
+ }, "strip", z.ZodTypeAny, {
784
+ id: string;
785
+ name: string;
786
+ }, {
787
+ id: string;
788
+ name: string;
789
+ }>, "many">;
702
790
  _count: z.ZodOptional<z.ZodObject<{
703
791
  events: z.ZodNumber;
704
792
  }, "strip", z.ZodTypeAny, {
@@ -726,12 +814,19 @@ export declare const create: {
726
814
  updatedAt: Date;
727
815
  createdByUserId: string | null;
728
816
  imageUrl: string | null;
817
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
818
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
819
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
729
820
  isActive: boolean;
730
821
  creator: {
731
822
  image: string | null;
732
823
  id: string;
733
824
  name: string;
734
825
  } | null;
826
+ tags: {
827
+ id: string;
828
+ name: string;
829
+ }[];
735
830
  _count?: {
736
831
  events: number;
737
832
  } | undefined;
@@ -755,12 +850,19 @@ export declare const create: {
755
850
  updatedAt: Date;
756
851
  createdByUserId: string | null;
757
852
  imageUrl: string | null;
853
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
854
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
855
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
758
856
  isActive: boolean;
759
857
  creator: {
760
858
  image: string | null;
761
859
  id: string;
762
860
  name: string;
763
861
  } | null;
862
+ tags: {
863
+ id: string;
864
+ name: string;
865
+ }[];
764
866
  _count?: {
765
867
  events: number;
766
868
  } | undefined;
@@ -810,30 +912,50 @@ export declare const update: {
810
912
  city: z.ZodOptional<z.ZodString>;
811
913
  state: z.ZodOptional<z.ZodString>;
812
914
  imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
915
+ skillLevel: z.ZodOptional<z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>>;
916
+ vibe: z.ZodOptional<z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>>;
917
+ activityFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>>;
918
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
813
919
  }, "strip", z.ZodTypeAny, {
814
920
  description?: string | undefined;
815
921
  name?: string | undefined;
816
922
  city?: string | undefined;
817
923
  state?: string | undefined;
818
924
  imageUrl?: string | null | undefined;
925
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
926
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
927
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
928
+ tags?: string[] | null | undefined;
819
929
  }, {
820
930
  description?: string | undefined;
821
931
  name?: string | undefined;
822
932
  city?: string | undefined;
823
933
  state?: string | undefined;
824
934
  imageUrl?: string | null | undefined;
935
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
936
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
937
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
938
+ tags?: string[] | null | undefined;
825
939
  }>, {
826
940
  description?: string | undefined;
827
941
  name?: string | undefined;
828
942
  city?: string | undefined;
829
943
  state?: string | undefined;
830
944
  imageUrl?: string | null | undefined;
945
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
946
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
947
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
948
+ tags?: string[] | null | undefined;
831
949
  }, {
832
950
  description?: string | undefined;
833
951
  name?: string | undefined;
834
952
  city?: string | undefined;
835
953
  state?: string | undefined;
836
954
  imageUrl?: string | null | undefined;
955
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
956
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
957
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
958
+ tags?: string[] | null | undefined;
837
959
  }>;
838
960
  };
839
961
  };
@@ -857,6 +979,9 @@ export declare const update: {
857
979
  externalUrl: z.ZodNullable<z.ZodString>;
858
980
  createdByUserId: z.ZodNullable<z.ZodString>;
859
981
  imageUrl: z.ZodNullable<z.ZodString>;
982
+ skillLevel: z.ZodNullable<z.ZodString>;
983
+ vibe: z.ZodNullable<z.ZodString>;
984
+ activityFrequency: z.ZodNullable<z.ZodString>;
860
985
  isActive: z.ZodBoolean;
861
986
  createdAt: z.ZodDate;
862
987
  updatedAt: z.ZodDate;
@@ -887,6 +1012,19 @@ export declare const update: {
887
1012
  id: string;
888
1013
  name: string;
889
1014
  }>>;
1015
+ skillLevel: z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
1016
+ vibe: z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
1017
+ activityFrequency: z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
1018
+ tags: z.ZodArray<z.ZodObject<{
1019
+ id: z.ZodString;
1020
+ name: z.ZodString;
1021
+ }, "strip", z.ZodTypeAny, {
1022
+ id: string;
1023
+ name: string;
1024
+ }, {
1025
+ id: string;
1026
+ name: string;
1027
+ }>, "many">;
890
1028
  _count: z.ZodOptional<z.ZodObject<{
891
1029
  events: z.ZodNumber;
892
1030
  }, "strip", z.ZodTypeAny, {
@@ -914,12 +1052,19 @@ export declare const update: {
914
1052
  updatedAt: Date;
915
1053
  createdByUserId: string | null;
916
1054
  imageUrl: string | null;
1055
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
1056
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
1057
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
917
1058
  isActive: boolean;
918
1059
  creator: {
919
1060
  image: string | null;
920
1061
  id: string;
921
1062
  name: string;
922
1063
  } | null;
1064
+ tags: {
1065
+ id: string;
1066
+ name: string;
1067
+ }[];
923
1068
  _count?: {
924
1069
  events: number;
925
1070
  } | undefined;
@@ -943,12 +1088,19 @@ export declare const update: {
943
1088
  updatedAt: Date;
944
1089
  createdByUserId: string | null;
945
1090
  imageUrl: string | null;
1091
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
1092
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
1093
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
946
1094
  isActive: boolean;
947
1095
  creator: {
948
1096
  image: string | null;
949
1097
  id: string;
950
1098
  name: string;
951
1099
  } | null;
1100
+ tags: {
1101
+ id: string;
1102
+ name: string;
1103
+ }[];
952
1104
  _count?: {
953
1105
  events: number;
954
1106
  } | undefined;
@@ -1,4 +1,8 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+ export declare const skillLevelEnum: z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>;
3
+ export declare const vibeEnum: z.ZodEnum<["casual", "competitive", "social", "fitness"]>;
4
+ export declare const activityFrequencyEnum: z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>;
5
+ export declare const tagsSchema: z.ZodArray<z.ZodString, "many">;
2
6
  export declare const groupWithRelationsSchema: z.ZodObject<z.objectUtil.extendShape<{
3
7
  id: z.ZodString;
4
8
  name: z.ZodString;
@@ -12,6 +16,9 @@ export declare const groupWithRelationsSchema: z.ZodObject<z.objectUtil.extendSh
12
16
  externalUrl: z.ZodNullable<z.ZodString>;
13
17
  createdByUserId: z.ZodNullable<z.ZodString>;
14
18
  imageUrl: z.ZodNullable<z.ZodString>;
19
+ skillLevel: z.ZodNullable<z.ZodString>;
20
+ vibe: z.ZodNullable<z.ZodString>;
21
+ activityFrequency: z.ZodNullable<z.ZodString>;
15
22
  isActive: z.ZodBoolean;
16
23
  createdAt: z.ZodDate;
17
24
  updatedAt: z.ZodDate;
@@ -42,6 +49,19 @@ export declare const groupWithRelationsSchema: z.ZodObject<z.objectUtil.extendSh
42
49
  id: string;
43
50
  name: string;
44
51
  }>>;
52
+ skillLevel: z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
53
+ vibe: z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
54
+ activityFrequency: z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
55
+ tags: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ name: z.ZodString;
58
+ }, "strip", z.ZodTypeAny, {
59
+ id: string;
60
+ name: string;
61
+ }, {
62
+ id: string;
63
+ name: string;
64
+ }>, "many">;
45
65
  _count: z.ZodOptional<z.ZodObject<{
46
66
  events: z.ZodNumber;
47
67
  }, "strip", z.ZodTypeAny, {
@@ -69,12 +89,19 @@ export declare const groupWithRelationsSchema: z.ZodObject<z.objectUtil.extendSh
69
89
  updatedAt: Date;
70
90
  createdByUserId: string | null;
71
91
  imageUrl: string | null;
92
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
93
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
94
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
72
95
  isActive: boolean;
73
96
  creator: {
74
97
  image: string | null;
75
98
  id: string;
76
99
  name: string;
77
100
  } | null;
101
+ tags: {
102
+ id: string;
103
+ name: string;
104
+ }[];
78
105
  _count?: {
79
106
  events: number;
80
107
  } | undefined;
@@ -98,12 +125,19 @@ export declare const groupWithRelationsSchema: z.ZodObject<z.objectUtil.extendSh
98
125
  updatedAt: Date;
99
126
  createdByUserId: string | null;
100
127
  imageUrl: string | null;
128
+ skillLevel: "advanced" | "beginner" | "intermediate" | "all-levels" | null;
129
+ vibe: "social" | "casual" | "competitive" | "fitness" | null;
130
+ activityFrequency: "weekly" | "biweekly" | "monthly" | "sporadic" | null;
101
131
  isActive: boolean;
102
132
  creator: {
103
133
  image: string | null;
104
134
  id: string;
105
135
  name: string;
106
136
  } | null;
137
+ tags: {
138
+ id: string;
139
+ name: string;
140
+ }[];
107
141
  _count?: {
108
142
  events: number;
109
143
  } | undefined;
@@ -141,6 +175,10 @@ export declare const createGroupBodySchema: z.ZodObject<{
141
175
  city: z.ZodOptional<z.ZodString>;
142
176
  state: z.ZodOptional<z.ZodString>;
143
177
  imageUrl: z.ZodOptional<z.ZodString>;
178
+ skillLevel: z.ZodOptional<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>;
179
+ vibe: z.ZodOptional<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>;
180
+ activityFrequency: z.ZodOptional<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>;
181
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
144
182
  }, "strip", z.ZodTypeAny, {
145
183
  name: string;
146
184
  sportId: string;
@@ -149,6 +187,10 @@ export declare const createGroupBodySchema: z.ZodObject<{
149
187
  state?: string | undefined;
150
188
  slug?: string | undefined;
151
189
  imageUrl?: string | undefined;
190
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
191
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
192
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
193
+ tags?: string[] | undefined;
152
194
  }, {
153
195
  name: string;
154
196
  sportId: string;
@@ -157,6 +199,10 @@ export declare const createGroupBodySchema: z.ZodObject<{
157
199
  state?: string | undefined;
158
200
  slug?: string | undefined;
159
201
  imageUrl?: string | undefined;
202
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | undefined;
203
+ vibe?: "social" | "casual" | "competitive" | "fitness" | undefined;
204
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | undefined;
205
+ tags?: string[] | undefined;
160
206
  }>;
161
207
  export declare const updateGroupBodySchema: z.ZodEffects<z.ZodObject<{
162
208
  name: z.ZodOptional<z.ZodString>;
@@ -164,30 +210,50 @@ export declare const updateGroupBodySchema: z.ZodEffects<z.ZodObject<{
164
210
  city: z.ZodOptional<z.ZodString>;
165
211
  state: z.ZodOptional<z.ZodString>;
166
212
  imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
213
+ skillLevel: z.ZodOptional<z.ZodNullable<z.ZodEnum<["beginner", "intermediate", "advanced", "all-levels"]>>>;
214
+ vibe: z.ZodOptional<z.ZodNullable<z.ZodEnum<["casual", "competitive", "social", "fitness"]>>>;
215
+ activityFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["weekly", "biweekly", "monthly", "sporadic"]>>>;
216
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
167
217
  }, "strip", z.ZodTypeAny, {
168
218
  description?: string | undefined;
169
219
  name?: string | undefined;
170
220
  city?: string | undefined;
171
221
  state?: string | undefined;
172
222
  imageUrl?: string | null | undefined;
223
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
224
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
225
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
226
+ tags?: string[] | null | undefined;
173
227
  }, {
174
228
  description?: string | undefined;
175
229
  name?: string | undefined;
176
230
  city?: string | undefined;
177
231
  state?: string | undefined;
178
232
  imageUrl?: string | null | undefined;
233
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
234
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
235
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
236
+ tags?: string[] | null | undefined;
179
237
  }>, {
180
238
  description?: string | undefined;
181
239
  name?: string | undefined;
182
240
  city?: string | undefined;
183
241
  state?: string | undefined;
184
242
  imageUrl?: string | null | undefined;
243
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
244
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
245
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
246
+ tags?: string[] | null | undefined;
185
247
  }, {
186
248
  description?: string | undefined;
187
249
  name?: string | undefined;
188
250
  city?: string | undefined;
189
251
  state?: string | undefined;
190
252
  imageUrl?: string | null | undefined;
253
+ skillLevel?: "advanced" | "beginner" | "intermediate" | "all-levels" | null | undefined;
254
+ vibe?: "social" | "casual" | "competitive" | "fitness" | null | undefined;
255
+ activityFrequency?: "weekly" | "biweekly" | "monthly" | "sporadic" | null | undefined;
256
+ tags?: string[] | null | undefined;
191
257
  }>;
192
258
  export declare const groupEventsQuerySchema: z.ZodObject<{
193
259
  from: z.ZodOptional<z.ZodDate>;
@@ -1,5 +1,9 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import { selectGroupSchema } from "../../../db/schema/index.js";
3
+ export const skillLevelEnum = z.enum(["beginner", "intermediate", "advanced", "all-levels"]);
4
+ export const vibeEnum = z.enum(["casual", "competitive", "social", "fitness"]);
5
+ export const activityFrequencyEnum = z.enum(["weekly", "biweekly", "monthly", "sporadic"]);
6
+ export const tagsSchema = z.array(z.string().max(50)).max(10);
3
7
  export const groupWithRelationsSchema = selectGroupSchema.extend({
4
8
  sport: z.object({
5
9
  id: z.string(),
@@ -11,6 +15,13 @@ export const groupWithRelationsSchema = selectGroupSchema.extend({
11
15
  name: z.string(),
12
16
  image: z.string().nullable(),
13
17
  }).nullable(),
18
+ skillLevel: skillLevelEnum.nullable(),
19
+ vibe: vibeEnum.nullable(),
20
+ activityFrequency: activityFrequencyEnum.nullable(),
21
+ tags: z.array(z.object({
22
+ id: z.string(),
23
+ name: z.string(),
24
+ })),
14
25
  _count: z.object({
15
26
  events: z.number(),
16
27
  }).optional(),
@@ -32,6 +43,10 @@ export const createGroupBodySchema = z.object({
32
43
  city: z.string().max(100).optional(),
33
44
  state: z.string().max(50).optional(),
34
45
  imageUrl: z.string().url().optional(),
46
+ skillLevel: skillLevelEnum.optional(),
47
+ vibe: vibeEnum.optional(),
48
+ activityFrequency: activityFrequencyEnum.optional(),
49
+ tags: tagsSchema.optional(),
35
50
  });
36
51
  export const updateGroupBodySchema = z.object({
37
52
  name: z.string().min(1).max(255).optional(),
@@ -39,6 +54,10 @@ export const updateGroupBodySchema = z.object({
39
54
  city: z.string().max(100).optional(),
40
55
  state: z.string().max(50).optional(),
41
56
  imageUrl: z.string().url().nullable().optional(),
57
+ skillLevel: skillLevelEnum.nullable().optional(),
58
+ vibe: vibeEnum.nullable().optional(),
59
+ activityFrequency: activityFrequencyEnum.nullable().optional(),
60
+ tags: tagsSchema.nullable().optional(),
42
61
  }).refine(data => Object.values(data).some(v => v !== undefined), { message: "At least one field must be provided" });
43
62
  export const groupEventsQuerySchema = z.object({
44
63
  from: z.coerce.date().optional(),
@@ -1 +1 @@
1
- export { type CreateGroupBody, createGroupBodySchema, groupEventsQuerySchema, type GroupWithRelations, groupWithRelationsSchema, type ListGroupsQuery, listGroupsQuerySchema, type UpdateGroupBody, updateGroupBodySchema, } from "./group.schemas.js";
1
+ export { activityFrequencyEnum, type CreateGroupBody, createGroupBodySchema, groupEventsQuerySchema, type GroupWithRelations, groupWithRelationsSchema, type ListGroupsQuery, listGroupsQuerySchema, skillLevelEnum, tagsSchema, type UpdateGroupBody, updateGroupBodySchema, vibeEnum, } from "./group.schemas.js";
@@ -1 +1 @@
1
- export { createGroupBodySchema, groupEventsQuerySchema, groupWithRelationsSchema, listGroupsQuerySchema, updateGroupBodySchema, } from "./group.schemas.js";
1
+ export { activityFrequencyEnum, createGroupBodySchema, groupEventsQuerySchema, groupWithRelationsSchema, listGroupsQuerySchema, skillLevelEnum, tagsSchema, updateGroupBodySchema, vibeEnum, } from "./group.schemas.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lcas58/esmi-api-types",
3
3
  "type": "module",
4
- "version": "1.0.29",
4
+ "version": "1.0.30",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {