@strong-together/shared 2.8.0 → 2.9.0
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/index.cjs +403 -428
- package/dist/index.d.cts +7 -374
- package/dist/index.d.ts +7 -374
- package/dist/index.js +484 -506
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var authProviders = identitySchema.enum("Auth Providers", [
|
|
|
38
38
|
]);
|
|
39
39
|
|
|
40
40
|
// ../../src/infrastructure/db/schema/drizzle/identity/user/table.ts
|
|
41
|
-
import { relations as relations14, sql as
|
|
41
|
+
import { relations as relations14, sql as drizzleSql21 } from "drizzle-orm";
|
|
42
42
|
import { bigint as bigint11, boolean as boolean6, primaryKey as primaryKey14, text as text8, timestamp as timestamp10, uniqueIndex as uniqueIndex4, uuid as uuid11 } from "drizzle-orm/pg-core";
|
|
43
43
|
|
|
44
44
|
// ../../src/infrastructure/db/schema/drizzle/messages/messages/table.ts
|
|
@@ -91,7 +91,7 @@ var message = messagesSchema.table("message", {
|
|
|
91
91
|
msg: text("msg").default("Hello World").notNull(),
|
|
92
92
|
sentAt: timestamp("sent_at", {
|
|
93
93
|
withTimezone: true
|
|
94
|
-
}).
|
|
94
|
+
}).defaultNow().notNull(),
|
|
95
95
|
isRead: boolean("is_read").default(false).notNull()
|
|
96
96
|
}, (t) => [
|
|
97
97
|
primaryKey({
|
|
@@ -143,7 +143,7 @@ var messageRelations = relations(message, ({ one }) => ({
|
|
|
143
143
|
}));
|
|
144
144
|
|
|
145
145
|
// ../../src/infrastructure/db/schema/drizzle/reminders/user_reminder_setting/table.ts
|
|
146
|
-
import { relations as relations2
|
|
146
|
+
import { relations as relations2 } from "drizzle-orm";
|
|
147
147
|
import { boolean as boolean2, foreignKey as foreignKey2, integer, primaryKey as primaryKey2, text as text2, timestamp as timestamp2, uuid as uuid2 } from "drizzle-orm/pg-core";
|
|
148
148
|
|
|
149
149
|
// ../../src/infrastructure/db/schema/drizzle/reminders/user_reminder_setting/policies.ts
|
|
@@ -188,7 +188,7 @@ var userReminderSetting = remindersSchema.table("user_reminder_setting", {
|
|
|
188
188
|
reminderOffsetMinutes: integer("reminder_offset_minutes").default(60).notNull(),
|
|
189
189
|
updatedAt: timestamp2("updated_at", {
|
|
190
190
|
withTimezone: true
|
|
191
|
-
}).
|
|
191
|
+
}).defaultNow().notNull(),
|
|
192
192
|
timezone: text2("timezone").default("'UTC'::text")
|
|
193
193
|
}, (t) => [
|
|
194
194
|
primaryKey2({
|
|
@@ -220,19 +220,19 @@ var userReminderSettingRelations = relations2(userReminderSetting, ({ one }) =>
|
|
|
220
220
|
}));
|
|
221
221
|
|
|
222
222
|
// ../../src/infrastructure/db/schema/drizzle/reminders/user_split_information/table.ts
|
|
223
|
-
import { relations as relations11, sql as
|
|
223
|
+
import { relations as relations11, sql as drizzleSql17 } from "drizzle-orm";
|
|
224
224
|
import { bigint as bigint9, foreignKey as foreignKey10, index as index8, integer as integer5, numeric, primaryKey as primaryKey11, timestamp as timestamp7, unique as unique4, uuid as uuid8 } from "drizzle-orm/pg-core";
|
|
225
225
|
|
|
226
226
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_split/table.ts
|
|
227
|
-
import { sql as
|
|
227
|
+
import { sql as drizzleSql16, relations as relations10 } from "drizzle-orm";
|
|
228
228
|
import { bigint as bigint8, boolean as boolean5, foreignKey as foreignKey9, index as index7, integer as integer4, primaryKey as primaryKey10, text as text5, timestamp as timestamp6, uniqueIndex as uniqueIndex3 } from "drizzle-orm/pg-core";
|
|
229
229
|
|
|
230
230
|
// ../../src/infrastructure/db/schema/drizzle/tracking/workout_summary/table.ts
|
|
231
|
-
import { relations as relations8, sql as
|
|
231
|
+
import { relations as relations8, sql as drizzleSql12 } from "drizzle-orm";
|
|
232
232
|
import { bigint as bigint6, foreignKey as foreignKey7, index as index6, primaryKey as primaryKey8, timestamp as timestamp4, uuid as uuid6 } from "drizzle-orm/pg-core";
|
|
233
233
|
|
|
234
234
|
// ../../src/infrastructure/db/schema/drizzle/tracking/exercise_tracking/table.ts
|
|
235
|
-
import { relations as relations7, sql as
|
|
235
|
+
import { relations as relations7, sql as drizzleSql10 } from "drizzle-orm";
|
|
236
236
|
import { bigint as bigint5, foreignKey as foreignKey6, index as index5, primaryKey as primaryKey7, text as text4, uuid as uuid5 } from "drizzle-orm/pg-core";
|
|
237
237
|
|
|
238
238
|
// ../../src/infrastructure/db/schema/drizzle/workout/exercises/table.ts
|
|
@@ -240,7 +240,7 @@ import { relations as relations5 } from "drizzle-orm";
|
|
|
240
240
|
import { bigint as bigint3, primaryKey as primaryKey5, text as text3, uniqueIndex } from "drizzle-orm/pg-core";
|
|
241
241
|
|
|
242
242
|
// ../../src/infrastructure/db/schema/drizzle/workout/exercisetoworkoutsplit/table.ts
|
|
243
|
-
import { relations as relations4, sql as
|
|
243
|
+
import { relations as relations4, sql as drizzleSql6 } from "drizzle-orm";
|
|
244
244
|
import { bigint as bigint2, boolean as boolean3, foreignKey as foreignKey4, index as index3, primaryKey as primaryKey4, timestamp as timestamp3, unique as unique2 } from "drizzle-orm/pg-core";
|
|
245
245
|
|
|
246
246
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_set/table.ts
|
|
@@ -248,11 +248,11 @@ import { relations as relations3 } from "drizzle-orm";
|
|
|
248
248
|
import { bigint, foreignKey as foreignKey3, index as index2, integer as integer2, primaryKey as primaryKey3, unique, uuid as uuid3 } from "drizzle-orm/pg-core";
|
|
249
249
|
|
|
250
250
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_set/policies.ts
|
|
251
|
-
import { sql as
|
|
251
|
+
import { sql as drizzleSql4 } from "drizzle-orm";
|
|
252
252
|
import { pgPolicy as pgPolicy3 } from "drizzle-orm/pg-core";
|
|
253
|
-
var currentUserId =
|
|
253
|
+
var currentUserId = drizzleSql4`"identity"."current_user_id"()`;
|
|
254
254
|
function workoutSetPolicies(table) {
|
|
255
|
-
const ownsWorkoutSet =
|
|
255
|
+
const ownsWorkoutSet = drizzleSql4`exists (
|
|
256
256
|
select 1
|
|
257
257
|
from "workout"."exercise_to_workout_split" ets
|
|
258
258
|
join "workout"."workout_split" ws on ws."id" = ets."workout_split_id"
|
|
@@ -330,12 +330,12 @@ var workoutSetRelations = relations3(workoutSet, ({ one }) => ({
|
|
|
330
330
|
}));
|
|
331
331
|
|
|
332
332
|
// ../../src/infrastructure/db/schema/drizzle/workout/exercisetoworkoutsplit/policies.ts
|
|
333
|
-
import { sql as
|
|
333
|
+
import { sql as drizzleSql5 } from "drizzle-orm";
|
|
334
334
|
import { pgPolicy as pgPolicy4 } from "drizzle-orm/pg-core";
|
|
335
|
-
var uid4 =
|
|
335
|
+
var uid4 = drizzleSql5`"identity"."current_user_id"()`;
|
|
336
336
|
function exerciseToWorkoutSplitPolicies(t) {
|
|
337
|
-
const owns =
|
|
338
|
-
const ownsForDelete =
|
|
337
|
+
const owns = drizzleSql5`${uid4} = (select wp."user_id" from "workout"."workout_plan" wp join "workout"."workout_split" ws on ws."workout_id" = wp."id" where ws."id" = ${t.workoutSplitId})`;
|
|
338
|
+
const ownsForDelete = drizzleSql5`exists (select 1 from "workout"."workout_split" ws join "workout"."workout_plan" wp on wp."id" = ws."workout_id" where ws."id" = ${t.workoutSplitId} and wp."user_id" = ${uid4})`;
|
|
339
339
|
return [
|
|
340
340
|
// Lets authenticated users read exercise assignments in splits they own.
|
|
341
341
|
pgPolicy4("Enable read access for auth users on exercise_to_workout_split", {
|
|
@@ -381,7 +381,7 @@ var exerciseToWorkoutSplit = workoutSchema.table("exercise_to_workout_split", {
|
|
|
381
381
|
}).notNull(),
|
|
382
382
|
createdAt: timestamp3("created_at", {
|
|
383
383
|
withTimezone: true
|
|
384
|
-
}).
|
|
384
|
+
}).defaultNow().notNull(),
|
|
385
385
|
orderIndex: bigint2("order_index", {
|
|
386
386
|
mode: "number"
|
|
387
387
|
}).notNull(),
|
|
@@ -412,7 +412,7 @@ var exerciseToWorkoutSplit = workoutSchema.table("exercise_to_workout_split", {
|
|
|
412
412
|
workoutSplit.id
|
|
413
413
|
]
|
|
414
414
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
415
|
-
index3("exercise_to_workout_split_active_idx").on(t.workoutSplitId, t.orderIndex).where(
|
|
415
|
+
index3("exercise_to_workout_split_active_idx").on(t.workoutSplitId, t.orderIndex).where(drizzleSql6`${t.isActive} = true`),
|
|
416
416
|
index3("exercise_to_workout_split_workout_split_id_order_index_idx").on(t.workoutSplitId, t.orderIndex),
|
|
417
417
|
...exerciseToWorkoutSplitPolicies(t)
|
|
418
418
|
]);
|
|
@@ -438,14 +438,14 @@ var exerciseToWorkoutSplitRelations = relations4(exerciseToWorkoutSplit, ({ many
|
|
|
438
438
|
}));
|
|
439
439
|
|
|
440
440
|
// ../../src/infrastructure/db/schema/drizzle/workout/exercises/policies.ts
|
|
441
|
-
import { sql as
|
|
441
|
+
import { sql as drizzleSql7 } from "drizzle-orm";
|
|
442
442
|
import { pgPolicy as pgPolicy5 } from "drizzle-orm/pg-core";
|
|
443
443
|
var exercisePolicies = /* @__PURE__ */ __name(() => [
|
|
444
444
|
// Makes the shared exercise catalog readable to every authenticated user.
|
|
445
445
|
pgPolicy5("Allow all authenticated users to read exercise", {
|
|
446
446
|
for: "select",
|
|
447
447
|
to: authenticatedRole,
|
|
448
|
-
using:
|
|
448
|
+
using: drizzleSql7`true`
|
|
449
449
|
})
|
|
450
450
|
], "exercisePolicies");
|
|
451
451
|
|
|
@@ -479,11 +479,11 @@ import { relations as relations6 } from "drizzle-orm";
|
|
|
479
479
|
import { bigint as bigint4, foreignKey as foreignKey5, index as index4, integer as integer3, primaryKey as primaryKey6, real, unique as unique3, uuid as uuid4 } from "drizzle-orm/pg-core";
|
|
480
480
|
|
|
481
481
|
// ../../src/infrastructure/db/schema/drizzle/tracking/tracking_set/policies.ts
|
|
482
|
-
import { sql as
|
|
482
|
+
import { sql as drizzleSql8 } from "drizzle-orm";
|
|
483
483
|
import { pgPolicy as pgPolicy6 } from "drizzle-orm/pg-core";
|
|
484
|
-
var currentUserId2 =
|
|
484
|
+
var currentUserId2 = drizzleSql8`"identity"."current_user_id"()`;
|
|
485
485
|
function trackingSetPolicies(table) {
|
|
486
|
-
const ownsExerciseTracking =
|
|
486
|
+
const ownsExerciseTracking = drizzleSql8`exists (
|
|
487
487
|
select 1
|
|
488
488
|
from "tracking"."exercise_tracking" et
|
|
489
489
|
join "tracking"."workout_summary" ws on ws."id" = et."workout_summary_id"
|
|
@@ -561,11 +561,11 @@ var trackingSetRelations = relations6(trackingSet, ({ one }) => ({
|
|
|
561
561
|
}));
|
|
562
562
|
|
|
563
563
|
// ../../src/infrastructure/db/schema/drizzle/tracking/exercise_tracking/policies.ts
|
|
564
|
-
import { sql as
|
|
564
|
+
import { sql as drizzleSql9 } from "drizzle-orm";
|
|
565
565
|
import { pgPolicy as pgPolicy7 } from "drizzle-orm/pg-core";
|
|
566
|
-
var uid5 =
|
|
566
|
+
var uid5 = drizzleSql9`"identity"."current_user_id"()`;
|
|
567
567
|
function exerciseTrackingPolicies(t) {
|
|
568
|
-
const owns =
|
|
568
|
+
const owns = drizzleSql9`exists (select 1 from "tracking"."workout_summary" ws where ws."id" = ${t.workoutSummaryId} and ws."user_id" = ${uid5})`;
|
|
569
569
|
return [
|
|
570
570
|
// Lets authenticated users read exercise tracking rows through summaries they own.
|
|
571
571
|
pgPolicy7("exercise_tracking_select_by_summary_owner", {
|
|
@@ -646,7 +646,7 @@ var exerciseTracking = trackingSchema.table("exercise_tracking", {
|
|
|
646
646
|
workoutSummary.id
|
|
647
647
|
]
|
|
648
648
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
649
|
-
check("exercise_tracking_xor_check",
|
|
649
|
+
check("exercise_tracking_xor_check", drizzleSql10`num_nonnulls(${t.exerciseToSplitId}, ${t.exerciseId}) = 1`),
|
|
650
650
|
index5("exercise_tracking_workout_summary_id_idx").on(t.workoutSummaryId),
|
|
651
651
|
...exerciseTrackingPolicies(t)
|
|
652
652
|
]);
|
|
@@ -679,35 +679,35 @@ var exerciseTrackingRelations = relations7(exerciseTracking, ({ many, one }) =>
|
|
|
679
679
|
}));
|
|
680
680
|
|
|
681
681
|
// ../../src/infrastructure/db/schema/drizzle/tracking/workout_summary/policies.ts
|
|
682
|
-
import { sql as
|
|
682
|
+
import { sql as drizzleSql11 } from "drizzle-orm";
|
|
683
683
|
import { pgPolicy as pgPolicy8 } from "drizzle-orm/pg-core";
|
|
684
|
-
var uid6 =
|
|
684
|
+
var uid6 = drizzleSql11`"identity"."current_user_id"()`;
|
|
685
685
|
function workoutSummaryPolicies(t) {
|
|
686
686
|
return [
|
|
687
687
|
// Lets authenticated users read only their own completed workout summaries.
|
|
688
688
|
pgPolicy8("users can read their workout summaries", {
|
|
689
689
|
for: "select",
|
|
690
690
|
to: authenticatedRole,
|
|
691
|
-
using:
|
|
691
|
+
using: drizzleSql11`${t.userId} = ${uid6}`
|
|
692
692
|
}),
|
|
693
693
|
// Lets authenticated users insert completed workout summaries only for themselves.
|
|
694
694
|
pgPolicy8("users can insert their workout summaries", {
|
|
695
695
|
for: "insert",
|
|
696
696
|
to: authenticatedRole,
|
|
697
|
-
withCheck:
|
|
697
|
+
withCheck: drizzleSql11`${t.userId} = ${uid6}`
|
|
698
698
|
}),
|
|
699
699
|
// Lets authenticated users update only their own completed workout summaries.
|
|
700
700
|
pgPolicy8("users can update their workout summaries", {
|
|
701
701
|
for: "update",
|
|
702
702
|
to: authenticatedRole,
|
|
703
|
-
using:
|
|
704
|
-
withCheck:
|
|
703
|
+
using: drizzleSql11`${t.userId} = ${uid6}`,
|
|
704
|
+
withCheck: drizzleSql11`${t.userId} = ${uid6}`
|
|
705
705
|
}),
|
|
706
706
|
// Lets authenticated users delete only their own completed workout summaries.
|
|
707
707
|
pgPolicy8("users can delete their workout summaries", {
|
|
708
708
|
for: "delete",
|
|
709
709
|
to: authenticatedRole,
|
|
710
|
-
using:
|
|
710
|
+
using: drizzleSql11`${t.userId} = ${uid6}`
|
|
711
711
|
})
|
|
712
712
|
];
|
|
713
713
|
}
|
|
@@ -754,7 +754,7 @@ var workoutSummary = trackingSchema.table("workout_summary", {
|
|
|
754
754
|
workoutSplit.id
|
|
755
755
|
]
|
|
756
756
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
757
|
-
index6("workout_summary_start_date_idx").on(
|
|
757
|
+
index6("workout_summary_start_date_idx").on(drizzleSql12`((${t.workoutStartUtc} at time zone 'UTC')::date)`),
|
|
758
758
|
index6("workout_summary_user_start_utc_idx").on(t.userId, t.workoutStartUtc.desc().nullsFirst()),
|
|
759
759
|
...workoutSummaryPolicies(t)
|
|
760
760
|
]);
|
|
@@ -779,39 +779,39 @@ var workoutSummaryRelations = relations8(workoutSummary, ({ many, one }) => ({
|
|
|
779
779
|
}));
|
|
780
780
|
|
|
781
781
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_plan/table.ts
|
|
782
|
-
import { relations as relations9, sql as
|
|
782
|
+
import { relations as relations9, sql as drizzleSql14 } from "drizzle-orm";
|
|
783
783
|
import { bigint as bigint7, boolean as boolean4, foreignKey as foreignKey8, primaryKey as primaryKey9, timestamp as timestamp5, uniqueIndex as uniqueIndex2, uuid as uuid7 } from "drizzle-orm/pg-core";
|
|
784
784
|
|
|
785
785
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_plan/policies.ts
|
|
786
|
-
import { sql as
|
|
786
|
+
import { sql as drizzleSql13 } from "drizzle-orm";
|
|
787
787
|
import { pgPolicy as pgPolicy9 } from "drizzle-orm/pg-core";
|
|
788
|
-
var uid7 =
|
|
788
|
+
var uid7 = drizzleSql13`"identity"."current_user_id"()`;
|
|
789
789
|
function workoutPlanPolicies(t) {
|
|
790
790
|
return [
|
|
791
791
|
// Lets authenticated users read only workout plans they own.
|
|
792
792
|
pgPolicy9("Enable read access for auth users on workout_plan", {
|
|
793
793
|
for: "select",
|
|
794
794
|
to: authenticatedRole,
|
|
795
|
-
using:
|
|
795
|
+
using: drizzleSql13`${uid7} = ${t.userId}`
|
|
796
796
|
}),
|
|
797
797
|
// Lets authenticated users create workout plans only for themselves.
|
|
798
798
|
pgPolicy9("Enable insert for auth users on workout_plan", {
|
|
799
799
|
for: "insert",
|
|
800
800
|
to: authenticatedRole,
|
|
801
|
-
withCheck:
|
|
801
|
+
withCheck: drizzleSql13`${uid7} = ${t.userId}`
|
|
802
802
|
}),
|
|
803
803
|
// Lets authenticated users update only workout plans they own.
|
|
804
804
|
pgPolicy9("Enable update for auth users on workout_plan", {
|
|
805
805
|
for: "update",
|
|
806
806
|
to: authenticatedRole,
|
|
807
|
-
using:
|
|
808
|
-
withCheck:
|
|
807
|
+
using: drizzleSql13`${uid7} = ${t.userId}`,
|
|
808
|
+
withCheck: drizzleSql13`${uid7} = ${t.userId}`
|
|
809
809
|
}),
|
|
810
810
|
// Lets authenticated users delete only workout plans they own.
|
|
811
811
|
pgPolicy9("Enable delete for auth users on workout_plan", {
|
|
812
812
|
for: "delete",
|
|
813
813
|
to: authenticatedRole,
|
|
814
|
-
using:
|
|
814
|
+
using: drizzleSql13`${uid7} = ${t.userId}`
|
|
815
815
|
})
|
|
816
816
|
];
|
|
817
817
|
}
|
|
@@ -828,7 +828,7 @@ var workoutPlan = workoutSchema.table("workout_plan", {
|
|
|
828
828
|
isActive: boolean4("is_active").default(true).notNull(),
|
|
829
829
|
updatedAt: timestamp5("updated_at", {
|
|
830
830
|
withTimezone: true
|
|
831
|
-
}).
|
|
831
|
+
}).defaultNow().notNull(),
|
|
832
832
|
createdAt: timestamp5("created_at", {
|
|
833
833
|
withTimezone: true
|
|
834
834
|
}).defaultNow().notNull()
|
|
@@ -848,7 +848,7 @@ var workoutPlan = workoutSchema.table("workout_plan", {
|
|
|
848
848
|
user.id
|
|
849
849
|
]
|
|
850
850
|
}).onUpdate("cascade").onDelete("cascade"),
|
|
851
|
-
uniqueIndex2("uq_workout_plan_active_user").on(t.userId).where(
|
|
851
|
+
uniqueIndex2("uq_workout_plan_active_user").on(t.userId).where(drizzleSql14`${t.isActive}`),
|
|
852
852
|
...workoutPlanPolicies(t)
|
|
853
853
|
]);
|
|
854
854
|
var workoutPlanRelations = relations9(workoutPlan, ({ many, one }) => ({
|
|
@@ -865,12 +865,12 @@ var workoutPlanRelations = relations9(workoutPlan, ({ many, one }) => ({
|
|
|
865
865
|
}));
|
|
866
866
|
|
|
867
867
|
// ../../src/infrastructure/db/schema/drizzle/workout/workout_split/policies.ts
|
|
868
|
-
import { sql as
|
|
868
|
+
import { sql as drizzleSql15 } from "drizzle-orm";
|
|
869
869
|
import { pgPolicy as pgPolicy10 } from "drizzle-orm/pg-core";
|
|
870
|
-
var uid8 =
|
|
870
|
+
var uid8 = drizzleSql15`"identity"."current_user_id"()`;
|
|
871
871
|
function workoutSplitPolicies(t) {
|
|
872
|
-
const owns =
|
|
873
|
-
const ownsForDelete =
|
|
872
|
+
const owns = drizzleSql15`${uid8} = (select wp."user_id" from "workout"."workout_plan" wp where wp."id" = ${t.workoutId})`;
|
|
873
|
+
const ownsForDelete = drizzleSql15`exists (select 1 from "workout"."workout_plan" wp where wp."id" = ${t.workoutId} and wp."user_id" = ${uid8})`;
|
|
874
874
|
return [
|
|
875
875
|
// Lets authenticated users read splits belonging to their own plans.
|
|
876
876
|
pgPolicy10("Enable read access for auth users on workout_split", {
|
|
@@ -915,7 +915,7 @@ var workoutSplit = workoutSchema.table("workout_split", {
|
|
|
915
915
|
orderIndex: integer4("order_index").notNull(),
|
|
916
916
|
createdAt: timestamp6("created_at", {
|
|
917
917
|
withTimezone: true
|
|
918
|
-
}).
|
|
918
|
+
}).defaultNow().notNull(),
|
|
919
919
|
isActive: boolean5("is_active").default(true).notNull()
|
|
920
920
|
}, (t) => [
|
|
921
921
|
primaryKey10({
|
|
@@ -924,7 +924,7 @@ var workoutSplit = workoutSchema.table("workout_split", {
|
|
|
924
924
|
t.id
|
|
925
925
|
]
|
|
926
926
|
}),
|
|
927
|
-
uniqueIndex3("uq_active_workout_split_order_index").on(t.workoutId, t.orderIndex).where(
|
|
927
|
+
uniqueIndex3("uq_active_workout_split_order_index").on(t.workoutId, t.orderIndex).where(drizzleSql16`${t.isActive} = TRUE`),
|
|
928
928
|
foreignKey9({
|
|
929
929
|
name: "workout_split_workout_id_fkey",
|
|
930
930
|
columns: [
|
|
@@ -971,7 +971,7 @@ var userSplitInformation = remindersSchema.table("user_split_information", {
|
|
|
971
971
|
}).default("1.00").notNull(),
|
|
972
972
|
lastComputedAt: timestamp7("last_computed_at", {
|
|
973
973
|
withTimezone: true
|
|
974
|
-
}).
|
|
974
|
+
}).defaultNow().notNull(),
|
|
975
975
|
preferredWeekday: integer5("preferred_weekday")
|
|
976
976
|
}, (t) => [
|
|
977
977
|
primaryKey11({
|
|
@@ -999,8 +999,8 @@ var userSplitInformation = remindersSchema.table("user_split_information", {
|
|
|
999
999
|
workoutSplit.id
|
|
1000
1000
|
]
|
|
1001
1001
|
}).onDelete("cascade"),
|
|
1002
|
-
index8("user_split_information_confidence_idx").on(t.preferredWeekday, t.confidence).where(
|
|
1003
|
-
index8("user_split_information_user_weekday_idx").on(t.userId, t.preferredWeekday).where(
|
|
1002
|
+
index8("user_split_information_confidence_idx").on(t.preferredWeekday, t.confidence).where(drizzleSql17`${t.confidence} >= 0.60`),
|
|
1003
|
+
index8("user_split_information_user_weekday_idx").on(t.userId, t.preferredWeekday).where(drizzleSql17`${t.preferredWeekday} is not null`)
|
|
1004
1004
|
]).enableRLS();
|
|
1005
1005
|
var userSplitInformationRelations = relations11(userSplitInformation, ({ one }) => ({
|
|
1006
1006
|
user: one(user, {
|
|
@@ -1022,39 +1022,39 @@ var userSplitInformationRelations = relations11(userSplitInformation, ({ one })
|
|
|
1022
1022
|
}));
|
|
1023
1023
|
|
|
1024
1024
|
// ../../src/infrastructure/db/schema/drizzle/tracking/aerobic_tracking/table.ts
|
|
1025
|
-
import { relations as relations12
|
|
1025
|
+
import { relations as relations12 } from "drizzle-orm";
|
|
1026
1026
|
import { bigint as bigint10, foreignKey as foreignKey11, index as index9, primaryKey as primaryKey12, text as text6, timestamp as timestamp8, uuid as uuid9 } from "drizzle-orm/pg-core";
|
|
1027
1027
|
|
|
1028
1028
|
// ../../src/infrastructure/db/schema/drizzle/tracking/aerobic_tracking/policies.ts
|
|
1029
|
-
import { sql as
|
|
1029
|
+
import { sql as drizzleSql18 } from "drizzle-orm";
|
|
1030
1030
|
import { pgPolicy as pgPolicy11 } from "drizzle-orm/pg-core";
|
|
1031
|
-
var uid9 =
|
|
1031
|
+
var uid9 = drizzleSql18`"identity"."current_user_id"()`;
|
|
1032
1032
|
function aerobicTrackingPolicies(t) {
|
|
1033
1033
|
return [
|
|
1034
1034
|
// Lets authenticated users read only their own aerobic tracking rows.
|
|
1035
1035
|
pgPolicy11("Enable read access for auth users on aerobic_tracking", {
|
|
1036
1036
|
for: "select",
|
|
1037
1037
|
to: authenticatedRole,
|
|
1038
|
-
using:
|
|
1038
|
+
using: drizzleSql18`${uid9} = ${t.userId}`
|
|
1039
1039
|
}),
|
|
1040
1040
|
// Lets authenticated users insert aerobic tracking rows only for themselves.
|
|
1041
1041
|
pgPolicy11("Enable insert for auth users on aerobic_tracking", {
|
|
1042
1042
|
for: "insert",
|
|
1043
1043
|
to: authenticatedRole,
|
|
1044
|
-
withCheck:
|
|
1044
|
+
withCheck: drizzleSql18`${uid9} = ${t.userId}`
|
|
1045
1045
|
}),
|
|
1046
1046
|
// Lets authenticated users update only their own aerobic tracking rows.
|
|
1047
1047
|
pgPolicy11("Enable update for auth users on aerobic_tracking", {
|
|
1048
1048
|
for: "update",
|
|
1049
1049
|
to: authenticatedRole,
|
|
1050
|
-
using:
|
|
1051
|
-
withCheck:
|
|
1050
|
+
using: drizzleSql18`${uid9} = ${t.userId}`,
|
|
1051
|
+
withCheck: drizzleSql18`${uid9} = ${t.userId}`
|
|
1052
1052
|
}),
|
|
1053
1053
|
// Lets authenticated users delete only their own aerobic tracking rows.
|
|
1054
1054
|
pgPolicy11("Enable delete for auth users on aerobic_tracking", {
|
|
1055
1055
|
for: "delete",
|
|
1056
1056
|
to: authenticatedRole,
|
|
1057
|
-
using:
|
|
1057
|
+
using: drizzleSql18`${uid9} = ${t.userId}`
|
|
1058
1058
|
})
|
|
1059
1059
|
];
|
|
1060
1060
|
}
|
|
@@ -1074,7 +1074,7 @@ var aerobicTracking = trackingSchema.table("aerobic_tracking", {
|
|
|
1074
1074
|
}).default(0).notNull(),
|
|
1075
1075
|
workoutTimeUtc: timestamp8("workout_time_utc", {
|
|
1076
1076
|
withTimezone: true
|
|
1077
|
-
}).
|
|
1077
|
+
}).defaultNow().notNull()
|
|
1078
1078
|
}, (t) => [
|
|
1079
1079
|
primaryKey12({
|
|
1080
1080
|
name: "aerobic_tracking_pkey",
|
|
@@ -1106,39 +1106,39 @@ var aerobicTrackingRelations = relations12(aerobicTracking, ({ one }) => ({
|
|
|
1106
1106
|
}));
|
|
1107
1107
|
|
|
1108
1108
|
// ../../src/infrastructure/db/schema/drizzle/identity/oauth_account/table.ts
|
|
1109
|
-
import { relations as relations13
|
|
1109
|
+
import { relations as relations13 } from "drizzle-orm";
|
|
1110
1110
|
import { foreignKey as foreignKey12, primaryKey as primaryKey13, text as text7, timestamp as timestamp9, unique as unique5, uuid as uuid10 } from "drizzle-orm/pg-core";
|
|
1111
1111
|
|
|
1112
1112
|
// ../../src/infrastructure/db/schema/drizzle/identity/oauth_account/policies.ts
|
|
1113
|
-
import { sql as
|
|
1113
|
+
import { sql as drizzleSql19 } from "drizzle-orm";
|
|
1114
1114
|
import { pgPolicy as pgPolicy12 } from "drizzle-orm/pg-core";
|
|
1115
|
-
var currentUserId3 =
|
|
1115
|
+
var currentUserId3 = drizzleSql19`"identity"."current_user_id"()`;
|
|
1116
1116
|
function oauthAccountPolicies(table) {
|
|
1117
1117
|
return [
|
|
1118
1118
|
// Lets authenticated users read only OAuth accounts linked to themselves.
|
|
1119
1119
|
pgPolicy12("Enable read access for auth users on oauth_account", {
|
|
1120
1120
|
for: "select",
|
|
1121
1121
|
to: authenticatedRole,
|
|
1122
|
-
using:
|
|
1122
|
+
using: drizzleSql19`${currentUserId3} = ${table.userId}`
|
|
1123
1123
|
}),
|
|
1124
1124
|
// Lets authenticated users link OAuth accounts only to themselves.
|
|
1125
1125
|
pgPolicy12("Enable insert for auth users on oauth_account", {
|
|
1126
1126
|
for: "insert",
|
|
1127
1127
|
to: authenticatedRole,
|
|
1128
|
-
withCheck:
|
|
1128
|
+
withCheck: drizzleSql19`${currentUserId3} = ${table.userId}`
|
|
1129
1129
|
}),
|
|
1130
1130
|
// Lets authenticated users update only OAuth accounts linked to themselves.
|
|
1131
1131
|
pgPolicy12("Enable update for auth users on oauth_account", {
|
|
1132
1132
|
for: "update",
|
|
1133
1133
|
to: authenticatedRole,
|
|
1134
|
-
using:
|
|
1135
|
-
withCheck:
|
|
1134
|
+
using: drizzleSql19`${currentUserId3} = ${table.userId}`,
|
|
1135
|
+
withCheck: drizzleSql19`${currentUserId3} = ${table.userId}`
|
|
1136
1136
|
}),
|
|
1137
1137
|
// Lets authenticated users delete only OAuth accounts linked to themselves.
|
|
1138
1138
|
pgPolicy12("Enable delete for auth users on oauth_account", {
|
|
1139
1139
|
for: "delete",
|
|
1140
1140
|
to: authenticatedRole,
|
|
1141
|
-
using:
|
|
1141
|
+
using: drizzleSql19`${currentUserId3} = ${table.userId}`
|
|
1142
1142
|
})
|
|
1143
1143
|
];
|
|
1144
1144
|
}
|
|
@@ -1153,7 +1153,7 @@ var oauthAccount = identitySchema.table("oauth_account", {
|
|
|
1153
1153
|
providerEmail: text7("provider_email").notNull(),
|
|
1154
1154
|
linkedAt: timestamp9("linked_at", {
|
|
1155
1155
|
withTimezone: true
|
|
1156
|
-
}).
|
|
1156
|
+
}).defaultNow().notNull(),
|
|
1157
1157
|
missingFields: text7("missing_fields")
|
|
1158
1158
|
}, (t) => [
|
|
1159
1159
|
primaryKey13({
|
|
@@ -1186,47 +1186,47 @@ var oauthAccountRelations = relations13(oauthAccount, ({ one }) => ({
|
|
|
1186
1186
|
}));
|
|
1187
1187
|
|
|
1188
1188
|
// ../../src/infrastructure/db/schema/drizzle/identity/user/policies.ts
|
|
1189
|
-
import { sql as
|
|
1189
|
+
import { sql as drizzleSql20 } from "drizzle-orm";
|
|
1190
1190
|
import { pgPolicy as pgPolicy13 } from "drizzle-orm/pg-core";
|
|
1191
|
-
var currentUserId4 =
|
|
1191
|
+
var currentUserId4 = drizzleSql20`"identity"."current_user_id"()`;
|
|
1192
1192
|
function userPolicies(table) {
|
|
1193
1193
|
return [
|
|
1194
1194
|
// Lets an authenticated user read their own profile.
|
|
1195
1195
|
pgPolicy13("Enable read access for auth users on own profile", {
|
|
1196
1196
|
for: "select",
|
|
1197
1197
|
to: authenticatedRole,
|
|
1198
|
-
using:
|
|
1198
|
+
using: drizzleSql20`${currentUserId4} = ${table.id}`
|
|
1199
1199
|
}),
|
|
1200
1200
|
// Lets a message receiver read the profile of a sender in their inbox.
|
|
1201
1201
|
pgPolicy13("Allow user to view senders in their messages", {
|
|
1202
1202
|
for: "select",
|
|
1203
1203
|
to: authenticatedRole,
|
|
1204
|
-
using:
|
|
1204
|
+
using: drizzleSql20`exists (select 1 from "messages"."message" m where m."sender_id" = ${table.id} and m."receiver_id" = ${currentUserId4})`
|
|
1205
1205
|
}),
|
|
1206
1206
|
// Lets an authenticated user create only their own profile row.
|
|
1207
1207
|
pgPolicy13("Enable insert for auth users on own profile", {
|
|
1208
1208
|
for: "insert",
|
|
1209
1209
|
to: authenticatedRole,
|
|
1210
|
-
withCheck:
|
|
1210
|
+
withCheck: drizzleSql20`${currentUserId4} = ${table.id}`
|
|
1211
1211
|
}),
|
|
1212
1212
|
// Preserves the legacy public self-registration policy for compatibility.
|
|
1213
1213
|
pgPolicy13("Enable insert for public users on own profile", {
|
|
1214
1214
|
for: "insert",
|
|
1215
1215
|
to: "public",
|
|
1216
|
-
withCheck:
|
|
1216
|
+
withCheck: drizzleSql20`${currentUserId4} = ${table.id}`
|
|
1217
1217
|
}),
|
|
1218
1218
|
// Lets an authenticated user update only their own profile.
|
|
1219
1219
|
pgPolicy13("Enable update for auth users on own profile", {
|
|
1220
1220
|
for: "update",
|
|
1221
1221
|
to: authenticatedRole,
|
|
1222
|
-
using:
|
|
1223
|
-
withCheck:
|
|
1222
|
+
using: drizzleSql20`${currentUserId4} = ${table.id}`,
|
|
1223
|
+
withCheck: drizzleSql20`${currentUserId4} = ${table.id}`
|
|
1224
1224
|
}),
|
|
1225
1225
|
// Lets an authenticated user delete only their own profile.
|
|
1226
1226
|
pgPolicy13("Enable delete for auth users on own profile", {
|
|
1227
1227
|
for: "delete",
|
|
1228
1228
|
to: authenticatedRole,
|
|
1229
|
-
using:
|
|
1229
|
+
using: drizzleSql20`${currentUserId4} = ${table.id}`
|
|
1230
1230
|
})
|
|
1231
1231
|
];
|
|
1232
1232
|
}
|
|
@@ -1240,10 +1240,10 @@ var user = identitySchema.table("user", {
|
|
|
1240
1240
|
gender: text8("gender").default("Unknown").notNull(),
|
|
1241
1241
|
createdAt: timestamp10("created_at", {
|
|
1242
1242
|
withTimezone: true
|
|
1243
|
-
}).
|
|
1243
|
+
}).defaultNow().notNull(),
|
|
1244
1244
|
updatedAt: timestamp10("updated_at", {
|
|
1245
1245
|
withTimezone: true
|
|
1246
|
-
}).
|
|
1246
|
+
}).defaultNow().notNull(),
|
|
1247
1247
|
profilePicPath: text8("profile_pic_path"),
|
|
1248
1248
|
id: uuid11("id").defaultRandom().notNull(),
|
|
1249
1249
|
pushToken: text8("push_token"),
|
|
@@ -1264,8 +1264,8 @@ var user = identitySchema.table("user", {
|
|
|
1264
1264
|
t.id
|
|
1265
1265
|
]
|
|
1266
1266
|
}),
|
|
1267
|
-
uniqueIndex4("user_email_ci_unique").on(
|
|
1268
|
-
uniqueIndex4("user_username_ci_unique").on(
|
|
1267
|
+
uniqueIndex4("user_email_ci_unique").on(drizzleSql21`lower(trim(both from ${t.email}))`),
|
|
1268
|
+
uniqueIndex4("user_username_ci_unique").on(drizzleSql21`lower(trim(both from ${t.username}))`),
|
|
1269
1269
|
...userPolicies(t)
|
|
1270
1270
|
]);
|
|
1271
1271
|
var userRelations = relations14(user, ({ many, one }) => ({
|
|
@@ -1290,7 +1290,7 @@ var userRelations = relations14(user, ({ many, one }) => ({
|
|
|
1290
1290
|
|
|
1291
1291
|
// ../../src/infrastructure/db/schema/drizzle/workout/views/exercise-to-workoutsplit-expanded.view.ts
|
|
1292
1292
|
import { bigint as bigint12, boolean as boolean7, text as text9, timestamp as timestamp11 } from "drizzle-orm/pg-core";
|
|
1293
|
-
import { sql as
|
|
1293
|
+
import { sql as drizzleSql22 } from "drizzle-orm";
|
|
1294
1294
|
import { integer as integer6 } from "drizzle-orm/pg-core";
|
|
1295
1295
|
var exerciseToWorkoutSplitSetExpandedView = workoutSchema.view("v_exercise_to_workout_split_set_expanded", {
|
|
1296
1296
|
id: bigint12("id", {
|
|
@@ -1318,7 +1318,7 @@ var exerciseToWorkoutSplitSetExpandedView = workoutSchema.view("v_exercise_to_wo
|
|
|
1318
1318
|
isActive: boolean7("is_active")
|
|
1319
1319
|
}).with({
|
|
1320
1320
|
securityInvoker: true
|
|
1321
|
-
}).as(
|
|
1321
|
+
}).as(drizzleSql22`
|
|
1322
1322
|
SELECT
|
|
1323
1323
|
ews.id,
|
|
1324
1324
|
ews.workout_split_id,
|
|
@@ -1351,7 +1351,7 @@ var exerciseToWorkoutSplitSetExpandedView = workoutSchema.view("v_exercise_to_wo
|
|
|
1351
1351
|
`);
|
|
1352
1352
|
|
|
1353
1353
|
// ../../src/infrastructure/db/schema/drizzle/analytics/views/exercise-tracking-expanded.view.ts
|
|
1354
|
-
import { sql as
|
|
1354
|
+
import { sql as drizzleSql23 } from "drizzle-orm";
|
|
1355
1355
|
import { bigint as bigint13, boolean as boolean8, real as real2, text as text10, timestamp as timestamp12, uuid as uuid12 } from "drizzle-orm/pg-core";
|
|
1356
1356
|
import { integer as integer7 } from "drizzle-orm/pg-core";
|
|
1357
1357
|
var exerciseTrackingSetExpandedView = analyticsSchema.view("v_exercise_tracking_set_expanded", {
|
|
@@ -1388,7 +1388,7 @@ var exerciseTrackingSetExpandedView = analyticsSchema.view("v_exercise_tracking_
|
|
|
1388
1388
|
isAssignedToSplit: boolean8("is_assigned_to_split")
|
|
1389
1389
|
}).with({
|
|
1390
1390
|
securityInvoker: true
|
|
1391
|
-
}).as(
|
|
1391
|
+
}).as(drizzleSql23`
|
|
1392
1392
|
SELECT
|
|
1393
1393
|
et.id,
|
|
1394
1394
|
et.exercise_to_split_id,
|
|
@@ -1420,7 +1420,7 @@ var exerciseTrackingSetExpandedView = analyticsSchema.view("v_exercise_tracking_
|
|
|
1420
1420
|
`);
|
|
1421
1421
|
|
|
1422
1422
|
// ../../src/infrastructure/db/schema/drizzle/analytics/views/prs.view.ts
|
|
1423
|
-
import { sql as
|
|
1423
|
+
import { sql as drizzleSql24 } from "drizzle-orm";
|
|
1424
1424
|
import { bigint as bigint14, real as real3, text as text11, timestamp as timestamp13, uuid as uuid13 } from "drizzle-orm/pg-core";
|
|
1425
1425
|
import { integer as integer8 } from "drizzle-orm/pg-core";
|
|
1426
1426
|
var prsView = analyticsSchema.view("v_prs", {
|
|
@@ -1448,7 +1448,7 @@ var prsView = analyticsSchema.view("v_prs", {
|
|
|
1448
1448
|
})
|
|
1449
1449
|
}).with({
|
|
1450
1450
|
securityInvoker: true
|
|
1451
|
-
}).as(
|
|
1451
|
+
}).as(drizzleSql24`
|
|
1452
1452
|
SELECT DISTINCT
|
|
1453
1453
|
ON (et.exercise_id) et.id,
|
|
1454
1454
|
et.exercise_to_split_id,
|
|
@@ -1507,7 +1507,7 @@ var aerobicsDailyRecordQueryDtoSchema = z2.object({
|
|
|
1507
1507
|
durationMins: aerobicTrackingDbSchema.shape.durationSec
|
|
1508
1508
|
});
|
|
1509
1509
|
var aerobicsWeeklyRecordQueryDtoSchema = aerobicsDailyRecordQueryDtoSchema.extend({
|
|
1510
|
-
|
|
1510
|
+
workoutTimeLocal: serializedDateSchema
|
|
1511
1511
|
});
|
|
1512
1512
|
var weeklyDataQueryDtoSchema = z2.object({
|
|
1513
1513
|
records: z2.array(aerobicsWeeklyRecordQueryDtoSchema),
|
|
@@ -1804,15 +1804,32 @@ var userByUsernameRowQueryDtoSchema = z13.object({
|
|
|
1804
1804
|
userData: userByUsernameRawQueryDtoSchema.nullable()
|
|
1805
1805
|
});
|
|
1806
1806
|
|
|
1807
|
-
// src/modules/
|
|
1808
|
-
import { z as
|
|
1807
|
+
// src/modules/exercises/exercises.dtos.ts
|
|
1808
|
+
import { z as z14 } from "zod/v4";
|
|
1809
|
+
var getAllExercisesExerciseQueryDtoSchema = z14.object({
|
|
1810
|
+
id: exerciseDbSchema.shape.id,
|
|
1811
|
+
name: exerciseDbSchema.shape.name,
|
|
1812
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
1813
|
+
});
|
|
1814
|
+
var exercisesMapByMuscleQueryDtoSchema = z14.record(z14.string(), z14.array(getAllExercisesExerciseQueryDtoSchema));
|
|
1815
|
+
var exerciseMapByMuscleRowQueryDtoSchema = z14.object({
|
|
1816
|
+
result: z14.object({
|
|
1817
|
+
map: exercisesMapByMuscleQueryDtoSchema.nullable()
|
|
1818
|
+
}).nullable()
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
// src/modules/exercises/exercises.contracts.ts
|
|
1822
|
+
var getAllExercisesResponseSchema = exercisesMapByMuscleQueryDtoSchema;
|
|
1823
|
+
var getAllExercisesContract = {
|
|
1824
|
+
response: getAllExercisesResponseSchema
|
|
1825
|
+
};
|
|
1809
1826
|
|
|
1810
1827
|
// src/modules/messages/messages.contracts.ts
|
|
1811
|
-
import { z as
|
|
1828
|
+
import { z as z16 } from "zod/v4";
|
|
1812
1829
|
|
|
1813
1830
|
// src/modules/messages/messages.dtos.ts
|
|
1814
|
-
import { z as
|
|
1815
|
-
var allUserMessageQueryDtoSchema =
|
|
1831
|
+
import { z as z15 } from "zod/v4";
|
|
1832
|
+
var allUserMessageQueryDtoSchema = z15.object({
|
|
1816
1833
|
id: messageDbSchema.shape.id,
|
|
1817
1834
|
subject: messageDbSchema.shape.subject,
|
|
1818
1835
|
msg: messageDbSchema.shape.msg,
|
|
@@ -1821,14 +1838,14 @@ var allUserMessageQueryDtoSchema = z14.object({
|
|
|
1821
1838
|
senderFullName: userDbSchema.shape.name,
|
|
1822
1839
|
senderProfilePicPath: userDbSchema.shape.profilePicPath
|
|
1823
1840
|
});
|
|
1824
|
-
var messageAsReadQueryDtoSchema =
|
|
1841
|
+
var messageAsReadQueryDtoSchema = z15.object({
|
|
1825
1842
|
id: messageDbSchema.shape.id,
|
|
1826
1843
|
isRead: messageDbSchema.shape.isRead
|
|
1827
1844
|
});
|
|
1828
|
-
var deletedMessageQueryDtoSchema =
|
|
1845
|
+
var deletedMessageQueryDtoSchema = z15.object({
|
|
1829
1846
|
id: messageDbSchema.shape.id
|
|
1830
1847
|
});
|
|
1831
|
-
var messageAfterSendQueryDtoSchema =
|
|
1848
|
+
var messageAfterSendQueryDtoSchema = z15.object({
|
|
1832
1849
|
id: messageDbSchema.shape.id,
|
|
1833
1850
|
senderId: messageDbSchema.shape.senderId,
|
|
1834
1851
|
receiverId: messageDbSchema.shape.receiverId,
|
|
@@ -1843,20 +1860,20 @@ var messageAfterSendQueryDtoSchema = z14.object({
|
|
|
1843
1860
|
});
|
|
1844
1861
|
|
|
1845
1862
|
// src/modules/messages/messages.contracts.ts
|
|
1846
|
-
var getAllMessagesRequestSchema =
|
|
1847
|
-
query:
|
|
1848
|
-
tz:
|
|
1863
|
+
var getAllMessagesRequestSchema = z16.object({
|
|
1864
|
+
query: z16.object({
|
|
1865
|
+
tz: z16.string()
|
|
1849
1866
|
})
|
|
1850
1867
|
});
|
|
1851
|
-
var getAllUserMessagesResponseSchema =
|
|
1852
|
-
messages:
|
|
1868
|
+
var getAllUserMessagesResponseSchema = z16.object({
|
|
1869
|
+
messages: z16.array(allUserMessageQueryDtoSchema)
|
|
1853
1870
|
});
|
|
1854
1871
|
var getAllUserMessagesContract = {
|
|
1855
1872
|
request: getAllMessagesRequestSchema,
|
|
1856
1873
|
response: getAllUserMessagesResponseSchema
|
|
1857
1874
|
};
|
|
1858
|
-
var markMessageAsReadRequestSchema =
|
|
1859
|
-
params:
|
|
1875
|
+
var markMessageAsReadRequestSchema = z16.object({
|
|
1876
|
+
params: z16.object({
|
|
1860
1877
|
id: messageDbSchema.shape.id
|
|
1861
1878
|
})
|
|
1862
1879
|
});
|
|
@@ -1865,8 +1882,8 @@ var markMessageAsReadContract = {
|
|
|
1865
1882
|
request: markMessageAsReadRequestSchema,
|
|
1866
1883
|
response: markMessageAsReadResponseSchema
|
|
1867
1884
|
};
|
|
1868
|
-
var deleteMessageRequestSchema =
|
|
1869
|
-
params:
|
|
1885
|
+
var deleteMessageRequestSchema = z16.object({
|
|
1886
|
+
params: z16.object({
|
|
1870
1887
|
id: messageDbSchema.shape.id
|
|
1871
1888
|
})
|
|
1872
1889
|
});
|
|
@@ -1876,285 +1893,18 @@ var deleteMessageContract = {
|
|
|
1876
1893
|
response: deleteMessageResponseSchema
|
|
1877
1894
|
};
|
|
1878
1895
|
|
|
1879
|
-
// src/modules/
|
|
1896
|
+
// src/modules/oauth/apple/apple.contracts.ts
|
|
1880
1897
|
import { z as z17 } from "zod/v4";
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
var workoutExerciseInputQueryDtoSchema = z16.object({
|
|
1885
|
-
exerciseId: exerciseDbSchema.shape.id,
|
|
1886
|
-
sets: z16.array(workoutSetDbSchema.shape.reps),
|
|
1887
|
-
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex
|
|
1888
|
-
});
|
|
1889
|
-
var workoutSplitInputBaseQueryDtoSchema = z16.object({
|
|
1890
|
-
name: workoutSplitDbSchema.shape.name.min(1, "Split name is required"),
|
|
1891
|
-
orderIndex: z16.number().int().nonnegative(),
|
|
1892
|
-
exercises: z16.array(workoutExerciseInputQueryDtoSchema).min(1, "Each split must include at least one exercise")
|
|
1893
|
-
});
|
|
1894
|
-
var saveWorkoutSplitInputQueryDtoSchema = workoutSplitInputBaseQueryDtoSchema.extend({
|
|
1895
|
-
id: workoutSplitDbSchema.shape.id.optional()
|
|
1896
|
-
});
|
|
1897
|
-
var saveWorkoutSplitPayloadQueryDtoSchema = z16.array(saveWorkoutSplitInputQueryDtoSchema).min(1, "Workout must include at least one split");
|
|
1898
|
-
var exerciseInPlanQueryDtoSchema = z16.object({
|
|
1899
|
-
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
1900
|
-
exerciseId: exerciseDbSchema.shape.id,
|
|
1901
|
-
name: exerciseDbSchema.shape.name,
|
|
1902
|
-
sets: z16.array(z16.object({
|
|
1903
|
-
orderIndex: workoutSetDbSchema.shape.orderIndex,
|
|
1904
|
-
reps: workoutSetDbSchema.shape.reps
|
|
1905
|
-
})),
|
|
1906
|
-
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
1907
|
-
isActive: exerciseToWorkoutSplitDbSchema.shape.isActive,
|
|
1908
|
-
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
1909
|
-
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
1910
|
-
});
|
|
1911
|
-
var workoutSplitQueryDtoSchema = z16.object({
|
|
1912
|
-
id: workoutSplitDbSchema.shape.id,
|
|
1913
|
-
workoutId: workoutSplitDbSchema.shape.workoutId,
|
|
1914
|
-
name: workoutSplitDbSchema.shape.name,
|
|
1915
|
-
orderIndex: workoutSplitDbSchema.shape.orderIndex,
|
|
1916
|
-
createdAt: serializedDateSchema,
|
|
1917
|
-
muscleGroup: z16.string().nullable(),
|
|
1918
|
-
isActive: workoutSplitDbSchema.shape.isActive,
|
|
1919
|
-
exercises: z16.array(exerciseInPlanQueryDtoSchema)
|
|
1920
|
-
});
|
|
1921
|
-
var wholeUserWorkoutPlanQueryDtoSchema = z16.object({
|
|
1922
|
-
id: workoutPlanDbSchema.shape.id,
|
|
1923
|
-
numberOfSplits: z16.number(),
|
|
1924
|
-
createdAt: serializedDateSchema,
|
|
1925
|
-
userId: userDbSchema.shape.id,
|
|
1926
|
-
isActive: workoutPlanDbSchema.shape.isActive,
|
|
1927
|
-
updatedAt: serializedDateSchema,
|
|
1928
|
-
workoutSplits: z16.array(workoutSplitQueryDtoSchema).nullable()
|
|
1929
|
-
});
|
|
1930
|
-
var workoutPlanIdQueryDtoSchema = z16.object({
|
|
1931
|
-
id: workoutPlanDbSchema.shape.id
|
|
1932
|
-
});
|
|
1933
|
-
var workoutSplitIdQueryDtoSchema = z16.object({
|
|
1934
|
-
id: workoutSplitDbSchema.shape.id
|
|
1935
|
-
});
|
|
1936
|
-
var exerciseAssignmentIdQueryDtoSchema = z16.object({
|
|
1937
|
-
id: exerciseToWorkoutSplitDbSchema.shape.id
|
|
1938
|
-
});
|
|
1939
|
-
|
|
1940
|
-
// src/modules/workout/plan/plan.contracts.ts
|
|
1941
|
-
var getWholeWorkoutPlanRequestSchema = z17.object({
|
|
1942
|
-
query: z17.object({
|
|
1943
|
-
tz: z17.string().optional()
|
|
1944
|
-
})
|
|
1898
|
+
var appleNameInputSchema = z17.object({
|
|
1899
|
+
givenName: z17.string().nullable(),
|
|
1900
|
+
familyName: z17.string().nullable()
|
|
1945
1901
|
});
|
|
1946
|
-
var
|
|
1947
|
-
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema.nullable()
|
|
1948
|
-
});
|
|
1949
|
-
var getWholeUserWorkoutPlanContract = {
|
|
1950
|
-
request: getWholeWorkoutPlanRequestSchema,
|
|
1951
|
-
response: getWholeUserWorkoutPlanResponseSchema
|
|
1952
|
-
};
|
|
1953
|
-
var workoutMutationResponseSchema = z17.object({
|
|
1954
|
-
message: z17.string(),
|
|
1955
|
-
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema
|
|
1956
|
-
});
|
|
1957
|
-
var addWorkoutRequestSchema = z17.object({
|
|
1902
|
+
var appleOAuthRequestSchema = z17.object({
|
|
1958
1903
|
body: z17.object({
|
|
1959
|
-
|
|
1960
|
-
workoutName: z17.string().optional(),
|
|
1961
|
-
tz: z17.string()
|
|
1962
|
-
})
|
|
1963
|
-
});
|
|
1964
|
-
var addWorkoutResponseSchema = workoutMutationResponseSchema;
|
|
1965
|
-
var addWorkoutContract = {
|
|
1966
|
-
request: addWorkoutRequestSchema,
|
|
1967
|
-
response: addWorkoutResponseSchema
|
|
1968
|
-
};
|
|
1969
|
-
|
|
1970
|
-
// src/modules/workout/tracking/tracking.dtos.ts
|
|
1971
|
-
import { z as z18 } from "zod/v4";
|
|
1972
|
-
var trackedSetQueryDtoSchema = z18.object({
|
|
1973
|
-
reps: trackingSetDbSchema.shape.reps,
|
|
1974
|
-
weight: trackingSetDbSchema.shape.weight,
|
|
1975
|
-
setIndex: trackingSetDbSchema.shape.setIndex
|
|
1976
|
-
});
|
|
1977
|
-
var finishedWorkoutEntryBaseQueryDtoSchema = z18.object({
|
|
1978
|
-
trackedSets: z18.array(trackedSetQueryDtoSchema),
|
|
1979
|
-
notes: exerciseTrackingDbSchema.shape.notes.optional()
|
|
1980
|
-
});
|
|
1981
|
-
var finishedWorkoutEntryQueryDtoSchema = finishedWorkoutEntryBaseQueryDtoSchema.extend({
|
|
1982
|
-
isExerciseAssignedToSplit: z18.boolean(),
|
|
1983
|
-
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
1984
|
-
exerciseId: exerciseTrackingDbSchema.shape.exerciseId
|
|
1985
|
-
});
|
|
1986
|
-
var exerciseMetadataQueryDtoSchema = z18.object({
|
|
1987
|
-
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
1988
|
-
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
1989
|
-
});
|
|
1990
|
-
var exerciseTrackingPrMaxQueryDtoSchema = z18.object({
|
|
1991
|
-
exercise: exerciseDbSchema.shape.name,
|
|
1992
|
-
weight: trackingSetDbSchema.shape.weight,
|
|
1993
|
-
reps: trackingSetDbSchema.shape.reps,
|
|
1994
|
-
workoutTimeUtc: serializedDateSchema
|
|
1995
|
-
});
|
|
1996
|
-
var exerciseTrackingAnalysisQueryDtoSchema = z18.object({
|
|
1997
|
-
uniqueDays: z18.number(),
|
|
1998
|
-
mostFrequentSplit: z18.string().nullable(),
|
|
1999
|
-
mostFrequentSplitDays: z18.number().nullable(),
|
|
2000
|
-
lastWorkoutDate: z18.string().nullable(),
|
|
2001
|
-
splitDaysByName: z18.record(z18.string(), z18.number()),
|
|
2002
|
-
prs: z18.object({
|
|
2003
|
-
prMax: exerciseTrackingPrMaxQueryDtoSchema.nullable()
|
|
2004
|
-
})
|
|
2005
|
-
});
|
|
2006
|
-
var trackingMapItemQueryDtoSchema = z18.object({
|
|
2007
|
-
id: exerciseTrackingDbSchema.shape.id,
|
|
2008
|
-
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
2009
|
-
weight: z18.array(trackingSetDbSchema.shape.weight),
|
|
2010
|
-
reps: z18.array(trackingSetDbSchema.shape.reps),
|
|
2011
|
-
notes: exerciseTrackingDbSchema.shape.notes,
|
|
2012
|
-
exerciseId: exerciseDbSchema.shape.id,
|
|
2013
|
-
workoutSplitId: workoutSplitDbSchema.shape.id,
|
|
2014
|
-
splitName: workoutSplitDbSchema.shape.name,
|
|
2015
|
-
exercise: exerciseDbSchema.shape.name,
|
|
2016
|
-
workoutDate: serializedDateSchema,
|
|
2017
|
-
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
2018
|
-
exerciseToWorkoutSplit: z18.object({
|
|
2019
|
-
sets: z18.array(workoutSetDbSchema.shape.reps),
|
|
2020
|
-
exercises: exerciseMetadataQueryDtoSchema
|
|
2021
|
-
})
|
|
2022
|
-
});
|
|
2023
|
-
var trackingByDateItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2024
|
-
workoutDate: true
|
|
2025
|
-
});
|
|
2026
|
-
var trackingBySplitNameItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2027
|
-
splitName: true
|
|
2028
|
-
});
|
|
2029
|
-
var groupedTrackingItemQueryDtoSchema = z18.object({
|
|
2030
|
-
exerciseTracking: z18.object({
|
|
2031
|
-
exerciseTrackingId: exerciseTrackingDbSchema.shape.id,
|
|
2032
|
-
sets: z18.array(z18.object({
|
|
2033
|
-
setIndex: trackingSetDbSchema.shape.setIndex,
|
|
2034
|
-
weight: trackingSetDbSchema.shape.weight,
|
|
2035
|
-
reps: trackingSetDbSchema.shape.reps
|
|
2036
|
-
})),
|
|
2037
|
-
notes: exerciseTrackingDbSchema.shape.notes,
|
|
2038
|
-
exerciseAssignment: z18.object({
|
|
2039
|
-
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
2040
|
-
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex.nullable(),
|
|
2041
|
-
exerciseId: exerciseDbSchema.shape.id,
|
|
2042
|
-
workoutSplitId: workoutSplitDbSchema.shape.id,
|
|
2043
|
-
workoutSplitName: workoutSplitDbSchema.shape.name,
|
|
2044
|
-
exerciseName: exerciseDbSchema.shape.name,
|
|
2045
|
-
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
2046
|
-
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2047
|
-
})
|
|
2048
|
-
})
|
|
2049
|
-
});
|
|
2050
|
-
var exerciseTrackingStatsQueryDtoSchema = z18.object({
|
|
2051
|
-
workoutCount: z18.coerce.number(),
|
|
2052
|
-
hasExerciseTracking: z18.boolean(),
|
|
2053
|
-
nextWorkoutSplit: z18.object({
|
|
2054
|
-
id: workoutSplitDbSchema.shape.id,
|
|
2055
|
-
name: workoutSplitDbSchema.shape.name,
|
|
2056
|
-
orderIndex: workoutSplitDbSchema.shape.orderIndex,
|
|
2057
|
-
muscleGroup: z18.string().nullable()
|
|
2058
|
-
}).nullable(),
|
|
2059
|
-
workoutTargets: z18.object({
|
|
2060
|
-
workoutCountThisWeek: z18.coerce.number(),
|
|
2061
|
-
workoutCountScheduledPerWeek: z18.coerce.number(),
|
|
2062
|
-
weekStreak: z18.coerce.number()
|
|
2063
|
-
}),
|
|
2064
|
-
lastWorkoutStats: z18.object({
|
|
2065
|
-
workoutDate: z18.string().nullable(),
|
|
2066
|
-
workoutSplitName: workoutSplitDbSchema.shape.name.nullable(),
|
|
2067
|
-
exerciseTrackedCount: z18.coerce.number().nullable(),
|
|
2068
|
-
setTrackedCount: z18.coerce.number().nullable()
|
|
2069
|
-
}),
|
|
2070
|
-
prs: z18.array(z18.object({
|
|
2071
|
-
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
2072
|
-
exerciseId: exerciseDbSchema.shape.id,
|
|
2073
|
-
exerciseName: exerciseDbSchema.shape.name,
|
|
2074
|
-
prWeight: trackingSetDbSchema.shape.weight,
|
|
2075
|
-
prReps: trackingSetDbSchema.shape.reps,
|
|
2076
|
-
prSetIndex: trackingSetDbSchema.shape.setIndex,
|
|
2077
|
-
estimatedOneRepMax: z18.number().nullable()
|
|
2078
|
-
}))
|
|
2079
|
-
});
|
|
2080
|
-
var exerciseTrackingMapsQueryDtoSchema = z18.object({
|
|
2081
|
-
byDate: z18.record(z18.string(), z18.array(groupedTrackingItemQueryDtoSchema)),
|
|
2082
|
-
byExerciseToSplitId: z18.record(z18.string(), z18.array(groupedTrackingItemQueryDtoSchema)),
|
|
2083
|
-
bySplitName: z18.record(z18.string(), z18.array(groupedTrackingItemQueryDtoSchema))
|
|
2084
|
-
});
|
|
2085
|
-
var exerciseTrackingAndStatsQueryDtoSchema = z18.object({
|
|
2086
|
-
trackingStats: exerciseTrackingStatsQueryDtoSchema,
|
|
2087
|
-
trackingMaps: exerciseTrackingMapsQueryDtoSchema
|
|
2088
|
-
});
|
|
2089
|
-
var exerciseTrackingAndStatsRowQueryDtoSchema = z18.object({
|
|
2090
|
-
data: exerciseTrackingAndStatsQueryDtoSchema
|
|
2091
|
-
});
|
|
2092
|
-
var exerciseTrackingStatsRowQueryDtoSchema = z18.object({
|
|
2093
|
-
data: exerciseTrackingStatsQueryDtoSchema
|
|
2094
|
-
});
|
|
2095
|
-
var exerciseTrackingMapsRowQueryDtoSchema = z18.object({
|
|
2096
|
-
data: exerciseTrackingMapsQueryDtoSchema
|
|
2097
|
-
});
|
|
2098
|
-
var workoutSplitLookupQueryDtoSchema = z18.object({
|
|
2099
|
-
workoutSplitId: workoutSplitDbSchema.shape.id
|
|
2100
|
-
});
|
|
2101
|
-
var workoutSummaryIdQueryDtoSchema = z18.object({
|
|
2102
|
-
id: z18.string().uuid()
|
|
2103
|
-
});
|
|
2104
|
-
var exerciseTrackingIdQueryDtoSchema = z18.object({
|
|
2105
|
-
id: exerciseTrackingDbSchema.shape.id
|
|
2106
|
-
});
|
|
2107
|
-
|
|
2108
|
-
// src/modules/bootstrap/bootstrap.contracts.ts
|
|
2109
|
-
var bootstrapRequestSchema = z19.object({
|
|
2110
|
-
query: z19.object({
|
|
2111
|
-
tz: z19.string().optional()
|
|
2112
|
-
})
|
|
2113
|
-
});
|
|
2114
|
-
var bootstrapResponseSchema = z19.object({
|
|
2115
|
-
user: userDataQueryDtoSchema,
|
|
2116
|
-
workout: getWholeUserWorkoutPlanResponseSchema,
|
|
2117
|
-
tracking: exerciseTrackingAndStatsQueryDtoSchema,
|
|
2118
|
-
messages: getAllUserMessagesResponseSchema,
|
|
2119
|
-
aerobics: userAerobicsResponseSchema
|
|
2120
|
-
});
|
|
2121
|
-
var bootstrapContract = {
|
|
2122
|
-
request: bootstrapRequestSchema,
|
|
2123
|
-
response: bootstrapResponseSchema
|
|
2124
|
-
};
|
|
2125
|
-
|
|
2126
|
-
// src/modules/exercises/exercises.dtos.ts
|
|
2127
|
-
import { z as z20 } from "zod/v4";
|
|
2128
|
-
var getAllExercisesExerciseQueryDtoSchema = z20.object({
|
|
2129
|
-
id: exerciseDbSchema.shape.id,
|
|
2130
|
-
name: exerciseDbSchema.shape.name,
|
|
2131
|
-
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2132
|
-
});
|
|
2133
|
-
var exercisesMapByMuscleQueryDtoSchema = z20.record(z20.string(), z20.array(getAllExercisesExerciseQueryDtoSchema));
|
|
2134
|
-
var exerciseMapByMuscleRowQueryDtoSchema = z20.object({
|
|
2135
|
-
result: z20.object({
|
|
2136
|
-
map: exercisesMapByMuscleQueryDtoSchema.nullable()
|
|
2137
|
-
}).nullable()
|
|
2138
|
-
});
|
|
2139
|
-
|
|
2140
|
-
// src/modules/exercises/exercises.contracts.ts
|
|
2141
|
-
var getAllExercisesResponseSchema = exercisesMapByMuscleQueryDtoSchema;
|
|
2142
|
-
var getAllExercisesContract = {
|
|
2143
|
-
response: getAllExercisesResponseSchema
|
|
2144
|
-
};
|
|
2145
|
-
|
|
2146
|
-
// src/modules/oauth/apple/apple.contracts.ts
|
|
2147
|
-
import { z as z21 } from "zod/v4";
|
|
2148
|
-
var appleNameInputSchema = z21.object({
|
|
2149
|
-
givenName: z21.string().nullable(),
|
|
2150
|
-
familyName: z21.string().nullable()
|
|
2151
|
-
});
|
|
2152
|
-
var appleOAuthRequestSchema = z21.object({
|
|
2153
|
-
body: z21.object({
|
|
2154
|
-
idToken: z21.string({
|
|
1904
|
+
idToken: z17.string({
|
|
2155
1905
|
error: "Missing or invalid Apple identityToken"
|
|
2156
1906
|
}),
|
|
2157
|
-
rawNonce:
|
|
1907
|
+
rawNonce: z17.string(),
|
|
2158
1908
|
name: appleNameInputSchema.optional(),
|
|
2159
1909
|
email: userDbSchema.shape.email.email().nullable()
|
|
2160
1910
|
})
|
|
@@ -2164,19 +1914,19 @@ var appleOAuthContract = {
|
|
|
2164
1914
|
};
|
|
2165
1915
|
|
|
2166
1916
|
// src/modules/oauth/apple/apple.dtos.ts
|
|
2167
|
-
import { z as
|
|
2168
|
-
var appleTokenVerificationResultDtoSchema =
|
|
2169
|
-
appleSub:
|
|
1917
|
+
import { z as z18 } from "zod/v4";
|
|
1918
|
+
var appleTokenVerificationResultDtoSchema = z18.object({
|
|
1919
|
+
appleSub: z18.string(),
|
|
2170
1920
|
email: userDbSchema.shape.email.nullable(),
|
|
2171
|
-
emailVerified:
|
|
1921
|
+
emailVerified: z18.boolean(),
|
|
2172
1922
|
fullName: userDbSchema.shape.name
|
|
2173
1923
|
});
|
|
2174
1924
|
|
|
2175
1925
|
// src/modules/oauth/google/google.contracts.ts
|
|
2176
|
-
import { z as
|
|
2177
|
-
var googleOAuthRequestSchema =
|
|
2178
|
-
body:
|
|
2179
|
-
idToken:
|
|
1926
|
+
import { z as z19 } from "zod/v4";
|
|
1927
|
+
var googleOAuthRequestSchema = z19.object({
|
|
1928
|
+
body: z19.object({
|
|
1929
|
+
idToken: z19.string().optional()
|
|
2180
1930
|
})
|
|
2181
1931
|
});
|
|
2182
1932
|
var googleOAuthContract = {
|
|
@@ -2184,22 +1934,22 @@ var googleOAuthContract = {
|
|
|
2184
1934
|
};
|
|
2185
1935
|
|
|
2186
1936
|
// src/modules/oauth/google/google.dtos.ts
|
|
2187
|
-
import { z as
|
|
2188
|
-
var googleTokenVerificationResultDtoSchema =
|
|
2189
|
-
googleSub:
|
|
1937
|
+
import { z as z20 } from "zod/v4";
|
|
1938
|
+
var googleTokenVerificationResultDtoSchema = z20.object({
|
|
1939
|
+
googleSub: z20.string(),
|
|
2190
1940
|
email: userDbSchema.shape.email.nullable(),
|
|
2191
|
-
emailVerified:
|
|
1941
|
+
emailVerified: z20.boolean(),
|
|
2192
1942
|
fullName: userDbSchema.shape.name
|
|
2193
1943
|
});
|
|
2194
1944
|
|
|
2195
1945
|
// src/modules/oauth/oauth.contracts.ts
|
|
2196
|
-
import { z as
|
|
2197
|
-
var oAuthLoginResponseSchema =
|
|
2198
|
-
message:
|
|
1946
|
+
import { z as z21 } from "zod/v4";
|
|
1947
|
+
var oAuthLoginResponseSchema = z21.object({
|
|
1948
|
+
message: z21.string(),
|
|
2199
1949
|
user: userDbSchema.shape.id,
|
|
2200
|
-
accessToken:
|
|
2201
|
-
refreshToken:
|
|
2202
|
-
missingFields:
|
|
1950
|
+
accessToken: z21.string(),
|
|
1951
|
+
refreshToken: z21.string(),
|
|
1952
|
+
missingFields: z21.array(z21.string()).nullable()
|
|
2203
1953
|
});
|
|
2204
1954
|
var proceedLoginResponseSchema = loginResponseSchema;
|
|
2205
1955
|
var oAuthLoginContract = {
|
|
@@ -2207,50 +1957,50 @@ var oAuthLoginContract = {
|
|
|
2207
1957
|
};
|
|
2208
1958
|
|
|
2209
1959
|
// src/modules/oauth/oauth.dtos.ts
|
|
2210
|
-
import { z as
|
|
2211
|
-
var oAuthLookupQueryDtoSchema =
|
|
1960
|
+
import { z as z22 } from "zod/v4";
|
|
1961
|
+
var oAuthLookupQueryDtoSchema = z22.object({
|
|
2212
1962
|
userId: userDbSchema.shape.id.nullable(),
|
|
2213
|
-
missingFields:
|
|
1963
|
+
missingFields: z22.string().nullable()
|
|
2214
1964
|
});
|
|
2215
|
-
var oAuthLookupRawQueryDtoSchema =
|
|
1965
|
+
var oAuthLookupRawQueryDtoSchema = z22.object({
|
|
2216
1966
|
user_id: userDbSchema.shape.id,
|
|
2217
|
-
missing_fields:
|
|
1967
|
+
missing_fields: z22.string().nullable()
|
|
2218
1968
|
});
|
|
2219
|
-
var oAuthLookupRowQueryDtoSchema =
|
|
1969
|
+
var oAuthLookupRowQueryDtoSchema = z22.object({
|
|
2220
1970
|
oauth_data: oAuthLookupRawQueryDtoSchema.nullable()
|
|
2221
1971
|
});
|
|
2222
|
-
var oAuthLinkQueryDtoSchema =
|
|
1972
|
+
var oAuthLinkQueryDtoSchema = z22.object({
|
|
2223
1973
|
userId: userDbSchema.shape.id.nullable()
|
|
2224
1974
|
});
|
|
2225
|
-
var oAuthLinkRowQueryDtoSchema =
|
|
1975
|
+
var oAuthLinkRowQueryDtoSchema = z22.object({
|
|
2226
1976
|
user_id: userDbSchema.shape.id.nullable()
|
|
2227
1977
|
});
|
|
2228
|
-
var oAuthCreatedUserRowQueryDtoSchema =
|
|
1978
|
+
var oAuthCreatedUserRowQueryDtoSchema = z22.object({
|
|
2229
1979
|
user_id: userDbSchema.shape.id
|
|
2230
1980
|
});
|
|
2231
1981
|
|
|
2232
1982
|
// src/modules/push/push.dtos.ts
|
|
2233
|
-
import { z as
|
|
2234
|
-
var userWithNotificationsEnabledQueryDtoSchema =
|
|
1983
|
+
import { z as z23 } from "zod/v4";
|
|
1984
|
+
var userWithNotificationsEnabledQueryDtoSchema = z23.object({
|
|
2235
1985
|
pushToken: userDbSchema.shape.pushToken,
|
|
2236
1986
|
name: userDbSchema.shape.name
|
|
2237
1987
|
});
|
|
2238
|
-
var userToHourlyReminderQueryDtoSchema =
|
|
1988
|
+
var userToHourlyReminderQueryDtoSchema = z23.object({
|
|
2239
1989
|
userId: userDbSchema.shape.id,
|
|
2240
1990
|
name: userDbSchema.shape.name,
|
|
2241
1991
|
pushToken: userDbSchema.shape.pushToken,
|
|
2242
|
-
reminderOffsetMinutes:
|
|
1992
|
+
reminderOffsetMinutes: z23.number(),
|
|
2243
1993
|
splitId: workoutSplitDbSchema.shape.id,
|
|
2244
1994
|
splitName: workoutSplitDbSchema.shape.name.nullable(),
|
|
2245
|
-
estimatedTimeUtc:
|
|
1995
|
+
estimatedTimeUtc: z23.string()
|
|
2246
1996
|
});
|
|
2247
1997
|
|
|
2248
1998
|
// src/modules/user/create/create.contracts.ts
|
|
2249
|
-
import { z as
|
|
1999
|
+
import { z as z25 } from "zod/v4";
|
|
2250
2000
|
|
|
2251
2001
|
// src/modules/user/create/create.dtos.ts
|
|
2252
|
-
import { z as
|
|
2253
|
-
var createdUserQueryDtoSchema =
|
|
2002
|
+
import { z as z24 } from "zod/v4";
|
|
2003
|
+
var createdUserQueryDtoSchema = z24.object({
|
|
2254
2004
|
id: userDbSchema.shape.id,
|
|
2255
2005
|
username: userDbSchema.shape.username,
|
|
2256
2006
|
name: userDbSchema.shape.name,
|
|
@@ -2264,23 +2014,23 @@ var createdUserRawQueryDtoSchema = createdUserQueryDtoSchema.omit({
|
|
|
2264
2014
|
}).extend({
|
|
2265
2015
|
created_at: serializedDateSchema
|
|
2266
2016
|
});
|
|
2267
|
-
var createdUserRowQueryDtoSchema =
|
|
2017
|
+
var createdUserRowQueryDtoSchema = z24.object({
|
|
2268
2018
|
userData: createdUserRawQueryDtoSchema
|
|
2269
2019
|
});
|
|
2270
|
-
var userExistsQueryDtoSchema =
|
|
2020
|
+
var userExistsQueryDtoSchema = z24.object({
|
|
2271
2021
|
id: userDbSchema.shape.id.nullable()
|
|
2272
2022
|
});
|
|
2273
2023
|
|
|
2274
2024
|
// src/modules/user/create/create.contracts.ts
|
|
2275
2025
|
var usernameSchema = userDbSchema.shape.username.trim().min(3, "Username must be at least 3 characters").max(15, "Username must be at most 15 characters").regex(/^[a-zA-Z0-9_]+$/, "Username may contain letters, numbers, and underscore only");
|
|
2276
2026
|
var fullNameSchema = userDbSchema.shape.name.trim().max(20, "Full name is too long").regex(/^[a-zA-Z\s]+$/, "Full name may contain letters and spaces only");
|
|
2277
|
-
var createUserRequestSchema =
|
|
2278
|
-
body:
|
|
2027
|
+
var createUserRequestSchema = z25.object({
|
|
2028
|
+
body: z25.object({
|
|
2279
2029
|
username: usernameSchema,
|
|
2280
|
-
fullName:
|
|
2030
|
+
fullName: z25.preprocess((value) => value == null || typeof value === "string" && value.trim() === "" ? "User" : value, fullNameSchema),
|
|
2281
2031
|
email: userDbSchema.shape.email.trim().toLowerCase().email("Invalid email format"),
|
|
2282
|
-
password:
|
|
2283
|
-
gender:
|
|
2032
|
+
password: z25.string().min(8, "Password must be at least 8 characters long"),
|
|
2033
|
+
gender: z25.preprocess((value) => value === "" || value == null ? "Unknown" : value, z25.enum([
|
|
2284
2034
|
"Male",
|
|
2285
2035
|
"Female",
|
|
2286
2036
|
"Other",
|
|
@@ -2289,8 +2039,8 @@ var createUserRequestSchema = z29.object({
|
|
|
2289
2039
|
})
|
|
2290
2040
|
});
|
|
2291
2041
|
var createUserUserSchema = createdUserQueryDtoSchema;
|
|
2292
|
-
var createUserResponseSchema =
|
|
2293
|
-
message:
|
|
2042
|
+
var createUserResponseSchema = z25.object({
|
|
2043
|
+
message: z25.string(),
|
|
2294
2044
|
user: createdUserQueryDtoSchema
|
|
2295
2045
|
});
|
|
2296
2046
|
var createUserContract = {
|
|
@@ -2299,9 +2049,9 @@ var createUserContract = {
|
|
|
2299
2049
|
};
|
|
2300
2050
|
|
|
2301
2051
|
// src/modules/user/push-tokens/push-tokens.contracts.ts
|
|
2302
|
-
import { z as
|
|
2303
|
-
var saveUserPushTokenRequestSchema =
|
|
2304
|
-
body:
|
|
2052
|
+
import { z as z26 } from "zod/v4";
|
|
2053
|
+
var saveUserPushTokenRequestSchema = z26.object({
|
|
2054
|
+
body: z26.object({
|
|
2305
2055
|
token: userDbSchema.shape.pushToken.unwrap()
|
|
2306
2056
|
})
|
|
2307
2057
|
});
|
|
@@ -2310,20 +2060,20 @@ var saveUserPushTokenContract = {
|
|
|
2310
2060
|
};
|
|
2311
2061
|
|
|
2312
2062
|
// src/modules/user/update/update.contracts.ts
|
|
2313
|
-
import { z as
|
|
2314
|
-
var updateUserRequestSchema =
|
|
2063
|
+
import { z as z27 } from "zod/v4";
|
|
2064
|
+
var updateUserRequestSchema = z27.object({
|
|
2315
2065
|
body: authenticatedUserForUpdateQueryDtoSchema
|
|
2316
2066
|
});
|
|
2317
|
-
var updateAuthenticatedUserResponseSchema =
|
|
2318
|
-
message:
|
|
2319
|
-
emailChanged:
|
|
2067
|
+
var updateAuthenticatedUserResponseSchema = z27.object({
|
|
2068
|
+
message: z27.string(),
|
|
2069
|
+
emailChanged: z27.boolean(),
|
|
2320
2070
|
user: userDataQueryDtoSchema
|
|
2321
2071
|
});
|
|
2322
2072
|
var updateAuthenticatedUserContract = {
|
|
2323
2073
|
request: updateUserRequestSchema,
|
|
2324
2074
|
response: updateAuthenticatedUserResponseSchema
|
|
2325
2075
|
};
|
|
2326
|
-
var userDataResponseSchema =
|
|
2076
|
+
var userDataResponseSchema = z27.object({
|
|
2327
2077
|
userData: userDataQueryDtoSchema
|
|
2328
2078
|
});
|
|
2329
2079
|
var userDataContract = {
|
|
@@ -2333,36 +2083,36 @@ var getAuthenticatedUserByIdResponseSchema = userDataQueryDtoSchema;
|
|
|
2333
2083
|
var getAuthenticatedUserByIdContract = {
|
|
2334
2084
|
response: getAuthenticatedUserByIdResponseSchema
|
|
2335
2085
|
};
|
|
2336
|
-
var deleteProfilePicRequestSchema =
|
|
2337
|
-
body:
|
|
2338
|
-
profilePicPath:
|
|
2086
|
+
var deleteProfilePicRequestSchema = z27.object({
|
|
2087
|
+
body: z27.object({
|
|
2088
|
+
profilePicPath: z27.string()
|
|
2339
2089
|
})
|
|
2340
2090
|
});
|
|
2341
2091
|
var deleteUserProfilePicContract = {
|
|
2342
2092
|
request: deleteProfilePicRequestSchema
|
|
2343
2093
|
};
|
|
2344
|
-
var setProfilePicAndUpdateDBResponseSchema =
|
|
2345
|
-
profilePicPath:
|
|
2346
|
-
url:
|
|
2347
|
-
message:
|
|
2094
|
+
var setProfilePicAndUpdateDBResponseSchema = z27.object({
|
|
2095
|
+
profilePicPath: z27.string(),
|
|
2096
|
+
url: z27.string(),
|
|
2097
|
+
message: z27.string()
|
|
2348
2098
|
});
|
|
2349
2099
|
var setProfilePicAndUpdateDBContract = {
|
|
2350
2100
|
response: setProfilePicAndUpdateDBResponseSchema
|
|
2351
2101
|
};
|
|
2352
2102
|
|
|
2353
2103
|
// src/modules/video-analysis/video-analysis.contracts.ts
|
|
2354
|
-
import { z as
|
|
2355
|
-
var getPresignedUrlFromS3RequestSchema =
|
|
2356
|
-
body:
|
|
2104
|
+
import { z as z28 } from "zod/v4";
|
|
2105
|
+
var getPresignedUrlFromS3RequestSchema = z28.object({
|
|
2106
|
+
body: z28.object({
|
|
2357
2107
|
exercise: exerciseDbSchema.shape.name,
|
|
2358
|
-
fileType:
|
|
2359
|
-
jobId:
|
|
2108
|
+
fileType: z28.string(),
|
|
2109
|
+
jobId: z28.string()
|
|
2360
2110
|
})
|
|
2361
2111
|
});
|
|
2362
|
-
var getPresignedUrlFromS3ResponseSchema =
|
|
2363
|
-
uploadUrl:
|
|
2364
|
-
fileKey:
|
|
2365
|
-
requestId:
|
|
2112
|
+
var getPresignedUrlFromS3ResponseSchema = z28.object({
|
|
2113
|
+
uploadUrl: z28.string(),
|
|
2114
|
+
fileKey: z28.string(),
|
|
2115
|
+
requestId: z28.string()
|
|
2366
2116
|
});
|
|
2367
2117
|
var getPresignedUrlFromS3Contract = {
|
|
2368
2118
|
request: getPresignedUrlFromS3RequestSchema,
|
|
@@ -2370,75 +2120,306 @@ var getPresignedUrlFromS3Contract = {
|
|
|
2370
2120
|
};
|
|
2371
2121
|
|
|
2372
2122
|
// src/modules/video-analysis/video-analysis.dtos.ts
|
|
2373
|
-
import { z as
|
|
2374
|
-
var enqueueAnalyzeVideoParamsDtoSchema =
|
|
2375
|
-
fileKey:
|
|
2376
|
-
exercise:
|
|
2123
|
+
import { z as z29 } from "zod/v4";
|
|
2124
|
+
var enqueueAnalyzeVideoParamsDtoSchema = z29.object({
|
|
2125
|
+
fileKey: z29.string(),
|
|
2126
|
+
exercise: z29.string(),
|
|
2377
2127
|
userId: userDbSchema.shape.id,
|
|
2378
|
-
requestId:
|
|
2379
|
-
sentryTrace:
|
|
2380
|
-
baggage:
|
|
2128
|
+
requestId: z29.string(),
|
|
2129
|
+
sentryTrace: z29.string().optional(),
|
|
2130
|
+
baggage: z29.string().optional()
|
|
2381
2131
|
});
|
|
2382
2132
|
var analyzeVideoPayloadDtoSchema = enqueueAnalyzeVideoParamsDtoSchema.extend({
|
|
2383
|
-
expiresAt:
|
|
2133
|
+
expiresAt: z29.number()
|
|
2384
2134
|
});
|
|
2385
|
-
var squatRepetitionDtoSchema =
|
|
2386
|
-
depth:
|
|
2387
|
-
value:
|
|
2388
|
-
status:
|
|
2389
|
-
confidence:
|
|
2135
|
+
var squatRepetitionDtoSchema = z29.object({
|
|
2136
|
+
depth: z29.object({
|
|
2137
|
+
value: z29.number(),
|
|
2138
|
+
status: z29.string(),
|
|
2139
|
+
confidence: z29.number()
|
|
2390
2140
|
}),
|
|
2391
|
-
backLean:
|
|
2392
|
-
value:
|
|
2393
|
-
excessive:
|
|
2394
|
-
confidence:
|
|
2141
|
+
backLean: z29.object({
|
|
2142
|
+
value: z29.number(),
|
|
2143
|
+
excessive: z29.boolean(),
|
|
2144
|
+
confidence: z29.number()
|
|
2395
2145
|
}),
|
|
2396
|
-
audit:
|
|
2397
|
-
framesAnalyzed:
|
|
2398
|
-
validFrames:
|
|
2399
|
-
cameraAngle:
|
|
2400
|
-
rawBottomAngle:
|
|
2401
|
-
samplingRate:
|
|
2146
|
+
audit: z29.object({
|
|
2147
|
+
framesAnalyzed: z29.number(),
|
|
2148
|
+
validFrames: z29.number(),
|
|
2149
|
+
cameraAngle: z29.string(),
|
|
2150
|
+
rawBottomAngle: z29.number(),
|
|
2151
|
+
samplingRate: z29.string()
|
|
2402
2152
|
})
|
|
2403
2153
|
});
|
|
2404
|
-
var analyzeVideoResultPayloadDtoSchema = /* @__PURE__ */ __name((resultSchema) =>
|
|
2405
|
-
jobId:
|
|
2154
|
+
var analyzeVideoResultPayloadDtoSchema = /* @__PURE__ */ __name((resultSchema) => z29.intersection(z29.object({
|
|
2155
|
+
jobId: z29.string(),
|
|
2406
2156
|
userId: userDbSchema.shape.id,
|
|
2407
|
-
exercise:
|
|
2408
|
-
requestId:
|
|
2409
|
-
}),
|
|
2410
|
-
|
|
2411
|
-
status:
|
|
2412
|
-
result:
|
|
2413
|
-
error:
|
|
2157
|
+
exercise: z29.string(),
|
|
2158
|
+
requestId: z29.string().optional()
|
|
2159
|
+
}), z29.discriminatedUnion("status", [
|
|
2160
|
+
z29.object({
|
|
2161
|
+
status: z29.literal("completed"),
|
|
2162
|
+
result: z29.array(resultSchema),
|
|
2163
|
+
error: z29.null()
|
|
2414
2164
|
}),
|
|
2415
|
-
|
|
2416
|
-
status:
|
|
2417
|
-
result:
|
|
2418
|
-
error:
|
|
2165
|
+
z29.object({
|
|
2166
|
+
status: z29.literal("failed"),
|
|
2167
|
+
result: z29.null(),
|
|
2168
|
+
error: z29.string()
|
|
2419
2169
|
})
|
|
2420
2170
|
])), "analyzeVideoResultPayloadDtoSchema");
|
|
2421
2171
|
|
|
2422
2172
|
// src/modules/web-sockets/web-sockets.contracts.ts
|
|
2423
|
-
import { z as
|
|
2424
|
-
var generateTicketRequestSchema =
|
|
2425
|
-
body:
|
|
2173
|
+
import { z as z30 } from "zod/v4";
|
|
2174
|
+
var generateTicketRequestSchema = z30.object({
|
|
2175
|
+
body: z30.object({
|
|
2426
2176
|
username: userDbSchema.shape.username
|
|
2427
2177
|
})
|
|
2428
2178
|
});
|
|
2429
|
-
var generateTicketResponseSchema =
|
|
2430
|
-
ticket:
|
|
2179
|
+
var generateTicketResponseSchema = z30.object({
|
|
2180
|
+
ticket: z30.string()
|
|
2431
2181
|
});
|
|
2432
2182
|
var generateTicketContract = {
|
|
2433
2183
|
request: generateTicketRequestSchema,
|
|
2434
2184
|
response: generateTicketResponseSchema
|
|
2435
2185
|
};
|
|
2436
2186
|
|
|
2187
|
+
// src/modules/workout/plan/plan.contracts.ts
|
|
2188
|
+
import { z as z32 } from "zod/v4";
|
|
2189
|
+
|
|
2190
|
+
// src/modules/workout/plan/plan.dtos.ts
|
|
2191
|
+
import { z as z31 } from "zod/v4";
|
|
2192
|
+
var workoutExerciseInputQueryDtoSchema = z31.object({
|
|
2193
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
2194
|
+
sets: z31.array(workoutSetDbSchema.shape.reps),
|
|
2195
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex
|
|
2196
|
+
});
|
|
2197
|
+
var workoutSplitInputBaseQueryDtoSchema = z31.object({
|
|
2198
|
+
name: workoutSplitDbSchema.shape.name.min(1, "Split name is required"),
|
|
2199
|
+
orderIndex: z31.number().int().nonnegative(),
|
|
2200
|
+
exercises: z31.array(workoutExerciseInputQueryDtoSchema).min(1, "Each split must include at least one exercise")
|
|
2201
|
+
});
|
|
2202
|
+
var saveWorkoutSplitInputQueryDtoSchema = workoutSplitInputBaseQueryDtoSchema.extend({
|
|
2203
|
+
id: workoutSplitDbSchema.shape.id.optional()
|
|
2204
|
+
});
|
|
2205
|
+
var saveWorkoutSplitPayloadQueryDtoSchema = z31.array(saveWorkoutSplitInputQueryDtoSchema).min(1, "Workout must include at least one split");
|
|
2206
|
+
var exerciseInPlanQueryDtoSchema = z31.object({
|
|
2207
|
+
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
2208
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
2209
|
+
name: exerciseDbSchema.shape.name,
|
|
2210
|
+
sets: z31.array(z31.object({
|
|
2211
|
+
orderIndex: workoutSetDbSchema.shape.orderIndex,
|
|
2212
|
+
reps: workoutSetDbSchema.shape.reps
|
|
2213
|
+
})),
|
|
2214
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
2215
|
+
isActive: exerciseToWorkoutSplitDbSchema.shape.isActive,
|
|
2216
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
2217
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2218
|
+
});
|
|
2219
|
+
var workoutSplitQueryDtoSchema = z31.object({
|
|
2220
|
+
id: workoutSplitDbSchema.shape.id,
|
|
2221
|
+
workoutId: workoutSplitDbSchema.shape.workoutId,
|
|
2222
|
+
name: workoutSplitDbSchema.shape.name,
|
|
2223
|
+
orderIndex: workoutSplitDbSchema.shape.orderIndex,
|
|
2224
|
+
createdAt: serializedDateSchema,
|
|
2225
|
+
muscleGroup: z31.string().nullable(),
|
|
2226
|
+
isActive: workoutSplitDbSchema.shape.isActive,
|
|
2227
|
+
exercises: z31.array(exerciseInPlanQueryDtoSchema)
|
|
2228
|
+
});
|
|
2229
|
+
var wholeUserWorkoutPlanQueryDtoSchema = z31.object({
|
|
2230
|
+
id: workoutPlanDbSchema.shape.id,
|
|
2231
|
+
numberOfSplits: z31.number(),
|
|
2232
|
+
createdAt: serializedDateSchema,
|
|
2233
|
+
userId: userDbSchema.shape.id,
|
|
2234
|
+
isActive: workoutPlanDbSchema.shape.isActive,
|
|
2235
|
+
updatedAt: serializedDateSchema,
|
|
2236
|
+
workoutSplits: z31.array(workoutSplitQueryDtoSchema).nullable()
|
|
2237
|
+
});
|
|
2238
|
+
var workoutPlanIdQueryDtoSchema = z31.object({
|
|
2239
|
+
id: workoutPlanDbSchema.shape.id
|
|
2240
|
+
});
|
|
2241
|
+
var workoutSplitIdQueryDtoSchema = z31.object({
|
|
2242
|
+
id: workoutSplitDbSchema.shape.id
|
|
2243
|
+
});
|
|
2244
|
+
var exerciseAssignmentIdQueryDtoSchema = z31.object({
|
|
2245
|
+
id: exerciseToWorkoutSplitDbSchema.shape.id
|
|
2246
|
+
});
|
|
2247
|
+
|
|
2248
|
+
// src/modules/workout/plan/plan.contracts.ts
|
|
2249
|
+
var getWholeWorkoutPlanRequestSchema = z32.object({
|
|
2250
|
+
query: z32.object({
|
|
2251
|
+
tz: z32.string().optional()
|
|
2252
|
+
})
|
|
2253
|
+
});
|
|
2254
|
+
var getWholeUserWorkoutPlanResponseSchema = z32.object({
|
|
2255
|
+
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema.nullable()
|
|
2256
|
+
});
|
|
2257
|
+
var getWholeUserWorkoutPlanContract = {
|
|
2258
|
+
request: getWholeWorkoutPlanRequestSchema,
|
|
2259
|
+
response: getWholeUserWorkoutPlanResponseSchema
|
|
2260
|
+
};
|
|
2261
|
+
var workoutMutationResponseSchema = z32.object({
|
|
2262
|
+
message: z32.string(),
|
|
2263
|
+
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema
|
|
2264
|
+
});
|
|
2265
|
+
var addWorkoutRequestSchema = z32.object({
|
|
2266
|
+
body: z32.object({
|
|
2267
|
+
workoutData: saveWorkoutSplitPayloadQueryDtoSchema,
|
|
2268
|
+
workoutName: z32.string().optional(),
|
|
2269
|
+
tz: z32.string()
|
|
2270
|
+
})
|
|
2271
|
+
});
|
|
2272
|
+
var addWorkoutResponseSchema = workoutMutationResponseSchema;
|
|
2273
|
+
var addWorkoutContract = {
|
|
2274
|
+
request: addWorkoutRequestSchema,
|
|
2275
|
+
response: addWorkoutResponseSchema
|
|
2276
|
+
};
|
|
2277
|
+
|
|
2437
2278
|
// src/modules/workout/tracking/tracking.contracts.ts
|
|
2438
|
-
import { z as
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2279
|
+
import { z as z34 } from "zod/v4";
|
|
2280
|
+
|
|
2281
|
+
// src/modules/workout/tracking/tracking.dtos.ts
|
|
2282
|
+
import { z as z33 } from "zod/v4";
|
|
2283
|
+
var trackedSetQueryDtoSchema = z33.object({
|
|
2284
|
+
reps: trackingSetDbSchema.shape.reps,
|
|
2285
|
+
weight: trackingSetDbSchema.shape.weight,
|
|
2286
|
+
setIndex: trackingSetDbSchema.shape.setIndex
|
|
2287
|
+
});
|
|
2288
|
+
var finishedWorkoutEntryBaseQueryDtoSchema = z33.object({
|
|
2289
|
+
trackedSets: z33.array(trackedSetQueryDtoSchema),
|
|
2290
|
+
notes: exerciseTrackingDbSchema.shape.notes.optional()
|
|
2291
|
+
});
|
|
2292
|
+
var finishedWorkoutEntryQueryDtoSchema = finishedWorkoutEntryBaseQueryDtoSchema.extend({
|
|
2293
|
+
isExerciseAssignedToSplit: z33.boolean(),
|
|
2294
|
+
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
2295
|
+
exerciseId: exerciseTrackingDbSchema.shape.exerciseId
|
|
2296
|
+
});
|
|
2297
|
+
var exerciseMetadataQueryDtoSchema = z33.object({
|
|
2298
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
2299
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2300
|
+
});
|
|
2301
|
+
var exerciseTrackingPrMaxQueryDtoSchema = z33.object({
|
|
2302
|
+
exercise: exerciseDbSchema.shape.name,
|
|
2303
|
+
weight: trackingSetDbSchema.shape.weight,
|
|
2304
|
+
reps: trackingSetDbSchema.shape.reps,
|
|
2305
|
+
workoutTimeUtc: serializedDateSchema
|
|
2306
|
+
});
|
|
2307
|
+
var exerciseTrackingAnalysisQueryDtoSchema = z33.object({
|
|
2308
|
+
uniqueDays: z33.number(),
|
|
2309
|
+
mostFrequentSplit: z33.string().nullable(),
|
|
2310
|
+
mostFrequentSplitDays: z33.number().nullable(),
|
|
2311
|
+
lastWorkoutDate: z33.string().nullable(),
|
|
2312
|
+
splitDaysByName: z33.record(z33.string(), z33.number()),
|
|
2313
|
+
prs: z33.object({
|
|
2314
|
+
prMax: exerciseTrackingPrMaxQueryDtoSchema.nullable()
|
|
2315
|
+
})
|
|
2316
|
+
});
|
|
2317
|
+
var trackingMapItemQueryDtoSchema = z33.object({
|
|
2318
|
+
id: exerciseTrackingDbSchema.shape.id,
|
|
2319
|
+
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
2320
|
+
weight: z33.array(trackingSetDbSchema.shape.weight),
|
|
2321
|
+
reps: z33.array(trackingSetDbSchema.shape.reps),
|
|
2322
|
+
notes: exerciseTrackingDbSchema.shape.notes,
|
|
2323
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
2324
|
+
workoutSplitId: workoutSplitDbSchema.shape.id,
|
|
2325
|
+
splitName: workoutSplitDbSchema.shape.name,
|
|
2326
|
+
exercise: exerciseDbSchema.shape.name,
|
|
2327
|
+
workoutDate: serializedDateSchema,
|
|
2328
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
2329
|
+
exerciseToWorkoutSplit: z33.object({
|
|
2330
|
+
sets: z33.array(workoutSetDbSchema.shape.reps),
|
|
2331
|
+
exercises: exerciseMetadataQueryDtoSchema
|
|
2332
|
+
})
|
|
2333
|
+
});
|
|
2334
|
+
var trackingByDateItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2335
|
+
workoutDate: true
|
|
2336
|
+
});
|
|
2337
|
+
var trackingBySplitNameItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2338
|
+
splitName: true
|
|
2339
|
+
});
|
|
2340
|
+
var groupedTrackingItemQueryDtoSchema = z33.object({
|
|
2341
|
+
exerciseTracking: z33.object({
|
|
2342
|
+
exerciseTrackingId: exerciseTrackingDbSchema.shape.id,
|
|
2343
|
+
sets: z33.array(z33.object({
|
|
2344
|
+
setIndex: trackingSetDbSchema.shape.setIndex,
|
|
2345
|
+
weight: trackingSetDbSchema.shape.weight,
|
|
2346
|
+
reps: trackingSetDbSchema.shape.reps
|
|
2347
|
+
})),
|
|
2348
|
+
notes: exerciseTrackingDbSchema.shape.notes,
|
|
2349
|
+
exerciseAssignment: z33.object({
|
|
2350
|
+
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
2351
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex.nullable(),
|
|
2352
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
2353
|
+
workoutSplitId: workoutSplitDbSchema.shape.id,
|
|
2354
|
+
workoutSplitName: workoutSplitDbSchema.shape.name,
|
|
2355
|
+
exerciseName: exerciseDbSchema.shape.name,
|
|
2356
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
2357
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2358
|
+
})
|
|
2359
|
+
})
|
|
2360
|
+
});
|
|
2361
|
+
var exerciseTrackingStatsQueryDtoSchema = z33.object({
|
|
2362
|
+
workoutCount: z33.coerce.number(),
|
|
2363
|
+
hasExerciseTracking: z33.boolean(),
|
|
2364
|
+
nextWorkoutSplit: z33.object({
|
|
2365
|
+
id: workoutSplitDbSchema.shape.id,
|
|
2366
|
+
name: workoutSplitDbSchema.shape.name,
|
|
2367
|
+
orderIndex: workoutSplitDbSchema.shape.orderIndex,
|
|
2368
|
+
muscleGroup: z33.string().nullable()
|
|
2369
|
+
}).nullable(),
|
|
2370
|
+
workoutTargets: z33.object({
|
|
2371
|
+
workoutCountThisWeek: z33.coerce.number(),
|
|
2372
|
+
workoutCountScheduledPerWeek: z33.coerce.number(),
|
|
2373
|
+
weekStreak: z33.coerce.number()
|
|
2374
|
+
}),
|
|
2375
|
+
lastWorkoutStats: z33.object({
|
|
2376
|
+
workoutDate: z33.string().nullable(),
|
|
2377
|
+
workoutSplitName: workoutSplitDbSchema.shape.name.nullable(),
|
|
2378
|
+
exerciseTrackedCount: z33.coerce.number().nullable(),
|
|
2379
|
+
setTrackedCount: z33.coerce.number().nullable()
|
|
2380
|
+
}),
|
|
2381
|
+
prs: z33.array(z33.object({
|
|
2382
|
+
exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
|
|
2383
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
2384
|
+
exerciseName: exerciseDbSchema.shape.name,
|
|
2385
|
+
prWeight: trackingSetDbSchema.shape.weight,
|
|
2386
|
+
prReps: trackingSetDbSchema.shape.reps,
|
|
2387
|
+
prSetIndex: trackingSetDbSchema.shape.setIndex,
|
|
2388
|
+
estimatedOneRepMax: z33.number().nullable()
|
|
2389
|
+
}))
|
|
2390
|
+
});
|
|
2391
|
+
var exerciseTrackingMapsQueryDtoSchema = z33.object({
|
|
2392
|
+
byDate: z33.record(z33.string(), z33.array(groupedTrackingItemQueryDtoSchema)),
|
|
2393
|
+
byExerciseToSplitId: z33.record(z33.string(), z33.array(groupedTrackingItemQueryDtoSchema)),
|
|
2394
|
+
bySplitName: z33.record(z33.string(), z33.array(groupedTrackingItemQueryDtoSchema))
|
|
2395
|
+
});
|
|
2396
|
+
var exerciseTrackingAndStatsQueryDtoSchema = z33.object({
|
|
2397
|
+
trackingStats: exerciseTrackingStatsQueryDtoSchema,
|
|
2398
|
+
trackingMaps: exerciseTrackingMapsQueryDtoSchema
|
|
2399
|
+
});
|
|
2400
|
+
var exerciseTrackingAndStatsRowQueryDtoSchema = z33.object({
|
|
2401
|
+
data: exerciseTrackingAndStatsQueryDtoSchema
|
|
2402
|
+
});
|
|
2403
|
+
var exerciseTrackingStatsRowQueryDtoSchema = z33.object({
|
|
2404
|
+
data: exerciseTrackingStatsQueryDtoSchema
|
|
2405
|
+
});
|
|
2406
|
+
var exerciseTrackingMapsRowQueryDtoSchema = z33.object({
|
|
2407
|
+
data: exerciseTrackingMapsQueryDtoSchema
|
|
2408
|
+
});
|
|
2409
|
+
var workoutSplitLookupQueryDtoSchema = z33.object({
|
|
2410
|
+
workoutSplitId: workoutSplitDbSchema.shape.id
|
|
2411
|
+
});
|
|
2412
|
+
var workoutSummaryIdQueryDtoSchema = z33.object({
|
|
2413
|
+
id: z33.string().uuid()
|
|
2414
|
+
});
|
|
2415
|
+
var exerciseTrackingIdQueryDtoSchema = z33.object({
|
|
2416
|
+
id: exerciseTrackingDbSchema.shape.id
|
|
2417
|
+
});
|
|
2418
|
+
|
|
2419
|
+
// src/modules/workout/tracking/tracking.contracts.ts
|
|
2420
|
+
var getExerciseTrackingRequestSchema = z34.object({
|
|
2421
|
+
query: z34.object({
|
|
2422
|
+
tz: z34.string().optional()
|
|
2442
2423
|
})
|
|
2443
2424
|
});
|
|
2444
2425
|
var getExerciseTrackingResponseSchema = exerciseTrackingMapsQueryDtoSchema;
|
|
@@ -2451,12 +2432,12 @@ var getExerciseTrackingStatsContract = {
|
|
|
2451
2432
|
request: getExerciseTrackingRequestSchema,
|
|
2452
2433
|
response: getExerciseTrackingStatsResponseSchema
|
|
2453
2434
|
};
|
|
2454
|
-
var finishWorkoutRequestSchema =
|
|
2455
|
-
body:
|
|
2456
|
-
workout:
|
|
2457
|
-
tz:
|
|
2458
|
-
workoutStartUtc:
|
|
2459
|
-
workoutEndUtc:
|
|
2435
|
+
var finishWorkoutRequestSchema = z34.object({
|
|
2436
|
+
body: z34.object({
|
|
2437
|
+
workout: z34.array(finishedWorkoutEntryQueryDtoSchema),
|
|
2438
|
+
tz: z34.string().optional(),
|
|
2439
|
+
workoutStartUtc: z34.string().datetime("workoutStartUtc must be a valid ISO datetime"),
|
|
2440
|
+
workoutEndUtc: z34.string().datetime("workoutEndUtc must be a valid ISO datetime").optional().nullable()
|
|
2460
2441
|
})
|
|
2461
2442
|
});
|
|
2462
2443
|
var finishUserWorkoutResponseSchema = exerciseTrackingAndStatsQueryDtoSchema;
|
|
@@ -2483,9 +2464,6 @@ export {
|
|
|
2483
2464
|
appleOAuthRequestSchema,
|
|
2484
2465
|
appleTokenVerificationResultDtoSchema,
|
|
2485
2466
|
authenticatedUserForUpdateQueryDtoSchema,
|
|
2486
|
-
bootstrapContract,
|
|
2487
|
-
bootstrapRequestSchema,
|
|
2488
|
-
bootstrapResponseSchema,
|
|
2489
2467
|
changeEmailAndVerifyContract,
|
|
2490
2468
|
changeEmailAndVerifyRequestSchema,
|
|
2491
2469
|
changeEmailTokenPayloadDtoSchema,
|