@strong-together/shared 1.1.0 → 2.1.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 +2772 -0
- package/dist/index.d.cts +6259 -0
- package/dist/index.d.ts +6259 -5905
- package/dist/index.js +2516 -617
- package/package.json +19 -8
- package/README.md +0 -612
- package/dist/index.d.mts +0 -5905
- package/dist/index.mjs +0 -559
package/dist/index.js
CHANGED
|
@@ -1,666 +1,2565 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/common/transport.schemas.ts
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
|
+
var serializedDateSchema = z.string();
|
|
7
|
+
var timezoneSchema = z.string();
|
|
8
|
+
|
|
9
|
+
// src/database/database.schemas.ts
|
|
10
|
+
import { createInsertSchema, createSelectSchema, createUpdateSchema } from "drizzle-zod";
|
|
11
|
+
|
|
12
|
+
// ../../src/infrastructure/db/schema/drizzle/roles.ts
|
|
13
|
+
import { pgRole } from "drizzle-orm/pg-core";
|
|
14
|
+
var anonRole = pgRole("anon");
|
|
15
|
+
var authenticatedRole = pgRole("authenticated");
|
|
16
|
+
var guestRole = pgRole("guest");
|
|
17
|
+
var serviceRole = pgRole("service_role");
|
|
18
|
+
var appUserRole = pgRole("app_user");
|
|
19
|
+
var appRuntimeUserRole = pgRole("app_runtime_user", {
|
|
20
|
+
createDb: false,
|
|
21
|
+
createRole: false,
|
|
22
|
+
inherit: false
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// ../../src/infrastructure/db/schema/drizzle/schemas.ts
|
|
26
|
+
import { pgSchema } from "drizzle-orm/pg-core";
|
|
27
|
+
var authSchema = pgSchema("auth");
|
|
28
|
+
var identitySchema = pgSchema("identity");
|
|
29
|
+
var workoutSchema = pgSchema("workout");
|
|
30
|
+
var trackingSchema = pgSchema("tracking");
|
|
31
|
+
var remindersSchema = pgSchema("reminders");
|
|
32
|
+
var analyticsSchema = pgSchema("analytics");
|
|
33
|
+
var messagesSchema = pgSchema("messages");
|
|
34
|
+
var authProviders = identitySchema.enum("Auth Providers", [
|
|
35
|
+
"apple",
|
|
36
|
+
"google",
|
|
37
|
+
"app"
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/user/table.ts
|
|
41
|
+
import { relations as relations14, sql as drizzleSql24 } from "drizzle-orm";
|
|
42
|
+
import { bigint as bigint11, boolean as boolean6, primaryKey as primaryKey14, text as text8, timestamp as timestamp10, uniqueIndex as uniqueIndex3, uuid as uuid11 } from "drizzle-orm/pg-core";
|
|
43
|
+
|
|
44
|
+
// ../../src/infrastructure/db/schema/drizzle/messages/messages/table.ts
|
|
45
|
+
import { relations, sql as drizzleSql2 } from "drizzle-orm";
|
|
46
|
+
import { boolean, foreignKey, index, primaryKey, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
47
|
+
|
|
48
|
+
// ../../src/infrastructure/db/schema/drizzle/messages/messages/policies.ts
|
|
49
|
+
import { sql as drizzleSql } from "drizzle-orm";
|
|
50
|
+
import { pgPolicy } from "drizzle-orm/pg-core";
|
|
51
|
+
var uid = drizzleSql`"identity"."current_user_id"()`;
|
|
52
|
+
function messagePolicies(t) {
|
|
53
|
+
const participant = drizzleSql`${uid} = ${t.senderId} or ${uid} = ${t.receiverId}`;
|
|
54
|
+
return [
|
|
55
|
+
// Lets authenticated message participants read their sent or received messages.
|
|
56
|
+
pgPolicy("Enable read access for auth users on message", {
|
|
57
|
+
for: "select",
|
|
58
|
+
to: authenticatedRole,
|
|
59
|
+
using: participant
|
|
60
|
+
}),
|
|
61
|
+
// Lets authenticated users send as themselves or as the existing system sender.
|
|
62
|
+
pgPolicy("Enable insert for auth users on message", {
|
|
63
|
+
for: "insert",
|
|
64
|
+
to: authenticatedRole,
|
|
65
|
+
withCheck: drizzleSql`${uid} = ${t.senderId} or ${t.senderId} = '8dedd0e0-8c25-4c84-a05b-4ae5f5c48f3a'::uuid`
|
|
66
|
+
}),
|
|
67
|
+
// Lets authenticated message participants update a message while remaining participants.
|
|
68
|
+
pgPolicy("Enable update for auth users on message", {
|
|
69
|
+
for: "update",
|
|
70
|
+
to: authenticatedRole,
|
|
71
|
+
using: participant,
|
|
72
|
+
withCheck: participant
|
|
73
|
+
}),
|
|
74
|
+
// Lets authenticated message participants delete their sent or received messages.
|
|
75
|
+
pgPolicy("Enable delete for auth users on message", {
|
|
76
|
+
for: "delete",
|
|
77
|
+
to: authenticatedRole,
|
|
78
|
+
using: participant
|
|
79
|
+
})
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
__name(messagePolicies, "messagePolicies");
|
|
83
|
+
|
|
84
|
+
// ../../src/infrastructure/db/schema/drizzle/messages/messages/table.ts
|
|
85
|
+
var uid2 = drizzleSql2`"identity"."current_user_id"()`;
|
|
86
|
+
var message = messagesSchema.table("message", {
|
|
87
|
+
id: uuid("id").defaultRandom().notNull(),
|
|
88
|
+
senderId: uuid("sender_id").default(uid2).notNull(),
|
|
89
|
+
receiverId: uuid("receiver_id").default(uid2).notNull(),
|
|
90
|
+
subject: text("subject").default("Subject").notNull(),
|
|
91
|
+
msg: text("msg").default("Hello World").notNull(),
|
|
92
|
+
sentAt: timestamp("sent_at", {
|
|
93
|
+
withTimezone: true
|
|
94
|
+
}).default(drizzleSql2`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
95
|
+
isRead: boolean("is_read").default(false).notNull()
|
|
96
|
+
}, (t) => [
|
|
97
|
+
primaryKey({
|
|
98
|
+
name: "message_pkey",
|
|
99
|
+
columns: [
|
|
100
|
+
t.id
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
foreignKey({
|
|
104
|
+
name: "message_sender_id_fkey",
|
|
105
|
+
columns: [
|
|
106
|
+
t.senderId
|
|
107
|
+
],
|
|
108
|
+
foreignColumns: [
|
|
109
|
+
user.id
|
|
110
|
+
]
|
|
111
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
112
|
+
foreignKey({
|
|
113
|
+
name: "message_receiver_id_fkey",
|
|
114
|
+
columns: [
|
|
115
|
+
t.receiverId
|
|
116
|
+
],
|
|
117
|
+
foreignColumns: [
|
|
118
|
+
user.id
|
|
119
|
+
]
|
|
120
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
121
|
+
index("message_receiver_id_idx").on(t.receiverId),
|
|
122
|
+
...messagePolicies(t)
|
|
123
|
+
]);
|
|
124
|
+
var messageRelations = relations(message, ({ one }) => ({
|
|
125
|
+
sender: one(user, {
|
|
126
|
+
fields: [
|
|
127
|
+
message.senderId
|
|
128
|
+
],
|
|
129
|
+
references: [
|
|
130
|
+
user.id
|
|
131
|
+
],
|
|
132
|
+
relationName: "messageSender"
|
|
133
|
+
}),
|
|
134
|
+
receiver: one(user, {
|
|
135
|
+
fields: [
|
|
136
|
+
message.receiverId
|
|
137
|
+
],
|
|
138
|
+
references: [
|
|
139
|
+
user.id
|
|
140
|
+
],
|
|
141
|
+
relationName: "messageReceiver"
|
|
142
|
+
})
|
|
143
|
+
}));
|
|
144
|
+
|
|
145
|
+
// ../../src/infrastructure/db/schema/drizzle/reminders/user_reminder_setting/table.ts
|
|
146
|
+
import { relations as relations2, sql as drizzleSql4 } from "drizzle-orm";
|
|
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
|
+
|
|
149
|
+
// ../../src/infrastructure/db/schema/drizzle/reminders/user_reminder_setting/policies.ts
|
|
150
|
+
import { sql as drizzleSql3 } from "drizzle-orm";
|
|
151
|
+
import { pgPolicy as pgPolicy2 } from "drizzle-orm/pg-core";
|
|
152
|
+
var uid3 = drizzleSql3`"identity"."current_user_id"()`;
|
|
153
|
+
function userReminderSettingPolicies(t) {
|
|
154
|
+
return [
|
|
155
|
+
// Lets authenticated users read only their own reminder settings.
|
|
156
|
+
pgPolicy2("auth can SELECT own reminder settings", {
|
|
157
|
+
for: "select",
|
|
158
|
+
to: authenticatedRole,
|
|
159
|
+
using: drizzleSql3`${uid3} = ${t.userId}`
|
|
160
|
+
}),
|
|
161
|
+
// Lets authenticated users insert reminder settings only for themselves.
|
|
162
|
+
pgPolicy2("auth can INSERT own reminder settings", {
|
|
163
|
+
for: "insert",
|
|
164
|
+
to: authenticatedRole,
|
|
165
|
+
withCheck: drizzleSql3`${uid3} = ${t.userId}`
|
|
166
|
+
}),
|
|
167
|
+
// Lets authenticated users update their own reminder settings and preserves ownership.
|
|
168
|
+
pgPolicy2("auth can UPDATE own reminder settings", {
|
|
169
|
+
for: "update",
|
|
170
|
+
to: authenticatedRole,
|
|
171
|
+
using: drizzleSql3`${uid3} = ${t.userId}`,
|
|
172
|
+
withCheck: drizzleSql3`${uid3} = ${t.userId}`
|
|
173
|
+
}),
|
|
174
|
+
// Provides the original additional update policy for settings owned by the user.
|
|
175
|
+
pgPolicy2("Allow authenticated users to update their own reminder settings", {
|
|
176
|
+
for: "update",
|
|
177
|
+
to: authenticatedRole,
|
|
178
|
+
using: drizzleSql3`${uid3} = ${t.userId}`
|
|
179
|
+
})
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
__name(userReminderSettingPolicies, "userReminderSettingPolicies");
|
|
183
|
+
|
|
184
|
+
// ../../src/infrastructure/db/schema/drizzle/reminders/user_reminder_setting/table.ts
|
|
185
|
+
var userReminderSetting = remindersSchema.table("user_reminder_setting", {
|
|
186
|
+
userId: uuid2("user_id").notNull(),
|
|
187
|
+
workoutRemindersEnabled: boolean2("workout_reminders_enabled").default(true).notNull(),
|
|
188
|
+
reminderOffsetMinutes: integer("reminder_offset_minutes").default(60).notNull(),
|
|
189
|
+
updatedAt: timestamp2("updated_at", {
|
|
190
|
+
withTimezone: true
|
|
191
|
+
}).default(drizzleSql4`timezone('UTC', now())`).notNull(),
|
|
192
|
+
timezone: text2("timezone").default("'UTC'::text")
|
|
193
|
+
}, (t) => [
|
|
194
|
+
primaryKey2({
|
|
195
|
+
name: "user_reminder_setting_pkey",
|
|
196
|
+
columns: [
|
|
197
|
+
t.userId
|
|
198
|
+
]
|
|
199
|
+
}),
|
|
200
|
+
foreignKey2({
|
|
201
|
+
name: "user_reminder_setting_user_id_fkey",
|
|
202
|
+
columns: [
|
|
203
|
+
t.userId
|
|
204
|
+
],
|
|
205
|
+
foreignColumns: [
|
|
206
|
+
user.id
|
|
207
|
+
]
|
|
208
|
+
}).onDelete("cascade"),
|
|
209
|
+
...userReminderSettingPolicies(t)
|
|
210
|
+
]);
|
|
211
|
+
var userReminderSettingRelations = relations2(userReminderSetting, ({ one }) => ({
|
|
212
|
+
user: one(user, {
|
|
213
|
+
fields: [
|
|
214
|
+
userReminderSetting.userId
|
|
215
|
+
],
|
|
216
|
+
references: [
|
|
217
|
+
user.id
|
|
218
|
+
]
|
|
219
|
+
})
|
|
220
|
+
}));
|
|
221
|
+
|
|
222
|
+
// ../../src/infrastructure/db/schema/drizzle/reminders/user_split_information/table.ts
|
|
223
|
+
import { relations as relations11, sql as drizzleSql18 } from "drizzle-orm";
|
|
224
|
+
import { bigint as bigint9, foreignKey as foreignKey10, index as index8, integer as integer4, numeric, primaryKey as primaryKey11, timestamp as timestamp7, unique as unique5, uuid as uuid8 } from "drizzle-orm/pg-core";
|
|
225
|
+
|
|
226
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_split/table.ts
|
|
227
|
+
import { relations as relations10, sql as drizzleSql17 } from "drizzle-orm";
|
|
228
|
+
import { bigint as bigint8, boolean as boolean5, foreignKey as foreignKey9, index as index7, primaryKey as primaryKey10, text as text5, timestamp as timestamp6, unique as unique4 } from "drizzle-orm/pg-core";
|
|
229
|
+
|
|
230
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/workout_summary/table.ts
|
|
231
|
+
import { relations as relations8, sql as drizzleSql13 } from "drizzle-orm";
|
|
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
|
+
|
|
234
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/exercise_tracking/table.ts
|
|
235
|
+
import { relations as relations7, sql as drizzleSql11 } from "drizzle-orm";
|
|
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
|
+
|
|
238
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercises/table.ts
|
|
239
|
+
import { relations as relations5 } from "drizzle-orm";
|
|
240
|
+
import { bigint as bigint3, primaryKey as primaryKey5, text as text3, uniqueIndex } from "drizzle-orm/pg-core";
|
|
241
|
+
|
|
242
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercisetoworkoutsplit/table.ts
|
|
243
|
+
import { relations as relations4, sql as drizzleSql7 } from "drizzle-orm";
|
|
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
|
+
|
|
246
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_set/table.ts
|
|
247
|
+
import { relations as relations3 } from "drizzle-orm";
|
|
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
|
+
|
|
250
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_set/policies.ts
|
|
251
|
+
import { sql as drizzleSql5 } from "drizzle-orm";
|
|
252
|
+
import { pgPolicy as pgPolicy3 } from "drizzle-orm/pg-core";
|
|
253
|
+
var currentUserId = drizzleSql5`"identity"."current_user_id"()`;
|
|
254
|
+
function workoutSetPolicies(table) {
|
|
255
|
+
const ownsWorkoutSet = drizzleSql5`exists (
|
|
256
|
+
select 1
|
|
257
|
+
from "workout"."exercise_to_workout_split" ets
|
|
258
|
+
join "workout"."workout_split" ws on ws."id" = ets."workout_split_id"
|
|
259
|
+
join "workout"."workout_plan" wp on wp."id" = ws."workout_id"
|
|
260
|
+
where ets."id" = ${table.exerciseToSplitId}
|
|
261
|
+
and wp."user_id" = ${currentUserId}
|
|
262
|
+
)`;
|
|
263
|
+
return [
|
|
264
|
+
// Lets authenticated users read planned sets only from workout plans they own.
|
|
265
|
+
pgPolicy3("Enable read access for auth users on workout_set", {
|
|
266
|
+
for: "select",
|
|
267
|
+
to: authenticatedRole,
|
|
268
|
+
using: ownsWorkoutSet
|
|
269
|
+
}),
|
|
270
|
+
// Lets authenticated users add planned sets only to workout plans they own.
|
|
271
|
+
pgPolicy3("Enable insert for auth users on workout_set", {
|
|
272
|
+
for: "insert",
|
|
273
|
+
to: authenticatedRole,
|
|
274
|
+
withCheck: ownsWorkoutSet
|
|
275
|
+
}),
|
|
276
|
+
// Lets authenticated users update planned sets only within workout plans they own.
|
|
277
|
+
pgPolicy3("Enable update for auth users on workout_set", {
|
|
278
|
+
for: "update",
|
|
279
|
+
to: authenticatedRole,
|
|
280
|
+
using: ownsWorkoutSet,
|
|
281
|
+
withCheck: ownsWorkoutSet
|
|
282
|
+
}),
|
|
283
|
+
// Lets authenticated users delete planned sets only from workout plans they own.
|
|
284
|
+
pgPolicy3("Enable delete for auth users on workout_set", {
|
|
285
|
+
for: "delete",
|
|
286
|
+
to: authenticatedRole,
|
|
287
|
+
using: ownsWorkoutSet
|
|
288
|
+
})
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
__name(workoutSetPolicies, "workoutSetPolicies");
|
|
292
|
+
|
|
293
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_set/table.ts
|
|
294
|
+
var workoutSet = workoutSchema.table("workout_set", {
|
|
295
|
+
id: uuid3("id").defaultRandom().notNull(),
|
|
296
|
+
exerciseToSplitId: bigint("exercise_to_split_id", {
|
|
297
|
+
mode: "number"
|
|
298
|
+
}).notNull(),
|
|
299
|
+
orderIndex: integer2("order_index").notNull(),
|
|
300
|
+
reps: integer2("reps").notNull()
|
|
301
|
+
}, (t) => [
|
|
302
|
+
primaryKey3({
|
|
303
|
+
name: "workout_set_pkey",
|
|
304
|
+
columns: [
|
|
305
|
+
t.id
|
|
306
|
+
]
|
|
307
|
+
}),
|
|
308
|
+
unique("workout_set_exercise_order_unique").on(t.exerciseToSplitId, t.orderIndex),
|
|
309
|
+
foreignKey3({
|
|
310
|
+
name: "workout_set_exercise_to_split_id_fkey",
|
|
311
|
+
columns: [
|
|
312
|
+
t.exerciseToSplitId
|
|
313
|
+
],
|
|
314
|
+
foreignColumns: [
|
|
315
|
+
exerciseToWorkoutSplit.id
|
|
316
|
+
]
|
|
317
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
318
|
+
index2("workout_set_exercise_to_split_id_idx").on(t.exerciseToSplitId),
|
|
319
|
+
...workoutSetPolicies(t)
|
|
320
|
+
]);
|
|
321
|
+
var workoutSetRelations = relations3(workoutSet, ({ one }) => ({
|
|
322
|
+
exerciseToWorkoutSplit: one(exerciseToWorkoutSplit, {
|
|
323
|
+
fields: [
|
|
324
|
+
workoutSet.exerciseToSplitId
|
|
325
|
+
],
|
|
326
|
+
references: [
|
|
327
|
+
exerciseToWorkoutSplit.id
|
|
328
|
+
]
|
|
329
|
+
})
|
|
330
|
+
}));
|
|
331
|
+
|
|
332
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercisetoworkoutsplit/policies.ts
|
|
333
|
+
import { sql as drizzleSql6 } from "drizzle-orm";
|
|
334
|
+
import { pgPolicy as pgPolicy4 } from "drizzle-orm/pg-core";
|
|
335
|
+
var uid4 = drizzleSql6`"identity"."current_user_id"()`;
|
|
336
|
+
function exerciseToWorkoutSplitPolicies(t) {
|
|
337
|
+
const owns = drizzleSql6`${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 = drizzleSql6`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
|
+
return [
|
|
340
|
+
// Lets authenticated users read exercise assignments in splits they own.
|
|
341
|
+
pgPolicy4("Enable read access for auth users on exercise_to_workout_split", {
|
|
342
|
+
for: "select",
|
|
343
|
+
to: authenticatedRole,
|
|
344
|
+
using: owns
|
|
345
|
+
}),
|
|
346
|
+
// Lets authenticated users add exercise assignments only to splits they own.
|
|
347
|
+
pgPolicy4("Enable insert for auth users on exercise_to_workout_split", {
|
|
348
|
+
for: "insert",
|
|
349
|
+
to: authenticatedRole,
|
|
350
|
+
withCheck: owns
|
|
351
|
+
}),
|
|
352
|
+
// Lets authenticated users update exercise assignments only in splits they own.
|
|
353
|
+
pgPolicy4("Enable update for auth users on exercise_to_workout_split", {
|
|
354
|
+
for: "update",
|
|
355
|
+
to: authenticatedRole,
|
|
356
|
+
using: owns,
|
|
357
|
+
withCheck: owns
|
|
358
|
+
}),
|
|
359
|
+
// Lets authenticated users delete exercise assignments only from splits they own.
|
|
360
|
+
pgPolicy4("Enable delete for auth users on exercise_to_workout_split", {
|
|
361
|
+
for: "delete",
|
|
362
|
+
to: authenticatedRole,
|
|
363
|
+
using: ownsForDelete
|
|
364
|
+
})
|
|
365
|
+
];
|
|
366
|
+
}
|
|
367
|
+
__name(exerciseToWorkoutSplitPolicies, "exerciseToWorkoutSplitPolicies");
|
|
368
|
+
|
|
369
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercisetoworkoutsplit/table.ts
|
|
370
|
+
var exerciseToWorkoutSplit = workoutSchema.table("exercise_to_workout_split", {
|
|
371
|
+
id: bigint2("id", {
|
|
372
|
+
mode: "number"
|
|
373
|
+
}).generatedByDefaultAsIdentity({
|
|
374
|
+
name: "exercise_to_workout_split_id_seq"
|
|
375
|
+
}).notNull(),
|
|
376
|
+
workoutSplitId: bigint2("workout_split_id", {
|
|
377
|
+
mode: "number"
|
|
378
|
+
}).notNull(),
|
|
379
|
+
exerciseId: bigint2("exercise_id", {
|
|
380
|
+
mode: "number"
|
|
381
|
+
}).notNull(),
|
|
382
|
+
createdAt: timestamp3("created_at", {
|
|
383
|
+
withTimezone: true
|
|
384
|
+
}).default(drizzleSql7`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
385
|
+
orderIndex: bigint2("order_index", {
|
|
386
|
+
mode: "number"
|
|
387
|
+
}).notNull(),
|
|
388
|
+
isActive: boolean3("is_active").default(true).notNull()
|
|
389
|
+
}, (t) => [
|
|
390
|
+
primaryKey4({
|
|
391
|
+
name: "exercise_to_workout_split_pkey",
|
|
392
|
+
columns: [
|
|
393
|
+
t.id
|
|
394
|
+
]
|
|
395
|
+
}),
|
|
396
|
+
unique2("uq_exercise_to_workout_split_workout_split_exercise").on(t.workoutSplitId, t.exerciseId),
|
|
397
|
+
foreignKey4({
|
|
398
|
+
name: "exercise_to_workout_split_exercise_id_fkey",
|
|
399
|
+
columns: [
|
|
400
|
+
t.exerciseId
|
|
401
|
+
],
|
|
402
|
+
foreignColumns: [
|
|
403
|
+
exercise.id
|
|
404
|
+
]
|
|
405
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
406
|
+
foreignKey4({
|
|
407
|
+
name: "exercise_to_workout_split_workout_split_id_fkey",
|
|
408
|
+
columns: [
|
|
409
|
+
t.workoutSplitId
|
|
410
|
+
],
|
|
411
|
+
foreignColumns: [
|
|
412
|
+
workoutSplit.id
|
|
413
|
+
]
|
|
414
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
415
|
+
index3("exercise_to_workout_split_active_idx").on(t.workoutSplitId, t.orderIndex).where(drizzleSql7`${t.isActive} = true`),
|
|
416
|
+
index3("exercise_to_workout_split_workout_split_id_order_index_idx").on(t.workoutSplitId, t.orderIndex),
|
|
417
|
+
...exerciseToWorkoutSplitPolicies(t)
|
|
418
|
+
]);
|
|
419
|
+
var exerciseToWorkoutSplitRelations = relations4(exerciseToWorkoutSplit, ({ many, one }) => ({
|
|
420
|
+
exercise: one(exercise, {
|
|
421
|
+
fields: [
|
|
422
|
+
exerciseToWorkoutSplit.exerciseId
|
|
423
|
+
],
|
|
424
|
+
references: [
|
|
425
|
+
exercise.id
|
|
426
|
+
]
|
|
427
|
+
}),
|
|
428
|
+
workoutSplit: one(workoutSplit, {
|
|
429
|
+
fields: [
|
|
430
|
+
exerciseToWorkoutSplit.workoutSplitId
|
|
431
|
+
],
|
|
432
|
+
references: [
|
|
433
|
+
workoutSplit.id
|
|
434
|
+
]
|
|
435
|
+
}),
|
|
436
|
+
exerciseTrackings: many(exerciseTracking),
|
|
437
|
+
workoutSets: many(workoutSet)
|
|
438
|
+
}));
|
|
439
|
+
|
|
440
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercises/policies.ts
|
|
441
|
+
import { sql as drizzleSql8 } from "drizzle-orm";
|
|
442
|
+
import { pgPolicy as pgPolicy5 } from "drizzle-orm/pg-core";
|
|
443
|
+
var exercisePolicies = /* @__PURE__ */ __name(() => [
|
|
444
|
+
// Makes the shared exercise catalog readable to every authenticated user.
|
|
445
|
+
pgPolicy5("Allow all authenticated users to read exercise", {
|
|
446
|
+
for: "select",
|
|
447
|
+
to: authenticatedRole,
|
|
448
|
+
using: drizzleSql8`true`
|
|
449
|
+
})
|
|
450
|
+
], "exercisePolicies");
|
|
451
|
+
|
|
452
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/exercises/table.ts
|
|
453
|
+
var exercise = workoutSchema.table("exercise", {
|
|
454
|
+
id: bigint3("id", {
|
|
455
|
+
mode: "number"
|
|
456
|
+
}).generatedByDefaultAsIdentity({
|
|
457
|
+
name: "exercise_id_seq"
|
|
458
|
+
}).notNull(),
|
|
459
|
+
name: text3("name").notNull(),
|
|
460
|
+
description: text3("description").notNull(),
|
|
461
|
+
targetMuscle: text3("target_muscle").notNull(),
|
|
462
|
+
specificTargetMuscle: text3("specific_target_muscle").notNull()
|
|
463
|
+
}, (t) => [
|
|
464
|
+
primaryKey5({
|
|
465
|
+
name: "exercise_pkey",
|
|
466
|
+
columns: [
|
|
467
|
+
t.id
|
|
468
|
+
]
|
|
469
|
+
}),
|
|
470
|
+
uniqueIndex("exercise_name_unique").on(t.name),
|
|
471
|
+
...exercisePolicies()
|
|
472
|
+
]);
|
|
473
|
+
var exerciseRelations = relations5(exercise, ({ many }) => ({
|
|
474
|
+
workoutSplitAssignments: many(exerciseToWorkoutSplit)
|
|
475
|
+
}));
|
|
476
|
+
|
|
477
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/tracking_set/table.ts
|
|
478
|
+
import { relations as relations6 } from "drizzle-orm";
|
|
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
|
+
|
|
481
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/tracking_set/policies.ts
|
|
482
|
+
import { sql as drizzleSql9 } from "drizzle-orm";
|
|
483
|
+
import { pgPolicy as pgPolicy6 } from "drizzle-orm/pg-core";
|
|
484
|
+
var currentUserId2 = drizzleSql9`"identity"."current_user_id"()`;
|
|
485
|
+
function trackingSetPolicies(table) {
|
|
486
|
+
const ownsExerciseTracking = drizzleSql9`exists (
|
|
487
|
+
select 1
|
|
488
|
+
from "tracking"."exercise_tracking" et
|
|
489
|
+
join "tracking"."workout_summary" ws on ws."id" = et."workout_summary_id"
|
|
490
|
+
where et."id" = ${table.exerciseTrackingId}
|
|
491
|
+
and ws."user_id" = ${currentUserId2}
|
|
492
|
+
)`;
|
|
493
|
+
return [
|
|
494
|
+
// Lets authenticated users read tracked sets only from workout summaries they own.
|
|
495
|
+
pgPolicy6("Enable read access for auth users on tracking_set", {
|
|
496
|
+
for: "select",
|
|
497
|
+
to: authenticatedRole,
|
|
498
|
+
using: ownsExerciseTracking
|
|
499
|
+
}),
|
|
500
|
+
// Lets authenticated users add tracked sets only to their own exercise tracking rows.
|
|
501
|
+
pgPolicy6("Enable insert for auth users on tracking_set", {
|
|
502
|
+
for: "insert",
|
|
503
|
+
to: authenticatedRole,
|
|
504
|
+
withCheck: ownsExerciseTracking
|
|
505
|
+
}),
|
|
506
|
+
// Lets authenticated users update tracked sets without moving them outside their own workout.
|
|
507
|
+
pgPolicy6("Enable update for auth users on tracking_set", {
|
|
508
|
+
for: "update",
|
|
509
|
+
to: authenticatedRole,
|
|
510
|
+
using: ownsExerciseTracking,
|
|
511
|
+
withCheck: ownsExerciseTracking
|
|
512
|
+
}),
|
|
513
|
+
// Lets authenticated users delete tracked sets only from workout summaries they own.
|
|
514
|
+
pgPolicy6("Enable delete for auth users on tracking_set", {
|
|
515
|
+
for: "delete",
|
|
516
|
+
to: authenticatedRole,
|
|
517
|
+
using: ownsExerciseTracking
|
|
518
|
+
})
|
|
519
|
+
];
|
|
520
|
+
}
|
|
521
|
+
__name(trackingSetPolicies, "trackingSetPolicies");
|
|
522
|
+
|
|
523
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/tracking_set/table.ts
|
|
524
|
+
var trackingSet = trackingSchema.table("tracking_set", {
|
|
525
|
+
id: uuid4("id").defaultRandom().notNull(),
|
|
526
|
+
exerciseTrackingId: bigint4("exercise_tracking_id", {
|
|
527
|
+
mode: "number"
|
|
528
|
+
}).notNull(),
|
|
529
|
+
setIndex: integer3("set_index").notNull(),
|
|
530
|
+
reps: integer3("reps").notNull(),
|
|
531
|
+
weight: real("weight").notNull()
|
|
532
|
+
}, (t) => [
|
|
533
|
+
primaryKey6({
|
|
534
|
+
name: "tracking_set_pkey",
|
|
535
|
+
columns: [
|
|
536
|
+
t.id
|
|
537
|
+
]
|
|
538
|
+
}),
|
|
539
|
+
unique3("tracking_set_exercise_index_unique").on(t.exerciseTrackingId, t.setIndex),
|
|
540
|
+
foreignKey5({
|
|
541
|
+
name: "tracking_set_exercise_tracking_id_fkey",
|
|
542
|
+
columns: [
|
|
543
|
+
t.exerciseTrackingId
|
|
544
|
+
],
|
|
545
|
+
foreignColumns: [
|
|
546
|
+
exerciseTracking.id
|
|
547
|
+
]
|
|
548
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
549
|
+
index4("tracking_set_exercise_tracking_id_idx").on(t.exerciseTrackingId),
|
|
550
|
+
...trackingSetPolicies(t)
|
|
551
|
+
]);
|
|
552
|
+
var trackingSetRelations = relations6(trackingSet, ({ one }) => ({
|
|
553
|
+
exerciseTracking: one(exerciseTracking, {
|
|
554
|
+
fields: [
|
|
555
|
+
trackingSet.exerciseTrackingId
|
|
556
|
+
],
|
|
557
|
+
references: [
|
|
558
|
+
exerciseTracking.id
|
|
559
|
+
]
|
|
560
|
+
})
|
|
561
|
+
}));
|
|
562
|
+
|
|
563
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/exercise_tracking/policies.ts
|
|
564
|
+
import { sql as drizzleSql10 } from "drizzle-orm";
|
|
565
|
+
import { pgPolicy as pgPolicy7 } from "drizzle-orm/pg-core";
|
|
566
|
+
var uid5 = drizzleSql10`"identity"."current_user_id"()`;
|
|
567
|
+
function exerciseTrackingPolicies(t) {
|
|
568
|
+
const owns = drizzleSql10`exists (select 1 from "tracking"."workout_summary" ws where ws."id" = ${t.workoutSummaryId} and ws."user_id" = ${uid5})`;
|
|
569
|
+
return [
|
|
570
|
+
// Lets authenticated users read exercise tracking rows through summaries they own.
|
|
571
|
+
pgPolicy7("exercise_tracking_select_by_summary_owner", {
|
|
572
|
+
for: "select",
|
|
573
|
+
to: authenticatedRole,
|
|
574
|
+
using: owns
|
|
575
|
+
}),
|
|
576
|
+
// Lets authenticated users insert exercise tracking rows through summaries they own.
|
|
577
|
+
pgPolicy7("exercise_tracking_insert_by_summary_owner", {
|
|
578
|
+
for: "insert",
|
|
579
|
+
to: authenticatedRole,
|
|
580
|
+
withCheck: owns
|
|
581
|
+
}),
|
|
582
|
+
// Lets authenticated users update exercise tracking rows through summaries they own.
|
|
583
|
+
pgPolicy7("exercise_tracking_update_by_summary_owner", {
|
|
584
|
+
for: "update",
|
|
585
|
+
to: authenticatedRole,
|
|
586
|
+
using: owns,
|
|
587
|
+
withCheck: owns
|
|
588
|
+
}),
|
|
589
|
+
// Lets authenticated users delete exercise tracking rows through summaries they own.
|
|
590
|
+
pgPolicy7("exercise_tracking_delete_by_summary_owner", {
|
|
591
|
+
for: "delete",
|
|
592
|
+
to: authenticatedRole,
|
|
593
|
+
using: owns
|
|
594
|
+
})
|
|
595
|
+
];
|
|
596
|
+
}
|
|
597
|
+
__name(exerciseTrackingPolicies, "exerciseTrackingPolicies");
|
|
598
|
+
|
|
599
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/exercise_tracking/table.ts
|
|
600
|
+
import { check } from "drizzle-orm/pg-core";
|
|
601
|
+
var exerciseTracking = trackingSchema.table("exercise_tracking", {
|
|
602
|
+
id: bigint5("id", {
|
|
603
|
+
mode: "number"
|
|
604
|
+
}).generatedByDefaultAsIdentity({
|
|
605
|
+
name: "exercise_tracking_id_seq"
|
|
606
|
+
}).notNull(),
|
|
607
|
+
workoutSummaryId: uuid5("workout_summary_id").notNull(),
|
|
608
|
+
exerciseToSplitId: bigint5("exercise_to_split_id", {
|
|
609
|
+
mode: "number"
|
|
610
|
+
}),
|
|
611
|
+
exerciseId: bigint5("exercise_id", {
|
|
612
|
+
mode: "number"
|
|
613
|
+
}),
|
|
614
|
+
notes: text4("notes")
|
|
615
|
+
}, (t) => [
|
|
616
|
+
primaryKey7({
|
|
617
|
+
name: "exercise_tracking_pkey",
|
|
618
|
+
columns: [
|
|
619
|
+
t.id
|
|
620
|
+
]
|
|
621
|
+
}),
|
|
622
|
+
foreignKey6({
|
|
623
|
+
name: "exercise_tracking_exercise_to_split_id_fkey",
|
|
624
|
+
columns: [
|
|
625
|
+
t.exerciseToSplitId
|
|
626
|
+
],
|
|
627
|
+
foreignColumns: [
|
|
628
|
+
exerciseToWorkoutSplit.id
|
|
629
|
+
]
|
|
630
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
631
|
+
foreignKey6({
|
|
632
|
+
name: "exercise_tracking_exercise_id_fkey",
|
|
633
|
+
columns: [
|
|
634
|
+
t.exerciseId
|
|
635
|
+
],
|
|
636
|
+
foreignColumns: [
|
|
637
|
+
exercise.id
|
|
638
|
+
]
|
|
639
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
640
|
+
foreignKey6({
|
|
641
|
+
name: "exercise_tracking_workout_summary_id_fkey",
|
|
642
|
+
columns: [
|
|
643
|
+
t.workoutSummaryId
|
|
644
|
+
],
|
|
645
|
+
foreignColumns: [
|
|
646
|
+
workoutSummary.id
|
|
647
|
+
]
|
|
648
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
649
|
+
check("exercise_tracking_xor_check", drizzleSql11`num_nonnulls(${t.exerciseToSplitId}, ${t.exerciseId}) = 1`),
|
|
650
|
+
index5("exercise_tracking_workout_summary_id_idx").on(t.workoutSummaryId),
|
|
651
|
+
...exerciseTrackingPolicies(t)
|
|
652
|
+
]);
|
|
653
|
+
var exerciseTrackingRelations = relations7(exerciseTracking, ({ many, one }) => ({
|
|
654
|
+
exerciseToWorkoutSplit: one(exerciseToWorkoutSplit, {
|
|
655
|
+
fields: [
|
|
656
|
+
exerciseTracking.exerciseToSplitId
|
|
657
|
+
],
|
|
658
|
+
references: [
|
|
659
|
+
exerciseToWorkoutSplit.id
|
|
660
|
+
]
|
|
661
|
+
}),
|
|
662
|
+
workoutSummary: one(workoutSummary, {
|
|
663
|
+
fields: [
|
|
664
|
+
exerciseTracking.workoutSummaryId
|
|
665
|
+
],
|
|
666
|
+
references: [
|
|
667
|
+
workoutSummary.id
|
|
668
|
+
]
|
|
669
|
+
}),
|
|
670
|
+
trackingSets: many(trackingSet),
|
|
671
|
+
exercise: one(exercise, {
|
|
672
|
+
fields: [
|
|
673
|
+
exerciseTracking.exerciseId
|
|
674
|
+
],
|
|
675
|
+
references: [
|
|
676
|
+
exercise.id
|
|
677
|
+
]
|
|
678
|
+
})
|
|
679
|
+
}));
|
|
680
|
+
|
|
681
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/workout_summary/policies.ts
|
|
682
|
+
import { sql as drizzleSql12 } from "drizzle-orm";
|
|
683
|
+
import { pgPolicy as pgPolicy8 } from "drizzle-orm/pg-core";
|
|
684
|
+
var uid6 = drizzleSql12`"identity"."current_user_id"()`;
|
|
685
|
+
function workoutSummaryPolicies(t) {
|
|
686
|
+
return [
|
|
687
|
+
// Lets authenticated users read only their own completed workout summaries.
|
|
688
|
+
pgPolicy8("users can read their workout summaries", {
|
|
689
|
+
for: "select",
|
|
690
|
+
to: authenticatedRole,
|
|
691
|
+
using: drizzleSql12`${t.userId} = ${uid6}`
|
|
692
|
+
}),
|
|
693
|
+
// Lets authenticated users insert completed workout summaries only for themselves.
|
|
694
|
+
pgPolicy8("users can insert their workout summaries", {
|
|
695
|
+
for: "insert",
|
|
696
|
+
to: authenticatedRole,
|
|
697
|
+
withCheck: drizzleSql12`${t.userId} = ${uid6}`
|
|
698
|
+
}),
|
|
699
|
+
// Lets authenticated users update only their own completed workout summaries.
|
|
700
|
+
pgPolicy8("users can update their workout summaries", {
|
|
701
|
+
for: "update",
|
|
702
|
+
to: authenticatedRole,
|
|
703
|
+
using: drizzleSql12`${t.userId} = ${uid6}`,
|
|
704
|
+
withCheck: drizzleSql12`${t.userId} = ${uid6}`
|
|
705
|
+
}),
|
|
706
|
+
// Lets authenticated users delete only their own completed workout summaries.
|
|
707
|
+
pgPolicy8("users can delete their workout summaries", {
|
|
708
|
+
for: "delete",
|
|
709
|
+
to: authenticatedRole,
|
|
710
|
+
using: drizzleSql12`${t.userId} = ${uid6}`
|
|
711
|
+
})
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
__name(workoutSummaryPolicies, "workoutSummaryPolicies");
|
|
715
|
+
|
|
716
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/workout_summary/table.ts
|
|
717
|
+
var workoutSummary = trackingSchema.table("workout_summary", {
|
|
718
|
+
id: uuid6("id").defaultRandom().notNull(),
|
|
719
|
+
userId: uuid6("user_id").notNull(),
|
|
720
|
+
workoutSplitId: bigint6("workout_split_id", {
|
|
721
|
+
mode: "number"
|
|
722
|
+
}).notNull(),
|
|
723
|
+
workoutStartUtc: timestamp4("workout_start_utc", {
|
|
724
|
+
withTimezone: true
|
|
725
|
+
}).notNull(),
|
|
726
|
+
workoutEndUtc: timestamp4("workout_end_utc", {
|
|
727
|
+
withTimezone: true
|
|
728
|
+
}).notNull(),
|
|
729
|
+
createdAt: timestamp4("created_at", {
|
|
730
|
+
withTimezone: true
|
|
731
|
+
}).defaultNow().notNull()
|
|
732
|
+
}, (t) => [
|
|
733
|
+
primaryKey8({
|
|
734
|
+
name: "workout_summary_pkey",
|
|
735
|
+
columns: [
|
|
736
|
+
t.id
|
|
737
|
+
]
|
|
738
|
+
}),
|
|
739
|
+
foreignKey7({
|
|
740
|
+
name: "workout_summary_user_id_fkey",
|
|
741
|
+
columns: [
|
|
742
|
+
t.userId
|
|
743
|
+
],
|
|
744
|
+
foreignColumns: [
|
|
745
|
+
user.id
|
|
746
|
+
]
|
|
747
|
+
}).onDelete("cascade"),
|
|
748
|
+
foreignKey7({
|
|
749
|
+
name: "workout_summary_workout_split_id_fkey",
|
|
750
|
+
columns: [
|
|
751
|
+
t.workoutSplitId
|
|
752
|
+
],
|
|
753
|
+
foreignColumns: [
|
|
754
|
+
workoutSplit.id
|
|
755
|
+
]
|
|
756
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
757
|
+
index6("workout_summary_start_date_idx").on(drizzleSql13`((${t.workoutStartUtc} at time zone 'UTC')::date)`),
|
|
758
|
+
index6("workout_summary_user_start_utc_idx").on(t.userId, t.workoutStartUtc.desc().nullsFirst()),
|
|
759
|
+
...workoutSummaryPolicies(t)
|
|
760
|
+
]);
|
|
761
|
+
var workoutSummaryRelations = relations8(workoutSummary, ({ many, one }) => ({
|
|
762
|
+
user: one(user, {
|
|
763
|
+
fields: [
|
|
764
|
+
workoutSummary.userId
|
|
765
|
+
],
|
|
766
|
+
references: [
|
|
767
|
+
user.id
|
|
768
|
+
]
|
|
769
|
+
}),
|
|
770
|
+
workoutSplit: one(workoutSplit, {
|
|
771
|
+
fields: [
|
|
772
|
+
workoutSummary.workoutSplitId
|
|
773
|
+
],
|
|
774
|
+
references: [
|
|
775
|
+
workoutSplit.id
|
|
776
|
+
]
|
|
777
|
+
}),
|
|
778
|
+
exerciseTrackings: many(exerciseTracking)
|
|
779
|
+
}));
|
|
780
|
+
|
|
781
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_plan/table.ts
|
|
782
|
+
import { relations as relations9, sql as drizzleSql15 } from "drizzle-orm";
|
|
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
|
+
|
|
785
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_plan/policies.ts
|
|
786
|
+
import { sql as drizzleSql14 } from "drizzle-orm";
|
|
787
|
+
import { pgPolicy as pgPolicy9 } from "drizzle-orm/pg-core";
|
|
788
|
+
var uid7 = drizzleSql14`"identity"."current_user_id"()`;
|
|
789
|
+
function workoutPlanPolicies(t) {
|
|
790
|
+
return [
|
|
791
|
+
// Lets authenticated users read only workout plans they own.
|
|
792
|
+
pgPolicy9("Enable read access for auth users on workout_plan", {
|
|
793
|
+
for: "select",
|
|
794
|
+
to: authenticatedRole,
|
|
795
|
+
using: drizzleSql14`${uid7} = ${t.userId}`
|
|
796
|
+
}),
|
|
797
|
+
// Lets authenticated users create workout plans only for themselves.
|
|
798
|
+
pgPolicy9("Enable insert for auth users on workout_plan", {
|
|
799
|
+
for: "insert",
|
|
800
|
+
to: authenticatedRole,
|
|
801
|
+
withCheck: drizzleSql14`${uid7} = ${t.userId}`
|
|
802
|
+
}),
|
|
803
|
+
// Lets authenticated users update only workout plans they own.
|
|
804
|
+
pgPolicy9("Enable update for auth users on workout_plan", {
|
|
805
|
+
for: "update",
|
|
806
|
+
to: authenticatedRole,
|
|
807
|
+
using: drizzleSql14`${uid7} = ${t.userId}`,
|
|
808
|
+
withCheck: drizzleSql14`${uid7} = ${t.userId}`
|
|
809
|
+
}),
|
|
810
|
+
// Lets authenticated users delete only workout plans they own.
|
|
811
|
+
pgPolicy9("Enable delete for auth users on workout_plan", {
|
|
812
|
+
for: "delete",
|
|
813
|
+
to: authenticatedRole,
|
|
814
|
+
using: drizzleSql14`${uid7} = ${t.userId}`
|
|
815
|
+
})
|
|
816
|
+
];
|
|
817
|
+
}
|
|
818
|
+
__name(workoutPlanPolicies, "workoutPlanPolicies");
|
|
819
|
+
|
|
820
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_plan/table.ts
|
|
821
|
+
var workoutPlan = workoutSchema.table("workout_plan", {
|
|
822
|
+
id: bigint7("id", {
|
|
823
|
+
mode: "number"
|
|
824
|
+
}).generatedByDefaultAsIdentity({
|
|
825
|
+
name: "workout_plan_id_seq"
|
|
826
|
+
}).notNull(),
|
|
827
|
+
userId: uuid7("user_id").notNull(),
|
|
828
|
+
isActive: boolean4("is_active").default(true).notNull(),
|
|
829
|
+
updatedAt: timestamp5("updated_at", {
|
|
830
|
+
withTimezone: true
|
|
831
|
+
}).default(drizzleSql15`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
832
|
+
createdAt: timestamp5("created_at", {
|
|
833
|
+
withTimezone: true
|
|
834
|
+
}).defaultNow().notNull()
|
|
835
|
+
}, (t) => [
|
|
836
|
+
primaryKey9({
|
|
837
|
+
name: "workout_plan_pkey",
|
|
838
|
+
columns: [
|
|
839
|
+
t.id
|
|
840
|
+
]
|
|
841
|
+
}),
|
|
842
|
+
foreignKey8({
|
|
843
|
+
name: "workout_plan_user_id_fkey",
|
|
844
|
+
columns: [
|
|
845
|
+
t.userId
|
|
846
|
+
],
|
|
847
|
+
foreignColumns: [
|
|
848
|
+
user.id
|
|
849
|
+
]
|
|
850
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
851
|
+
uniqueIndex2("uq_workout_plan_active_user").on(t.userId).where(drizzleSql15`${t.isActive}`),
|
|
852
|
+
...workoutPlanPolicies(t)
|
|
853
|
+
]);
|
|
854
|
+
var workoutPlanRelations = relations9(workoutPlan, ({ many, one }) => ({
|
|
855
|
+
owner: one(user, {
|
|
856
|
+
fields: [
|
|
857
|
+
workoutPlan.userId
|
|
858
|
+
],
|
|
859
|
+
references: [
|
|
860
|
+
user.id
|
|
861
|
+
],
|
|
862
|
+
relationName: "workoutPlanOwner"
|
|
863
|
+
}),
|
|
864
|
+
splits: many(workoutSplit)
|
|
865
|
+
}));
|
|
866
|
+
|
|
867
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_split/policies.ts
|
|
868
|
+
import { sql as drizzleSql16 } from "drizzle-orm";
|
|
869
|
+
import { pgPolicy as pgPolicy10 } from "drizzle-orm/pg-core";
|
|
870
|
+
var uid8 = drizzleSql16`"identity"."current_user_id"()`;
|
|
871
|
+
function workoutSplitPolicies(t) {
|
|
872
|
+
const owns = drizzleSql16`${uid8} = (select wp."user_id" from "workout"."workout_plan" wp where wp."id" = ${t.workoutId})`;
|
|
873
|
+
const ownsForDelete = drizzleSql16`exists (select 1 from "workout"."workout_plan" wp where wp."id" = ${t.workoutId} and wp."user_id" = ${uid8})`;
|
|
874
|
+
return [
|
|
875
|
+
// Lets authenticated users read splits belonging to their own plans.
|
|
876
|
+
pgPolicy10("Enable read access for auth users on workout_split", {
|
|
877
|
+
for: "select",
|
|
878
|
+
to: authenticatedRole,
|
|
879
|
+
using: owns
|
|
880
|
+
}),
|
|
881
|
+
// Lets authenticated users add splits only to their own plans.
|
|
882
|
+
pgPolicy10("Enable insert for auth users on workout_split", {
|
|
883
|
+
for: "insert",
|
|
884
|
+
to: authenticatedRole,
|
|
885
|
+
withCheck: owns
|
|
886
|
+
}),
|
|
887
|
+
// Lets authenticated users update splits only within their own plans.
|
|
888
|
+
pgPolicy10("Enable update for auth users on workout_split", {
|
|
889
|
+
for: "update",
|
|
890
|
+
to: authenticatedRole,
|
|
891
|
+
using: owns,
|
|
892
|
+
withCheck: owns
|
|
893
|
+
}),
|
|
894
|
+
// Lets authenticated users delete splits only from their own plans.
|
|
895
|
+
pgPolicy10("Enable delete for auth users on workout_split", {
|
|
896
|
+
for: "delete",
|
|
897
|
+
to: authenticatedRole,
|
|
898
|
+
using: ownsForDelete
|
|
899
|
+
})
|
|
900
|
+
];
|
|
901
|
+
}
|
|
902
|
+
__name(workoutSplitPolicies, "workoutSplitPolicies");
|
|
903
|
+
|
|
904
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/workout_split/table.ts
|
|
905
|
+
var workoutSplit = workoutSchema.table("workout_split", {
|
|
906
|
+
id: bigint8("id", {
|
|
907
|
+
mode: "number"
|
|
908
|
+
}).generatedByDefaultAsIdentity({
|
|
909
|
+
name: "workout_split_id_seq"
|
|
910
|
+
}).notNull(),
|
|
911
|
+
workoutId: bigint8("workout_id", {
|
|
912
|
+
mode: "number"
|
|
913
|
+
}).notNull(),
|
|
914
|
+
name: text5("name").notNull(),
|
|
915
|
+
createdAt: timestamp6("created_at", {
|
|
916
|
+
withTimezone: true
|
|
917
|
+
}).default(drizzleSql17`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
918
|
+
isActive: boolean5("is_active").default(true).notNull()
|
|
919
|
+
}, (t) => [
|
|
920
|
+
primaryKey10({
|
|
921
|
+
name: "workout_split_pkey",
|
|
922
|
+
columns: [
|
|
923
|
+
t.id
|
|
924
|
+
]
|
|
925
|
+
}),
|
|
926
|
+
unique4("uq_workout_split_plan_name").on(t.workoutId, t.name),
|
|
927
|
+
foreignKey9({
|
|
928
|
+
name: "workout_split_workout_id_fkey",
|
|
929
|
+
columns: [
|
|
930
|
+
t.workoutId
|
|
931
|
+
],
|
|
932
|
+
foreignColumns: [
|
|
933
|
+
workoutPlan.id
|
|
934
|
+
]
|
|
935
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
936
|
+
index7("workout_split_workout_id_idx").on(t.workoutId),
|
|
937
|
+
...workoutSplitPolicies(t)
|
|
938
|
+
]);
|
|
939
|
+
var workoutSplitRelations = relations10(workoutSplit, ({ many, one }) => ({
|
|
940
|
+
workoutPlan: one(workoutPlan, {
|
|
941
|
+
fields: [
|
|
942
|
+
workoutSplit.workoutId
|
|
943
|
+
],
|
|
944
|
+
references: [
|
|
945
|
+
workoutPlan.id
|
|
946
|
+
]
|
|
947
|
+
}),
|
|
948
|
+
exerciseAssignments: many(exerciseToWorkoutSplit),
|
|
949
|
+
workoutSummaries: many(workoutSummary),
|
|
950
|
+
splitInformation: many(userSplitInformation)
|
|
951
|
+
}));
|
|
952
|
+
|
|
953
|
+
// ../../src/infrastructure/db/schema/drizzle/reminders/user_split_information/table.ts
|
|
954
|
+
var userSplitInformation = remindersSchema.table("user_split_information", {
|
|
955
|
+
id: bigint9("id", {
|
|
956
|
+
mode: "number"
|
|
957
|
+
}).generatedByDefaultAsIdentity({
|
|
958
|
+
name: "user_split_information_id_seq"
|
|
959
|
+
}).notNull(),
|
|
960
|
+
userId: uuid8("user_id").notNull(),
|
|
961
|
+
workoutSplitId: bigint9("workout_split_id", {
|
|
962
|
+
mode: "number"
|
|
963
|
+
}).notNull(),
|
|
964
|
+
estimatedTimeUtc: timestamp7("estimated_time_utc", {
|
|
965
|
+
withTimezone: true
|
|
966
|
+
}).notNull(),
|
|
967
|
+
confidence: numeric("confidence", {
|
|
968
|
+
precision: 3,
|
|
969
|
+
scale: 2
|
|
970
|
+
}).default("1.00").notNull(),
|
|
971
|
+
lastComputedAt: timestamp7("last_computed_at", {
|
|
972
|
+
withTimezone: true
|
|
973
|
+
}).default(drizzleSql18`timezone('UTC', now())`).notNull(),
|
|
974
|
+
preferredWeekday: integer4("preferred_weekday")
|
|
975
|
+
}, (t) => [
|
|
976
|
+
primaryKey11({
|
|
977
|
+
name: "user_split_information_pkey",
|
|
978
|
+
columns: [
|
|
979
|
+
t.id
|
|
980
|
+
]
|
|
981
|
+
}),
|
|
982
|
+
unique5("user_split_information_user_id_workout_split_id_key").on(t.userId, t.workoutSplitId),
|
|
983
|
+
foreignKey10({
|
|
984
|
+
name: "user_split_information_user_id_fkey",
|
|
985
|
+
columns: [
|
|
986
|
+
t.userId
|
|
987
|
+
],
|
|
988
|
+
foreignColumns: [
|
|
989
|
+
user.id
|
|
990
|
+
]
|
|
991
|
+
}).onDelete("cascade"),
|
|
992
|
+
foreignKey10({
|
|
993
|
+
name: "user_split_information_workout_split_id_fkey",
|
|
994
|
+
columns: [
|
|
995
|
+
t.workoutSplitId
|
|
996
|
+
],
|
|
997
|
+
foreignColumns: [
|
|
998
|
+
workoutSplit.id
|
|
999
|
+
]
|
|
1000
|
+
}).onDelete("cascade"),
|
|
1001
|
+
index8("user_split_information_confidence_idx").on(t.preferredWeekday, t.confidence).where(drizzleSql18`${t.confidence} >= 0.60`),
|
|
1002
|
+
index8("user_split_information_user_weekday_idx").on(t.userId, t.preferredWeekday).where(drizzleSql18`${t.preferredWeekday} is not null`)
|
|
1003
|
+
]).enableRLS();
|
|
1004
|
+
var userSplitInformationRelations = relations11(userSplitInformation, ({ one }) => ({
|
|
1005
|
+
user: one(user, {
|
|
1006
|
+
fields: [
|
|
1007
|
+
userSplitInformation.userId
|
|
1008
|
+
],
|
|
1009
|
+
references: [
|
|
1010
|
+
user.id
|
|
1011
|
+
]
|
|
1012
|
+
}),
|
|
1013
|
+
workoutSplit: one(workoutSplit, {
|
|
1014
|
+
fields: [
|
|
1015
|
+
userSplitInformation.workoutSplitId
|
|
1016
|
+
],
|
|
1017
|
+
references: [
|
|
1018
|
+
workoutSplit.id
|
|
1019
|
+
]
|
|
1020
|
+
})
|
|
1021
|
+
}));
|
|
1022
|
+
|
|
1023
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/aerobic_tracking/table.ts
|
|
1024
|
+
import { relations as relations12, sql as drizzleSql20 } from "drizzle-orm";
|
|
1025
|
+
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";
|
|
1026
|
+
|
|
1027
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/aerobic_tracking/policies.ts
|
|
1028
|
+
import { sql as drizzleSql19 } from "drizzle-orm";
|
|
1029
|
+
import { pgPolicy as pgPolicy11 } from "drizzle-orm/pg-core";
|
|
1030
|
+
var uid9 = drizzleSql19`"identity"."current_user_id"()`;
|
|
1031
|
+
function aerobicTrackingPolicies(t) {
|
|
1032
|
+
return [
|
|
1033
|
+
// Lets authenticated users read only their own aerobic tracking rows.
|
|
1034
|
+
pgPolicy11("Enable read access for auth users on aerobic_tracking", {
|
|
1035
|
+
for: "select",
|
|
1036
|
+
to: authenticatedRole,
|
|
1037
|
+
using: drizzleSql19`${uid9} = ${t.userId}`
|
|
1038
|
+
}),
|
|
1039
|
+
// Lets authenticated users insert aerobic tracking rows only for themselves.
|
|
1040
|
+
pgPolicy11("Enable insert for auth users on aerobic_tracking", {
|
|
1041
|
+
for: "insert",
|
|
1042
|
+
to: authenticatedRole,
|
|
1043
|
+
withCheck: drizzleSql19`${uid9} = ${t.userId}`
|
|
1044
|
+
}),
|
|
1045
|
+
// Lets authenticated users update only their own aerobic tracking rows.
|
|
1046
|
+
pgPolicy11("Enable update for auth users on aerobic_tracking", {
|
|
1047
|
+
for: "update",
|
|
1048
|
+
to: authenticatedRole,
|
|
1049
|
+
using: drizzleSql19`${uid9} = ${t.userId}`,
|
|
1050
|
+
withCheck: drizzleSql19`${uid9} = ${t.userId}`
|
|
1051
|
+
}),
|
|
1052
|
+
// Lets authenticated users delete only their own aerobic tracking rows.
|
|
1053
|
+
pgPolicy11("Enable delete for auth users on aerobic_tracking", {
|
|
1054
|
+
for: "delete",
|
|
1055
|
+
to: authenticatedRole,
|
|
1056
|
+
using: drizzleSql19`${uid9} = ${t.userId}`
|
|
1057
|
+
})
|
|
1058
|
+
];
|
|
1059
|
+
}
|
|
1060
|
+
__name(aerobicTrackingPolicies, "aerobicTrackingPolicies");
|
|
1061
|
+
|
|
1062
|
+
// ../../src/infrastructure/db/schema/drizzle/tracking/aerobic_tracking/table.ts
|
|
1063
|
+
var aerobicTracking = trackingSchema.table("aerobic_tracking", {
|
|
1064
|
+
id: bigint10("id", {
|
|
1065
|
+
mode: "number"
|
|
1066
|
+
}).generatedByDefaultAsIdentity({
|
|
1067
|
+
name: "aerobic_tracking_id_seq"
|
|
1068
|
+
}).notNull(),
|
|
1069
|
+
userId: uuid9("user_id").notNull(),
|
|
1070
|
+
type: text6("type").notNull(),
|
|
1071
|
+
durationSec: bigint10("duration_sec", {
|
|
1072
|
+
mode: "number"
|
|
1073
|
+
}).default(0).notNull(),
|
|
1074
|
+
workoutTimeUtc: timestamp8("workout_time_utc", {
|
|
1075
|
+
withTimezone: true
|
|
1076
|
+
}).default(drizzleSql20`(now() AT TIME ZONE 'utc')`).notNull()
|
|
1077
|
+
}, (t) => [
|
|
1078
|
+
primaryKey12({
|
|
1079
|
+
name: "aerobic_tracking_pkey",
|
|
1080
|
+
columns: [
|
|
1081
|
+
t.id
|
|
1082
|
+
]
|
|
1083
|
+
}),
|
|
1084
|
+
foreignKey11({
|
|
1085
|
+
name: "aerobic_tracking_user_id_fkey",
|
|
1086
|
+
columns: [
|
|
1087
|
+
t.userId
|
|
1088
|
+
],
|
|
1089
|
+
foreignColumns: [
|
|
1090
|
+
user.id
|
|
1091
|
+
]
|
|
1092
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
1093
|
+
index9("aerobic_tracking_user_id_workout_time_utc_idx").on(t.userId, t.workoutTimeUtc.desc().nullsFirst()),
|
|
1094
|
+
...aerobicTrackingPolicies(t)
|
|
1095
|
+
]);
|
|
1096
|
+
var aerobicTrackingRelations = relations12(aerobicTracking, ({ one }) => ({
|
|
1097
|
+
user: one(user, {
|
|
1098
|
+
fields: [
|
|
1099
|
+
aerobicTracking.userId
|
|
1100
|
+
],
|
|
1101
|
+
references: [
|
|
1102
|
+
user.id
|
|
1103
|
+
]
|
|
1104
|
+
})
|
|
1105
|
+
}));
|
|
1106
|
+
|
|
1107
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/oauth_account/table.ts
|
|
1108
|
+
import { relations as relations13, sql as drizzleSql22 } from "drizzle-orm";
|
|
1109
|
+
import { foreignKey as foreignKey12, primaryKey as primaryKey13, text as text7, timestamp as timestamp9, unique as unique6, uuid as uuid10 } from "drizzle-orm/pg-core";
|
|
1110
|
+
|
|
1111
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/oauth_account/policies.ts
|
|
1112
|
+
import { sql as drizzleSql21 } from "drizzle-orm";
|
|
1113
|
+
import { pgPolicy as pgPolicy12 } from "drizzle-orm/pg-core";
|
|
1114
|
+
var currentUserId3 = drizzleSql21`"identity"."current_user_id"()`;
|
|
1115
|
+
function oauthAccountPolicies(table) {
|
|
1116
|
+
return [
|
|
1117
|
+
// Lets authenticated users read only OAuth accounts linked to themselves.
|
|
1118
|
+
pgPolicy12("Enable read access for auth users on oauth_account", {
|
|
1119
|
+
for: "select",
|
|
1120
|
+
to: authenticatedRole,
|
|
1121
|
+
using: drizzleSql21`${currentUserId3} = ${table.userId}`
|
|
1122
|
+
}),
|
|
1123
|
+
// Lets authenticated users link OAuth accounts only to themselves.
|
|
1124
|
+
pgPolicy12("Enable insert for auth users on oauth_account", {
|
|
1125
|
+
for: "insert",
|
|
1126
|
+
to: authenticatedRole,
|
|
1127
|
+
withCheck: drizzleSql21`${currentUserId3} = ${table.userId}`
|
|
1128
|
+
}),
|
|
1129
|
+
// Lets authenticated users update only OAuth accounts linked to themselves.
|
|
1130
|
+
pgPolicy12("Enable update for auth users on oauth_account", {
|
|
1131
|
+
for: "update",
|
|
1132
|
+
to: authenticatedRole,
|
|
1133
|
+
using: drizzleSql21`${currentUserId3} = ${table.userId}`,
|
|
1134
|
+
withCheck: drizzleSql21`${currentUserId3} = ${table.userId}`
|
|
1135
|
+
}),
|
|
1136
|
+
// Lets authenticated users delete only OAuth accounts linked to themselves.
|
|
1137
|
+
pgPolicy12("Enable delete for auth users on oauth_account", {
|
|
1138
|
+
for: "delete",
|
|
1139
|
+
to: authenticatedRole,
|
|
1140
|
+
using: drizzleSql21`${currentUserId3} = ${table.userId}`
|
|
1141
|
+
})
|
|
1142
|
+
];
|
|
1143
|
+
}
|
|
1144
|
+
__name(oauthAccountPolicies, "oauthAccountPolicies");
|
|
1145
|
+
|
|
1146
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/oauth_account/table.ts
|
|
1147
|
+
var oauthAccount = identitySchema.table("oauth_account", {
|
|
1148
|
+
id: uuid10("id").defaultRandom().notNull(),
|
|
1149
|
+
userId: uuid10("user_id").notNull(),
|
|
1150
|
+
provider: text7("provider").notNull(),
|
|
1151
|
+
providerUserId: text7("provider_user_id").notNull(),
|
|
1152
|
+
providerEmail: text7("provider_email").notNull(),
|
|
1153
|
+
linkedAt: timestamp9("linked_at", {
|
|
1154
|
+
withTimezone: true
|
|
1155
|
+
}).default(drizzleSql22`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
1156
|
+
missingFields: text7("missing_fields")
|
|
1157
|
+
}, (t) => [
|
|
1158
|
+
primaryKey13({
|
|
1159
|
+
name: "oauth_account_pkey",
|
|
1160
|
+
columns: [
|
|
1161
|
+
t.id
|
|
1162
|
+
]
|
|
1163
|
+
}),
|
|
1164
|
+
unique6("oauth_account_provider_user_unique").on(t.provider, t.providerUserId),
|
|
1165
|
+
foreignKey12({
|
|
1166
|
+
name: "oauth_account_user_id_fkey",
|
|
1167
|
+
columns: [
|
|
1168
|
+
t.userId
|
|
1169
|
+
],
|
|
1170
|
+
foreignColumns: [
|
|
1171
|
+
user.id
|
|
1172
|
+
]
|
|
1173
|
+
}).onUpdate("cascade").onDelete("cascade"),
|
|
1174
|
+
...oauthAccountPolicies(t)
|
|
1175
|
+
]);
|
|
1176
|
+
var oauthAccountRelations = relations13(oauthAccount, ({ one }) => ({
|
|
1177
|
+
user: one(user, {
|
|
1178
|
+
fields: [
|
|
1179
|
+
oauthAccount.userId
|
|
1180
|
+
],
|
|
1181
|
+
references: [
|
|
1182
|
+
user.id
|
|
1183
|
+
]
|
|
1184
|
+
})
|
|
1185
|
+
}));
|
|
1186
|
+
|
|
1187
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/user/policies.ts
|
|
1188
|
+
import { sql as drizzleSql23 } from "drizzle-orm";
|
|
1189
|
+
import { pgPolicy as pgPolicy13 } from "drizzle-orm/pg-core";
|
|
1190
|
+
var currentUserId4 = drizzleSql23`"identity"."current_user_id"()`;
|
|
1191
|
+
function userPolicies(table) {
|
|
1192
|
+
return [
|
|
1193
|
+
// Lets an authenticated user read their own profile.
|
|
1194
|
+
pgPolicy13("Enable read access for auth users on own profile", {
|
|
1195
|
+
for: "select",
|
|
1196
|
+
to: authenticatedRole,
|
|
1197
|
+
using: drizzleSql23`${currentUserId4} = ${table.id}`
|
|
1198
|
+
}),
|
|
1199
|
+
// Lets a message receiver read the profile of a sender in their inbox.
|
|
1200
|
+
pgPolicy13("Allow user to view senders in their messages", {
|
|
1201
|
+
for: "select",
|
|
1202
|
+
to: authenticatedRole,
|
|
1203
|
+
using: drizzleSql23`exists (select 1 from "messages"."message" m where m."sender_id" = ${table.id} and m."receiver_id" = ${currentUserId4})`
|
|
1204
|
+
}),
|
|
1205
|
+
// Lets an authenticated user create only their own profile row.
|
|
1206
|
+
pgPolicy13("Enable insert for auth users on own profile", {
|
|
1207
|
+
for: "insert",
|
|
1208
|
+
to: authenticatedRole,
|
|
1209
|
+
withCheck: drizzleSql23`${currentUserId4} = ${table.id}`
|
|
1210
|
+
}),
|
|
1211
|
+
// Preserves the legacy public self-registration policy for compatibility.
|
|
1212
|
+
pgPolicy13("Enable insert for public users on own profile", {
|
|
1213
|
+
for: "insert",
|
|
1214
|
+
to: "public",
|
|
1215
|
+
withCheck: drizzleSql23`${currentUserId4} = ${table.id}`
|
|
1216
|
+
}),
|
|
1217
|
+
// Lets an authenticated user update only their own profile.
|
|
1218
|
+
pgPolicy13("Enable update for auth users on own profile", {
|
|
1219
|
+
for: "update",
|
|
1220
|
+
to: authenticatedRole,
|
|
1221
|
+
using: drizzleSql23`${currentUserId4} = ${table.id}`,
|
|
1222
|
+
withCheck: drizzleSql23`${currentUserId4} = ${table.id}`
|
|
1223
|
+
}),
|
|
1224
|
+
// Lets an authenticated user delete only their own profile.
|
|
1225
|
+
pgPolicy13("Enable delete for auth users on own profile", {
|
|
1226
|
+
for: "delete",
|
|
1227
|
+
to: authenticatedRole,
|
|
1228
|
+
using: drizzleSql23`${currentUserId4} = ${table.id}`
|
|
1229
|
+
})
|
|
1230
|
+
];
|
|
1231
|
+
}
|
|
1232
|
+
__name(userPolicies, "userPolicies");
|
|
1233
|
+
|
|
1234
|
+
// ../../src/infrastructure/db/schema/drizzle/identity/user/table.ts
|
|
1235
|
+
var user = identitySchema.table("user", {
|
|
1236
|
+
username: text8("username").notNull(),
|
|
1237
|
+
email: text8("email").notNull(),
|
|
1238
|
+
name: text8("name").notNull(),
|
|
1239
|
+
gender: text8("gender").default("Unknown").notNull(),
|
|
1240
|
+
createdAt: timestamp10("created_at", {
|
|
1241
|
+
withTimezone: true
|
|
1242
|
+
}).default(drizzleSql24`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
1243
|
+
updatedAt: timestamp10("updated_at", {
|
|
1244
|
+
withTimezone: true
|
|
1245
|
+
}).default(drizzleSql24`(now() AT TIME ZONE 'utc')`).notNull(),
|
|
1246
|
+
profilePicPath: text8("profile_pic_path"),
|
|
1247
|
+
id: uuid11("id").defaultRandom().notNull(),
|
|
1248
|
+
pushToken: text8("push_token"),
|
|
1249
|
+
passwordHash: text8("password_hash"),
|
|
1250
|
+
role: text8("role").default("User").notNull(),
|
|
1251
|
+
tokenVersion: bigint11("token_version", {
|
|
1252
|
+
mode: "number"
|
|
1253
|
+
}).default(0).notNull(),
|
|
1254
|
+
isVerified: boolean6("is_verified").default(false).notNull(),
|
|
1255
|
+
authProvider: text8("auth_provider").default("app").notNull(),
|
|
1256
|
+
lastLogin: timestamp10("last_login", {
|
|
1257
|
+
withTimezone: true
|
|
1258
|
+
})
|
|
1259
|
+
}, (t) => [
|
|
1260
|
+
primaryKey14({
|
|
1261
|
+
name: "user_pkey",
|
|
1262
|
+
columns: [
|
|
1263
|
+
t.id
|
|
1264
|
+
]
|
|
1265
|
+
}),
|
|
1266
|
+
uniqueIndex3("user_email_ci_unique").on(drizzleSql24`lower(trim(both from ${t.email}))`),
|
|
1267
|
+
uniqueIndex3("user_username_ci_unique").on(drizzleSql24`lower(trim(both from ${t.username}))`),
|
|
1268
|
+
...userPolicies(t)
|
|
1269
|
+
]);
|
|
1270
|
+
var userRelations = relations14(user, ({ many, one }) => ({
|
|
1271
|
+
oauthAccounts: many(oauthAccount),
|
|
1272
|
+
ownedWorkoutPlans: many(workoutPlan, {
|
|
1273
|
+
relationName: "workoutPlanOwner"
|
|
1274
|
+
}),
|
|
1275
|
+
trainedWorkoutPlans: many(workoutPlan, {
|
|
1276
|
+
relationName: "workoutPlanTrainer"
|
|
1277
|
+
}),
|
|
1278
|
+
workoutSummaries: many(workoutSummary),
|
|
1279
|
+
aerobicTrackings: many(aerobicTracking),
|
|
1280
|
+
reminderSettings: one(userReminderSetting),
|
|
1281
|
+
splitInformation: many(userSplitInformation),
|
|
1282
|
+
sentMessages: many(message, {
|
|
1283
|
+
relationName: "messageSender"
|
|
1284
|
+
}),
|
|
1285
|
+
receivedMessages: many(message, {
|
|
1286
|
+
relationName: "messageReceiver"
|
|
1287
|
+
})
|
|
1288
|
+
}));
|
|
1289
|
+
|
|
1290
|
+
// ../../src/infrastructure/db/schema/drizzle/workout/views/exercise-to-workoutsplit-expanded.view.ts
|
|
1291
|
+
import { bigint as bigint12, boolean as boolean7, text as text9, timestamp as timestamp11 } from "drizzle-orm/pg-core";
|
|
1292
|
+
import { sql as drizzleSql25 } from "drizzle-orm";
|
|
1293
|
+
import { integer as integer5 } from "drizzle-orm/pg-core";
|
|
1294
|
+
var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_workout_split_expanded", {
|
|
1295
|
+
id: bigint12("id", {
|
|
1296
|
+
mode: "number"
|
|
1297
|
+
}),
|
|
1298
|
+
workoutSplitId: bigint12("workout_split_id", {
|
|
1299
|
+
mode: "number"
|
|
1300
|
+
}),
|
|
1301
|
+
workoutId: bigint12("workout_id", {
|
|
1302
|
+
mode: "number"
|
|
1303
|
+
}),
|
|
1304
|
+
exerciseId: bigint12("exercise_id", {
|
|
1305
|
+
mode: "number"
|
|
1306
|
+
}),
|
|
1307
|
+
exercise: text9("exercise"),
|
|
1308
|
+
workoutSplit: text9("workout_split"),
|
|
1309
|
+
reps: integer5("reps"),
|
|
1310
|
+
orderIndex: bigint12("order_index", {
|
|
1311
|
+
mode: "number"
|
|
1312
|
+
}),
|
|
1313
|
+
setOrderIndex: integer5("set_order_index"),
|
|
1314
|
+
createdAt: timestamp11("created_at", {
|
|
1315
|
+
withTimezone: true
|
|
1316
|
+
}),
|
|
1317
|
+
isActive: boolean7("is_active")
|
|
1318
|
+
}).with({
|
|
1319
|
+
securityInvoker: true
|
|
1320
|
+
}).as(drizzleSql25`
|
|
1321
|
+
SELECT
|
|
1322
|
+
ews.id,
|
|
1323
|
+
ews.workout_split_id,
|
|
1324
|
+
ws.workout_id,
|
|
1325
|
+
ews.exercise_id,
|
|
1326
|
+
ex.name AS exercise,
|
|
1327
|
+
ws.name AS workout_split,
|
|
1328
|
+
workout_set.reps AS reps,
|
|
1329
|
+
workout_set.order_index AS set_order_index,
|
|
1330
|
+
ews.order_index,
|
|
1331
|
+
ews.created_at,
|
|
1332
|
+
ews.is_active
|
|
1333
|
+
FROM
|
|
1334
|
+
workout.exercise_to_workout_split ews
|
|
1335
|
+
JOIN workout.workout_split ws ON ws.id = ews.workout_split_id
|
|
1336
|
+
JOIN workout.exercise ex ON ex.id = ews.exercise_id
|
|
1337
|
+
LEFT JOIN workout.workout_set workout_set ON workout_set.exercise_to_split_id = ews.id
|
|
1338
|
+
GROUP BY
|
|
1339
|
+
ews.id,
|
|
1340
|
+
ews.workout_split_id,
|
|
1341
|
+
ws.workout_id,
|
|
1342
|
+
ews.exercise_id,
|
|
1343
|
+
ex.name,
|
|
1344
|
+
ws.name,
|
|
1345
|
+
workout_set.reps,
|
|
1346
|
+
workout_set.order_index,
|
|
1347
|
+
ews.order_index,
|
|
1348
|
+
ews.created_at,
|
|
1349
|
+
ews.is_active
|
|
1350
|
+
`);
|
|
1351
|
+
|
|
1352
|
+
// ../../src/infrastructure/db/schema/drizzle/analytics/views/exercise-tracking-expanded.view.ts
|
|
1353
|
+
import { sql as drizzleSql26 } from "drizzle-orm";
|
|
1354
|
+
import { bigint as bigint13, real as real2, text as text10, timestamp as timestamp12, uuid as uuid12 } from "drizzle-orm/pg-core";
|
|
1355
|
+
import { integer as integer6 } from "drizzle-orm/pg-core";
|
|
1356
|
+
var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_expanded", {
|
|
1357
|
+
id: bigint13("id", {
|
|
1358
|
+
mode: "number"
|
|
1359
|
+
}),
|
|
1360
|
+
exerciseToSplitId: bigint13("exercise_to_split_id", {
|
|
1361
|
+
mode: "number"
|
|
1362
|
+
}),
|
|
1363
|
+
weight: real2("weight"),
|
|
1364
|
+
reps: bigint13("reps", {
|
|
1365
|
+
mode: "number"
|
|
1366
|
+
}),
|
|
1367
|
+
setIndex: integer6("set_index"),
|
|
1368
|
+
exerciseId: bigint13("exercise_id", {
|
|
1369
|
+
mode: "number"
|
|
1370
|
+
}),
|
|
1371
|
+
workoutSplitId: bigint13("workout_split_id", {
|
|
1372
|
+
mode: "number"
|
|
1373
|
+
}),
|
|
1374
|
+
splitName: text10("split_name"),
|
|
1375
|
+
exercise: text10("exercise"),
|
|
1376
|
+
notes: text10("notes"),
|
|
1377
|
+
workoutSummaryId: uuid12("workout_summary_id"),
|
|
1378
|
+
workoutStartUtc: timestamp12("workout_start_utc", {
|
|
1379
|
+
withTimezone: true
|
|
1380
|
+
}),
|
|
1381
|
+
workoutEndUtc: timestamp12("workout_end_utc", {
|
|
1382
|
+
withTimezone: true
|
|
1383
|
+
})
|
|
1384
|
+
}).with({
|
|
1385
|
+
securityInvoker: true
|
|
1386
|
+
}).as(drizzleSql26`
|
|
1387
|
+
SELECT
|
|
1388
|
+
et.id,
|
|
1389
|
+
et.exercise_to_split_id,
|
|
1390
|
+
tracking_set.weight AS weight,
|
|
1391
|
+
tracking_set.reps AS reps,
|
|
1392
|
+
tracking_set.set_index AS set_index,
|
|
1393
|
+
COALESCE(ews.exercise_id, et.exercise_id) AS exercise_id,
|
|
1394
|
+
wsumm.workout_split_id,
|
|
1395
|
+
ws.name AS split_name,
|
|
1396
|
+
ex.name AS exercise,
|
|
1397
|
+
et.notes,
|
|
1398
|
+
et.workout_summary_id,
|
|
1399
|
+
wsumm.workout_start_utc,
|
|
1400
|
+
wsumm.workout_end_utc
|
|
1401
|
+
FROM
|
|
1402
|
+
tracking.exercise_tracking et
|
|
1403
|
+
LEFT JOIN tracking.workout_summary wsumm ON wsumm.id = et.workout_summary_id
|
|
1404
|
+
LEFT JOIN workout.exercise_to_workout_split ews ON ews.id = et.exercise_to_split_id
|
|
1405
|
+
LEFT JOIN workout.workout_split ws ON ws.id = wsumm.workout_split_id
|
|
1406
|
+
LEFT JOIN workout.exercise ex ON ex.id = COALESCE(ews.exercise_id, et.exercise_id)
|
|
1407
|
+
LEFT JOIN tracking.tracking_set tracking_set ON tracking_set.exercise_tracking_id = et.id
|
|
1408
|
+
`);
|
|
1409
|
+
|
|
1410
|
+
// ../../src/infrastructure/db/schema/drizzle/analytics/views/prs.view.ts
|
|
1411
|
+
import { sql as drizzleSql27 } from "drizzle-orm";
|
|
1412
|
+
import { bigint as bigint14, real as real3, text as text11, timestamp as timestamp13, uuid as uuid13 } from "drizzle-orm/pg-core";
|
|
1413
|
+
var prsView = analyticsSchema.view("v_prs", {
|
|
1414
|
+
id: bigint14("id", {
|
|
1415
|
+
mode: "number"
|
|
1416
|
+
}),
|
|
1417
|
+
exerciseToSplitId: bigint14("exercise_to_split_id", {
|
|
1418
|
+
mode: "number"
|
|
1419
|
+
}),
|
|
1420
|
+
exerciseId: bigint14("exercise_id", {
|
|
1421
|
+
mode: "number"
|
|
1422
|
+
}),
|
|
1423
|
+
exercise: text11("exercise"),
|
|
1424
|
+
weight: real3("weight"),
|
|
1425
|
+
reps: bigint14("reps", {
|
|
1426
|
+
mode: "number"
|
|
1427
|
+
}),
|
|
1428
|
+
workoutSummaryId: uuid13("workout_summary_id"),
|
|
1429
|
+
workoutStartUtc: timestamp13("workout_start_utc", {
|
|
1430
|
+
withTimezone: true
|
|
1431
|
+
}),
|
|
1432
|
+
workoutEndUtc: timestamp13("workout_end_utc", {
|
|
1433
|
+
withTimezone: true
|
|
1434
|
+
})
|
|
1435
|
+
}).with({
|
|
1436
|
+
securityInvoker: true
|
|
1437
|
+
}).as(drizzleSql27`
|
|
1438
|
+
SELECT DISTINCT
|
|
1439
|
+
ON (et.exercise_id) et.id,
|
|
1440
|
+
et.exercise_to_split_id,
|
|
1441
|
+
et.exercise_id,
|
|
1442
|
+
et.exercise,
|
|
1443
|
+
et.weight,
|
|
1444
|
+
et.reps,
|
|
1445
|
+
et.workout_summary_id,
|
|
1446
|
+
et.workout_start_utc,
|
|
1447
|
+
et.workout_end_utc
|
|
1448
|
+
FROM
|
|
1449
|
+
analytics.v_exercise_tracking_expanded et
|
|
1450
|
+
ORDER BY
|
|
1451
|
+
et.exercise_id,
|
|
1452
|
+
et.weight DESC,
|
|
1453
|
+
et.reps DESC,
|
|
1454
|
+
et.workout_start_utc DESC,
|
|
1455
|
+
et.id DESC
|
|
1456
|
+
`);
|
|
1457
|
+
|
|
1458
|
+
// src/database/database.schemas.ts
|
|
1459
|
+
var userDbSchema = createSelectSchema(user);
|
|
1460
|
+
var userInsertDbSchema = createInsertSchema(user);
|
|
1461
|
+
var userUpdateDbSchema = createUpdateSchema(user);
|
|
1462
|
+
var oauthAccountDbSchema = createSelectSchema(oauthAccount);
|
|
1463
|
+
var exerciseDbSchema = createSelectSchema(exercise);
|
|
1464
|
+
var workoutPlanDbSchema = createSelectSchema(workoutPlan);
|
|
1465
|
+
var workoutSplitDbSchema = createSelectSchema(workoutSplit);
|
|
1466
|
+
var exerciseToWorkoutSplitDbSchema = createSelectSchema(exerciseToWorkoutSplit);
|
|
1467
|
+
var exerciseToWorkoutSplitExpandedViewDbSchema = createSelectSchema(exerciseToWorkoutSplitExpandedView);
|
|
1468
|
+
var workoutSetDbSchema = createSelectSchema(workoutSet);
|
|
1469
|
+
var workoutSummaryDbSchema = createSelectSchema(workoutSummary);
|
|
1470
|
+
var exerciseTrackingDbSchema = createSelectSchema(exerciseTracking);
|
|
1471
|
+
var trackingSetDbSchema = createSelectSchema(trackingSet);
|
|
1472
|
+
var aerobicTrackingDbSchema = createSelectSchema(aerobicTracking);
|
|
1473
|
+
var messageDbSchema = createSelectSchema(message);
|
|
1474
|
+
var userReminderSettingDbSchema = createSelectSchema(userReminderSetting);
|
|
1475
|
+
var userSplitInformationDbSchema = createSelectSchema(userSplitInformation);
|
|
1476
|
+
var exerciseTrackingExpandedViewDbSchema = createSelectSchema(exerciseTrackingExpandedView);
|
|
1477
|
+
var prsViewDbSchema = createSelectSchema(prsView);
|
|
1478
|
+
|
|
1479
|
+
// src/modules/aerobics/aerobics.contracts.ts
|
|
1480
|
+
import { z as z3 } from "zod/v4";
|
|
1481
|
+
|
|
1482
|
+
// src/modules/aerobics/aerobics.dtos.ts
|
|
1483
|
+
import { z as z2 } from "zod/v4";
|
|
1484
|
+
var addAerobicInputQueryDtoSchema = z2.object({
|
|
1485
|
+
durationMins: z2.number(),
|
|
1486
|
+
durationSec: aerobicTrackingDbSchema.shape.durationSec,
|
|
1487
|
+
type: aerobicTrackingDbSchema.shape.type
|
|
1488
|
+
});
|
|
1489
|
+
var aerobicsDailyRecordQueryDtoSchema = z2.object({
|
|
1490
|
+
type: aerobicTrackingDbSchema.shape.type,
|
|
1491
|
+
durationSec: aerobicTrackingDbSchema.shape.durationSec,
|
|
1492
|
+
durationMins: aerobicTrackingDbSchema.shape.durationSec
|
|
1493
|
+
});
|
|
1494
|
+
var aerobicsWeeklyRecordQueryDtoSchema = aerobicsDailyRecordQueryDtoSchema.extend({
|
|
1495
|
+
workoutTimeUtc: serializedDateSchema
|
|
1496
|
+
});
|
|
1497
|
+
var weeklyDataQueryDtoSchema = z2.object({
|
|
1498
|
+
records: z2.array(aerobicsWeeklyRecordQueryDtoSchema),
|
|
1499
|
+
totalDurationSec: z2.number(),
|
|
1500
|
+
totalDurationMins: z2.number()
|
|
200
1501
|
});
|
|
201
|
-
var
|
|
202
|
-
|
|
1502
|
+
var userAerobicsQueryDtoSchema = z2.object({
|
|
1503
|
+
daily: z2.record(z2.string(), z2.array(aerobicsDailyRecordQueryDtoSchema)),
|
|
1504
|
+
weekly: z2.record(z2.string(), weeklyDataQueryDtoSchema)
|
|
203
1505
|
});
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
accessToken: import_zod4.z.string(),
|
|
207
|
-
refreshToken: import_zod4.z.string(),
|
|
208
|
-
userId: import_zod4.z.string()
|
|
1506
|
+
var userAerobicsRowQueryDtoSchema = z2.object({
|
|
1507
|
+
data: userAerobicsQueryDtoSchema
|
|
209
1508
|
});
|
|
210
1509
|
|
|
211
|
-
// src/modules/
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1510
|
+
// src/modules/aerobics/aerobics.contracts.ts
|
|
1511
|
+
var addAerobicsRequestSchema = z3.object({
|
|
1512
|
+
body: z3.object({
|
|
1513
|
+
tz: z3.string(),
|
|
1514
|
+
record: addAerobicInputQueryDtoSchema
|
|
216
1515
|
})
|
|
217
1516
|
});
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
var
|
|
222
|
-
|
|
1517
|
+
var addUserAerobicsContract = {
|
|
1518
|
+
request: addAerobicsRequestSchema
|
|
1519
|
+
};
|
|
1520
|
+
var getAerobicsRequestSchema = z3.object({
|
|
1521
|
+
query: z3.object({
|
|
1522
|
+
tz: z3.string().optional()
|
|
1523
|
+
})
|
|
1524
|
+
});
|
|
1525
|
+
var userAerobicsResponseSchema = userAerobicsQueryDtoSchema;
|
|
1526
|
+
var getUserAerobicsContract = {
|
|
1527
|
+
request: getAerobicsRequestSchema,
|
|
1528
|
+
response: userAerobicsResponseSchema
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
// src/modules/analytics/analytics.contracts.ts
|
|
1532
|
+
import { z as z5 } from "zod/v4";
|
|
1533
|
+
|
|
1534
|
+
// src/modules/analytics/analytics.dtos.ts
|
|
1535
|
+
import { z as z4 } from "zod/v4";
|
|
1536
|
+
var workoutRmRecordQueryDtoSchema = z4.object({
|
|
1537
|
+
exercise: exerciseDbSchema.shape.name,
|
|
1538
|
+
prWeight: trackingSetDbSchema.shape.weight.nullable(),
|
|
1539
|
+
prReps: trackingSetDbSchema.shape.reps.nullable(),
|
|
1540
|
+
max1Rm: z4.number()
|
|
1541
|
+
});
|
|
1542
|
+
var adherenceExerciseStatsQueryDtoSchema = z4.object({
|
|
1543
|
+
planned: z4.number(),
|
|
1544
|
+
actual: z4.number(),
|
|
1545
|
+
adherencePct: z4.number().nullable()
|
|
1546
|
+
});
|
|
1547
|
+
var workoutRmsQueryDtoSchema = z4.record(z4.string(), workoutRmRecordQueryDtoSchema);
|
|
1548
|
+
var workoutRmsRowQueryDtoSchema = z4.object({
|
|
1549
|
+
result: workoutRmsQueryDtoSchema
|
|
1550
|
+
});
|
|
1551
|
+
var goalAdherenceQueryDtoSchema = z4.record(z4.string(), z4.record(z4.string(), adherenceExerciseStatsQueryDtoSchema));
|
|
1552
|
+
var goalAdherenceRowQueryDtoSchema = z4.object({
|
|
1553
|
+
result: goalAdherenceQueryDtoSchema
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
// src/modules/analytics/analytics.contracts.ts
|
|
1557
|
+
var getAnalyticsResponseSchema = z5.object({
|
|
1558
|
+
oneRepMaxes: z5.record(z5.string(), workoutRmRecordQueryDtoSchema),
|
|
1559
|
+
goals: z5.record(z5.string(), z5.record(z5.string(), adherenceExerciseStatsQueryDtoSchema))
|
|
1560
|
+
});
|
|
1561
|
+
var getAnalyticsContract = {
|
|
1562
|
+
response: getAnalyticsResponseSchema
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
// src/modules/auth/password/password.contracts.ts
|
|
1566
|
+
import { z as z6 } from "zod/v4";
|
|
1567
|
+
var sendChangePassEmailRequestSchema = z6.object({
|
|
1568
|
+
body: z6.object({
|
|
1569
|
+
identifier: z6.string()
|
|
1570
|
+
})
|
|
1571
|
+
});
|
|
1572
|
+
var sendChangePassEmailContract = {
|
|
1573
|
+
request: sendChangePassEmailRequestSchema
|
|
1574
|
+
};
|
|
1575
|
+
var resetPasswordRequestSchema = z6.object({
|
|
1576
|
+
body: z6.object({
|
|
1577
|
+
newPassword: z6.string().min(8, "Password must be at least 8 characters long")
|
|
1578
|
+
}),
|
|
1579
|
+
query: z6.object({
|
|
1580
|
+
token: z6.string().optional()
|
|
1581
|
+
})
|
|
1582
|
+
});
|
|
1583
|
+
var resetPasswordResponseSchema = z6.object({
|
|
1584
|
+
ok: z6.boolean()
|
|
1585
|
+
});
|
|
1586
|
+
var resetPasswordContract = {
|
|
1587
|
+
request: resetPasswordRequestSchema,
|
|
1588
|
+
response: resetPasswordResponseSchema
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
// src/modules/auth/password/password.dtos.ts
|
|
1592
|
+
import { z as z7 } from "zod/v4";
|
|
1593
|
+
var forgotPasswordPayloadDtoSchema = z7.object({
|
|
1594
|
+
sub: userDbSchema.shape.id,
|
|
1595
|
+
jti: z7.string(),
|
|
1596
|
+
exp: z7.number(),
|
|
1597
|
+
iss: z7.string(),
|
|
1598
|
+
typ: z7.string()
|
|
1599
|
+
});
|
|
1600
|
+
|
|
1601
|
+
// src/modules/auth/session/session.contracts.ts
|
|
1602
|
+
import { z as z8 } from "zod/v4";
|
|
1603
|
+
var loginRequestSchema = z8.object({
|
|
1604
|
+
body: z8.object({
|
|
1605
|
+
identifier: z8.string().min(3).refine((value) => z8.string().email().safeParse(value).success || /^[a-zA-Z0-9_]{3,20}$/.test(value), {
|
|
1606
|
+
message: "Must be a valid email or username"
|
|
1607
|
+
}),
|
|
1608
|
+
password: z8.string().min(1, "Username and password are required")
|
|
1609
|
+
})
|
|
1610
|
+
});
|
|
1611
|
+
var loginResponseSchema = z8.object({
|
|
1612
|
+
message: z8.string(),
|
|
1613
|
+
user: userDbSchema.shape.id,
|
|
1614
|
+
accessToken: z8.string(),
|
|
1615
|
+
refreshToken: z8.string()
|
|
1616
|
+
});
|
|
1617
|
+
var loginContract = {
|
|
1618
|
+
request: loginRequestSchema,
|
|
1619
|
+
response: loginResponseSchema
|
|
1620
|
+
};
|
|
1621
|
+
var refreshTokenResponseSchema = z8.object({
|
|
1622
|
+
message: z8.string(),
|
|
1623
|
+
accessToken: z8.string(),
|
|
1624
|
+
refreshToken: z8.string(),
|
|
1625
|
+
userId: userDbSchema.shape.id
|
|
1626
|
+
});
|
|
1627
|
+
var refreshTokenContract = {
|
|
1628
|
+
response: refreshTokenResponseSchema
|
|
1629
|
+
};
|
|
1630
|
+
var logoutResponseSchema = z8.object({
|
|
1631
|
+
message: z8.string()
|
|
1632
|
+
});
|
|
1633
|
+
var logoutContract = {
|
|
1634
|
+
response: logoutResponseSchema
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
// src/modules/auth/session/session.dtos.ts
|
|
1638
|
+
import { z as z10 } from "zod/v4";
|
|
1639
|
+
|
|
1640
|
+
// src/modules/user/update/update.dtos.ts
|
|
1641
|
+
import { z as z9 } from "zod/v4";
|
|
1642
|
+
var authenticatedUserForUpdateQueryDtoSchema = z9.object({
|
|
1643
|
+
username: 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"),
|
|
1644
|
+
fullName: userDbSchema.shape.name.trim().min(1, "Full name is required").max(20, "Full name is too long").regex(/^[a-zA-Z\s]+$/, "Full name may contain letters and spaces only"),
|
|
1645
|
+
email: userDbSchema.shape.email.trim().toLowerCase().email("Invalid email format")
|
|
1646
|
+
}).partial();
|
|
1647
|
+
var userDataQueryDtoSchema = z9.object({
|
|
1648
|
+
id: userDbSchema.shape.id,
|
|
1649
|
+
username: userDbSchema.shape.username,
|
|
1650
|
+
email: userDbSchema.shape.email,
|
|
1651
|
+
name: userDbSchema.shape.name,
|
|
1652
|
+
gender: userDbSchema.shape.gender,
|
|
1653
|
+
createdAt: serializedDateSchema,
|
|
1654
|
+
updatedAt: serializedDateSchema,
|
|
1655
|
+
profilePicPath: userDbSchema.shape.profilePicPath,
|
|
1656
|
+
pushToken: userDbSchema.shape.pushToken,
|
|
1657
|
+
role: userDbSchema.shape.role,
|
|
1658
|
+
isFirstLogin: z9.boolean(),
|
|
1659
|
+
tokenVersion: userDbSchema.shape.tokenVersion,
|
|
1660
|
+
isVerified: userDbSchema.shape.isVerified,
|
|
1661
|
+
authProvider: userDbSchema.shape.authProvider,
|
|
1662
|
+
lastLogin: serializedDateSchema.nullable()
|
|
1663
|
+
});
|
|
1664
|
+
var userDataRowQueryDtoSchema = z9.object({
|
|
1665
|
+
userData: userDataQueryDtoSchema
|
|
1666
|
+
});
|
|
1667
|
+
var userConflictQueryDtoSchema = z9.object({
|
|
1668
|
+
conflict: z9.boolean()
|
|
1669
|
+
});
|
|
1670
|
+
var userMessageIdentityQueryDtoSchema = z9.object({
|
|
1671
|
+
id: userDbSchema.shape.id,
|
|
1672
|
+
username: userDbSchema.shape.username,
|
|
1673
|
+
name: userDbSchema.shape.name,
|
|
1674
|
+
profilePicPath: userDbSchema.shape.profilePicPath
|
|
1675
|
+
});
|
|
1676
|
+
var userProfilePicQueryDtoSchema = z9.object({
|
|
1677
|
+
profilePicPath: userDbSchema.shape.profilePicPath
|
|
1678
|
+
});
|
|
1679
|
+
var changeEmailTokenPayloadDtoSchema = z9.object({
|
|
1680
|
+
jti: z9.string(),
|
|
1681
|
+
sub: z9.string(),
|
|
1682
|
+
newEmail: z9.string(),
|
|
1683
|
+
exp: z9.number(),
|
|
1684
|
+
iss: z9.string(),
|
|
1685
|
+
typ: z9.string()
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
// src/modules/auth/session/session.dtos.ts
|
|
1689
|
+
var accessTokenPayloadDtoSchema = z10.object({
|
|
1690
|
+
id: userDbSchema.shape.id,
|
|
1691
|
+
role: userDbSchema.shape.role,
|
|
1692
|
+
tokenVer: userDbSchema.shape.tokenVersion,
|
|
1693
|
+
cnf: z10.object({
|
|
1694
|
+
jkt: z10.string()
|
|
1695
|
+
}).optional(),
|
|
1696
|
+
iat: z10.number().optional(),
|
|
1697
|
+
exp: z10.number().optional()
|
|
1698
|
+
});
|
|
1699
|
+
var userAfterBumpQueryDtoSchema = z10.object({
|
|
1700
|
+
tokenVersion: userDbSchema.shape.tokenVersion,
|
|
1701
|
+
userData: userDataQueryDtoSchema
|
|
1702
|
+
});
|
|
1703
|
+
var tokenVersionQueryDtoSchema = z10.object({
|
|
1704
|
+
tokenVersion: userDbSchema.shape.tokenVersion
|
|
1705
|
+
});
|
|
1706
|
+
var lastLoginQueryDtoSchema = z10.object({
|
|
1707
|
+
lastLogin: z10.date().nullable()
|
|
1708
|
+
});
|
|
1709
|
+
|
|
1710
|
+
// src/modules/auth/verification/verification.contracts.ts
|
|
1711
|
+
import { z as z11 } from "zod/v4";
|
|
1712
|
+
var verifyAccountRequestSchema = z11.object({
|
|
1713
|
+
query: z11.object({
|
|
1714
|
+
token: z11.string().optional()
|
|
1715
|
+
})
|
|
1716
|
+
});
|
|
1717
|
+
var verifyUserAccountContract = {
|
|
1718
|
+
request: verifyAccountRequestSchema
|
|
1719
|
+
};
|
|
1720
|
+
var sendVerificationMailRequestSchema = z11.object({
|
|
1721
|
+
body: z11.object({
|
|
1722
|
+
email: userDbSchema.shape.email.trim().email("Invalid email")
|
|
1723
|
+
})
|
|
1724
|
+
});
|
|
1725
|
+
var sendVerificationMailContract = {
|
|
1726
|
+
request: sendVerificationMailRequestSchema
|
|
1727
|
+
};
|
|
1728
|
+
var changeEmailAndVerifyRequestSchema = z11.object({
|
|
1729
|
+
body: z11.object({
|
|
1730
|
+
username: userDbSchema.shape.username,
|
|
1731
|
+
password: z11.string(),
|
|
1732
|
+
newEmail: userDbSchema.shape.email.trim().email("Invalid email")
|
|
1733
|
+
})
|
|
1734
|
+
});
|
|
1735
|
+
var changeEmailAndVerifyContract = {
|
|
1736
|
+
request: changeEmailAndVerifyRequestSchema
|
|
1737
|
+
};
|
|
1738
|
+
var checkUserVerifyRequestSchema = z11.object({
|
|
1739
|
+
query: z11.object({
|
|
1740
|
+
username: userDbSchema.shape.username
|
|
1741
|
+
})
|
|
1742
|
+
});
|
|
1743
|
+
var checkUserVerifyContract = {
|
|
1744
|
+
request: checkUserVerifyRequestSchema
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
// src/modules/auth/verification/verification.dtos.ts
|
|
1748
|
+
import { z as z12 } from "zod/v4";
|
|
1749
|
+
var emailVerifyPayloadDtoSchema = z12.object({
|
|
1750
|
+
sub: userDbSchema.shape.id,
|
|
1751
|
+
jti: z12.string(),
|
|
1752
|
+
exp: z12.number(),
|
|
1753
|
+
iss: z12.string(),
|
|
1754
|
+
typ: z12.string()
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
// src/modules/auth/auth.dtos.ts
|
|
1758
|
+
import { z as z13 } from "zod/v4";
|
|
1759
|
+
var userByIdentifierQueryDtoSchema = z13.object({
|
|
1760
|
+
id: userDbSchema.shape.id,
|
|
1761
|
+
name: userDbSchema.shape.name,
|
|
1762
|
+
username: userDbSchema.shape.username,
|
|
1763
|
+
email: userDbSchema.shape.email.optional(),
|
|
1764
|
+
password: userDbSchema.shape.passwordHash,
|
|
1765
|
+
role: userDbSchema.shape.role,
|
|
1766
|
+
isVerified: userDbSchema.shape.isVerified,
|
|
1767
|
+
lastLogin: serializedDateSchema.nullable().optional()
|
|
1768
|
+
});
|
|
1769
|
+
var userByIdentifierRawQueryDtoSchema = userByIdentifierQueryDtoSchema.omit({
|
|
1770
|
+
isVerified: true,
|
|
1771
|
+
lastLogin: true
|
|
1772
|
+
}).extend({
|
|
1773
|
+
is_verified: z13.boolean(),
|
|
1774
|
+
last_login: serializedDateSchema.nullable()
|
|
1775
|
+
});
|
|
1776
|
+
var userByIdentifierRowQueryDtoSchema = z13.object({
|
|
1777
|
+
userData: userByIdentifierRawQueryDtoSchema.nullable()
|
|
1778
|
+
});
|
|
1779
|
+
var userByUsernameRawQueryDtoSchema = userByIdentifierQueryDtoSchema.omit({
|
|
1780
|
+
isVerified: true
|
|
1781
|
+
}).extend({
|
|
1782
|
+
is_verified: z13.boolean()
|
|
1783
|
+
});
|
|
1784
|
+
var userByUsernameRowQueryDtoSchema = z13.object({
|
|
1785
|
+
userData: userByUsernameRawQueryDtoSchema.nullable()
|
|
1786
|
+
});
|
|
1787
|
+
|
|
1788
|
+
// src/modules/bootstrap/bootstrap.contracts.ts
|
|
1789
|
+
import { z as z19 } from "zod/v4";
|
|
1790
|
+
|
|
1791
|
+
// src/modules/messages/messages.contracts.ts
|
|
1792
|
+
import { z as z15 } from "zod/v4";
|
|
1793
|
+
|
|
1794
|
+
// src/modules/messages/messages.dtos.ts
|
|
1795
|
+
import { z as z14 } from "zod/v4";
|
|
1796
|
+
var allUserMessageQueryDtoSchema = z14.object({
|
|
1797
|
+
id: messageDbSchema.shape.id,
|
|
1798
|
+
subject: messageDbSchema.shape.subject,
|
|
1799
|
+
msg: messageDbSchema.shape.msg,
|
|
1800
|
+
sentAt: serializedDateSchema,
|
|
1801
|
+
isRead: messageDbSchema.shape.isRead,
|
|
1802
|
+
senderFullName: userDbSchema.shape.name,
|
|
1803
|
+
senderProfilePicPath: userDbSchema.shape.profilePicPath
|
|
1804
|
+
});
|
|
1805
|
+
var messageAsReadQueryDtoSchema = z14.object({
|
|
1806
|
+
id: messageDbSchema.shape.id,
|
|
1807
|
+
isRead: messageDbSchema.shape.isRead
|
|
1808
|
+
});
|
|
1809
|
+
var deletedMessageQueryDtoSchema = z14.object({
|
|
1810
|
+
id: messageDbSchema.shape.id
|
|
1811
|
+
});
|
|
1812
|
+
var messageAfterSendQueryDtoSchema = z14.object({
|
|
1813
|
+
id: messageDbSchema.shape.id,
|
|
1814
|
+
senderId: messageDbSchema.shape.senderId,
|
|
1815
|
+
receiverId: messageDbSchema.shape.receiverId,
|
|
1816
|
+
subject: messageDbSchema.shape.subject,
|
|
1817
|
+
msg: messageDbSchema.shape.msg,
|
|
1818
|
+
sentAt: serializedDateSchema,
|
|
1819
|
+
isRead: messageDbSchema.shape.isRead,
|
|
1820
|
+
senderUsername: userDbSchema.shape.username,
|
|
1821
|
+
senderFullName: userDbSchema.shape.name,
|
|
1822
|
+
senderProfilePicPath: userDbSchema.shape.profilePicPath,
|
|
1823
|
+
senderGender: userDbSchema.shape.gender
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
// src/modules/messages/messages.contracts.ts
|
|
1827
|
+
var getAllMessagesRequestSchema = z15.object({
|
|
1828
|
+
query: z15.object({
|
|
1829
|
+
tz: z15.string()
|
|
1830
|
+
})
|
|
1831
|
+
});
|
|
1832
|
+
var getAllUserMessagesResponseSchema = z15.object({
|
|
1833
|
+
messages: z15.array(allUserMessageQueryDtoSchema)
|
|
1834
|
+
});
|
|
1835
|
+
var getAllUserMessagesContract = {
|
|
1836
|
+
request: getAllMessagesRequestSchema,
|
|
1837
|
+
response: getAllUserMessagesResponseSchema
|
|
1838
|
+
};
|
|
1839
|
+
var markMessageAsReadRequestSchema = z15.object({
|
|
1840
|
+
params: z15.object({
|
|
1841
|
+
id: messageDbSchema.shape.id
|
|
1842
|
+
})
|
|
223
1843
|
});
|
|
224
|
-
var
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
});
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
});
|
|
286
|
-
var
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
var
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
var
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
var
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
})
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
});
|
|
397
|
-
var
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
})
|
|
416
|
-
});
|
|
417
|
-
var trackingMapItemSchema = import_zod9.z.object({
|
|
418
|
-
id: import_zod9.z.number(),
|
|
419
|
-
exercisetosplit_id: import_zod9.z.number(),
|
|
420
|
-
weight: import_zod9.z.array(import_zod9.z.number()),
|
|
421
|
-
reps: import_zod9.z.array(import_zod9.z.number()),
|
|
422
|
-
notes: import_zod9.z.string().nullable(),
|
|
423
|
-
exercise_id: import_zod9.z.number(),
|
|
424
|
-
workoutsplit_id: import_zod9.z.number(),
|
|
425
|
-
splitname: import_zod9.z.string(),
|
|
426
|
-
exercise: import_zod9.z.string(),
|
|
427
|
-
workoutdate: import_zod9.z.string(),
|
|
428
|
-
order_index: import_zod9.z.number(),
|
|
429
|
-
exercisetoworkoutsplit: import_zod9.z.object({
|
|
430
|
-
sets: import_zod9.z.array(import_zod9.z.number()),
|
|
431
|
-
exercises: exerciseMetadataSchema
|
|
432
|
-
})
|
|
433
|
-
});
|
|
434
|
-
var trackingByDateItemSchema = trackingMapItemSchema.omit({ workoutdate: true });
|
|
435
|
-
var trackingBySplitNameItemSchema = trackingMapItemSchema.omit({ splitname: true });
|
|
436
|
-
var exerciseTrackingAndStatsSchema = import_zod9.z.object({
|
|
437
|
-
exerciseTrackingAnalysis: exerciseTrackingAnalysisSchema,
|
|
438
|
-
exerciseTrackingMaps: import_zod9.z.object({
|
|
439
|
-
byDate: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(trackingByDateItemSchema)),
|
|
440
|
-
byETSId: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(trackingMapItemSchema)),
|
|
441
|
-
bySplitName: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(trackingBySplitNameItemSchema))
|
|
442
|
-
})
|
|
443
|
-
});
|
|
444
|
-
var finishWorkoutRequest = import_zod9.z.object({
|
|
445
|
-
body: import_zod9.z.object({
|
|
446
|
-
workout: import_zod9.z.array(finishedExerciseEntry),
|
|
447
|
-
tz: import_zod9.z.string().optional(),
|
|
448
|
-
workout_start_utc: import_zod9.z.string().datetime("workout_start_utc must be a valid ISO datetime"),
|
|
449
|
-
workout_end_utc: import_zod9.z.string().datetime("workout_end_utc must be a valid ISO datetime").optional().nullable()
|
|
450
|
-
})
|
|
451
|
-
});
|
|
452
|
-
var finishUserWorkoutResponseSchema = exerciseTrackingAndStatsSchema;
|
|
453
|
-
var getExerciseTrackingRequest = import_zod9.z.object({
|
|
454
|
-
query: import_zod9.z.object({
|
|
455
|
-
tz: import_zod9.z.string().optional()
|
|
456
|
-
})
|
|
457
|
-
});
|
|
458
|
-
var getExerciseTrackingResponseSchema = exerciseTrackingAndStatsSchema;
|
|
459
|
-
|
|
460
|
-
// src/modules/bootstrap/bootstrap.schemas.ts
|
|
461
|
-
var bootstrapRequest = import_zod10.z.object({
|
|
462
|
-
query: import_zod10.z.object({
|
|
463
|
-
tz: import_zod10.z.string().optional()
|
|
464
|
-
})
|
|
465
|
-
});
|
|
466
|
-
var bootstrapResponseSchema = import_zod10.z.object({
|
|
467
|
-
user: userDataSchema,
|
|
1844
|
+
var markMessageAsReadResponseSchema = messageAsReadQueryDtoSchema;
|
|
1845
|
+
var markMessageAsReadContract = {
|
|
1846
|
+
request: markMessageAsReadRequestSchema,
|
|
1847
|
+
response: markMessageAsReadResponseSchema
|
|
1848
|
+
};
|
|
1849
|
+
var deleteMessageRequestSchema = z15.object({
|
|
1850
|
+
params: z15.object({
|
|
1851
|
+
id: messageDbSchema.shape.id
|
|
1852
|
+
})
|
|
1853
|
+
});
|
|
1854
|
+
var deleteMessageResponseSchema = deletedMessageQueryDtoSchema;
|
|
1855
|
+
var deleteMessageContract = {
|
|
1856
|
+
request: deleteMessageRequestSchema,
|
|
1857
|
+
response: deleteMessageResponseSchema
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1860
|
+
// src/modules/workout/plan/plan.contracts.ts
|
|
1861
|
+
import { z as z17 } from "zod/v4";
|
|
1862
|
+
|
|
1863
|
+
// src/modules/workout/plan/plan.dtos.ts
|
|
1864
|
+
import { z as z16 } from "zod/v4";
|
|
1865
|
+
var workoutExerciseInputQueryDtoSchema = z16.object({
|
|
1866
|
+
id: exerciseDbSchema.shape.id,
|
|
1867
|
+
sets: z16.array(workoutSetDbSchema.shape.reps),
|
|
1868
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex
|
|
1869
|
+
});
|
|
1870
|
+
var addWorkoutSplitPayloadQueryDtoSchema = z16.record(z16.string(), z16.array(workoutExerciseInputQueryDtoSchema).min(1, "Each split must include at least one exercise"));
|
|
1871
|
+
var exerciseInPlanQueryDtoSchema = z16.object({
|
|
1872
|
+
id: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
1873
|
+
sets: z16.array(workoutSetDbSchema.shape.reps),
|
|
1874
|
+
isActive: exerciseToWorkoutSplitDbSchema.shape.isActive,
|
|
1875
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
1876
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle,
|
|
1877
|
+
exercise: exerciseDbSchema.shape.name,
|
|
1878
|
+
workoutSplit: workoutSplitDbSchema.shape.name
|
|
1879
|
+
});
|
|
1880
|
+
var workoutSplitQueryDtoSchema = z16.object({
|
|
1881
|
+
id: workoutSplitDbSchema.shape.id,
|
|
1882
|
+
workoutId: workoutSplitDbSchema.shape.workoutId,
|
|
1883
|
+
name: workoutSplitDbSchema.shape.name,
|
|
1884
|
+
createdAt: serializedDateSchema,
|
|
1885
|
+
muscleGroup: z16.string().nullable(),
|
|
1886
|
+
isActive: workoutSplitDbSchema.shape.isActive,
|
|
1887
|
+
exerciseToWorkoutSplit: z16.array(exerciseInPlanQueryDtoSchema)
|
|
1888
|
+
});
|
|
1889
|
+
var wholeUserWorkoutPlanQueryDtoSchema = z16.object({
|
|
1890
|
+
id: workoutPlanDbSchema.shape.id,
|
|
1891
|
+
numberOfSplits: z16.number(),
|
|
1892
|
+
createdAt: serializedDateSchema,
|
|
1893
|
+
userId: userDbSchema.shape.id,
|
|
1894
|
+
isActive: workoutPlanDbSchema.shape.isActive,
|
|
1895
|
+
updatedAt: serializedDateSchema,
|
|
1896
|
+
workoutSplits: z16.array(workoutSplitQueryDtoSchema).nullable()
|
|
1897
|
+
});
|
|
1898
|
+
var workoutSplitsMapItemQueryDtoSchema = z16.object({
|
|
1899
|
+
id: exerciseDbSchema.shape.id,
|
|
1900
|
+
name: exerciseDbSchema.shape.name,
|
|
1901
|
+
sets: z16.array(workoutSetDbSchema.shape.reps),
|
|
1902
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
1903
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
1904
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
1905
|
+
});
|
|
1906
|
+
var workoutExerciseMetadataQueryDtoSchema = workoutSplitsMapItemQueryDtoSchema.pick({
|
|
1907
|
+
targetMuscle: true,
|
|
1908
|
+
specificTargetMuscle: true
|
|
1909
|
+
});
|
|
1910
|
+
var workoutSplitsMapQueryDtoSchema = z16.record(z16.string(), z16.array(workoutSplitsMapItemQueryDtoSchema));
|
|
1911
|
+
var workoutSplitsRowQueryDtoSchema = z16.object({
|
|
1912
|
+
splits: workoutSplitsMapQueryDtoSchema
|
|
1913
|
+
});
|
|
1914
|
+
var workoutPlanIdQueryDtoSchema = z16.object({
|
|
1915
|
+
id: workoutPlanDbSchema.shape.id
|
|
1916
|
+
});
|
|
1917
|
+
var workoutSplitIdQueryDtoSchema = z16.object({
|
|
1918
|
+
id: workoutSplitDbSchema.shape.id
|
|
1919
|
+
});
|
|
1920
|
+
var exerciseAssignmentIdQueryDtoSchema = z16.object({
|
|
1921
|
+
id: exerciseToWorkoutSplitDbSchema.shape.id
|
|
1922
|
+
});
|
|
1923
|
+
|
|
1924
|
+
// src/modules/workout/plan/plan.contracts.ts
|
|
1925
|
+
var getWholeWorkoutPlanRequestSchema = z17.object({
|
|
1926
|
+
query: z17.object({
|
|
1927
|
+
tz: z17.string().optional()
|
|
1928
|
+
})
|
|
1929
|
+
});
|
|
1930
|
+
var getWholeUserWorkoutPlanResponseSchema = z17.object({
|
|
1931
|
+
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema.nullable(),
|
|
1932
|
+
workoutPlanForEditWorkout: workoutSplitsMapQueryDtoSchema.nullable()
|
|
1933
|
+
});
|
|
1934
|
+
var getWholeUserWorkoutPlanContract = {
|
|
1935
|
+
request: getWholeWorkoutPlanRequestSchema,
|
|
1936
|
+
response: getWholeUserWorkoutPlanResponseSchema
|
|
1937
|
+
};
|
|
1938
|
+
var addWorkoutRequestSchema = z17.object({
|
|
1939
|
+
body: z17.object({
|
|
1940
|
+
workoutData: addWorkoutSplitPayloadQueryDtoSchema,
|
|
1941
|
+
workoutName: z17.string().optional(),
|
|
1942
|
+
tz: z17.string()
|
|
1943
|
+
})
|
|
1944
|
+
});
|
|
1945
|
+
var addWorkoutResponseSchema = z17.object({
|
|
1946
|
+
message: z17.string(),
|
|
1947
|
+
workoutPlan: wholeUserWorkoutPlanQueryDtoSchema,
|
|
1948
|
+
workoutPlanForEditWorkout: workoutSplitsMapQueryDtoSchema
|
|
1949
|
+
});
|
|
1950
|
+
var addWorkoutContract = {
|
|
1951
|
+
request: addWorkoutRequestSchema,
|
|
1952
|
+
response: addWorkoutResponseSchema
|
|
1953
|
+
};
|
|
1954
|
+
|
|
1955
|
+
// src/modules/workout/tracking/tracking.dtos.ts
|
|
1956
|
+
import { z as z18 } from "zod/v4";
|
|
1957
|
+
var finishedWorkoutEntryQueryDtoSchema = z18.object({
|
|
1958
|
+
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
1959
|
+
weight: z18.array(trackingSetDbSchema.shape.weight),
|
|
1960
|
+
reps: z18.array(trackingSetDbSchema.shape.reps),
|
|
1961
|
+
notes: exerciseTrackingDbSchema.shape.notes.optional()
|
|
1962
|
+
});
|
|
1963
|
+
var exerciseMetadataQueryDtoSchema = z18.object({
|
|
1964
|
+
targetMuscle: exerciseDbSchema.shape.targetMuscle,
|
|
1965
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
1966
|
+
});
|
|
1967
|
+
var exerciseTrackingPrMaxQueryDtoSchema = z18.object({
|
|
1968
|
+
exercise: exerciseDbSchema.shape.name,
|
|
1969
|
+
weight: trackingSetDbSchema.shape.weight,
|
|
1970
|
+
reps: trackingSetDbSchema.shape.reps,
|
|
1971
|
+
workoutTimeUtc: serializedDateSchema
|
|
1972
|
+
});
|
|
1973
|
+
var exerciseTrackingAnalysisQueryDtoSchema = z18.object({
|
|
1974
|
+
uniqueDays: z18.number(),
|
|
1975
|
+
mostFrequentSplit: z18.string().nullable(),
|
|
1976
|
+
mostFrequentSplitDays: z18.number().nullable(),
|
|
1977
|
+
lastWorkoutDate: z18.string().nullable(),
|
|
1978
|
+
splitDaysByName: z18.record(z18.string(), z18.number()),
|
|
1979
|
+
prs: z18.object({
|
|
1980
|
+
prMax: exerciseTrackingPrMaxQueryDtoSchema.nullable()
|
|
1981
|
+
})
|
|
1982
|
+
});
|
|
1983
|
+
var trackingMapItemQueryDtoSchema = z18.object({
|
|
1984
|
+
id: exerciseTrackingDbSchema.shape.id,
|
|
1985
|
+
exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
|
|
1986
|
+
weight: z18.array(trackingSetDbSchema.shape.weight),
|
|
1987
|
+
reps: z18.array(trackingSetDbSchema.shape.reps),
|
|
1988
|
+
notes: exerciseTrackingDbSchema.shape.notes,
|
|
1989
|
+
exerciseId: exerciseDbSchema.shape.id,
|
|
1990
|
+
workoutSplitId: workoutSplitDbSchema.shape.id,
|
|
1991
|
+
splitName: workoutSplitDbSchema.shape.name,
|
|
1992
|
+
exercise: exerciseDbSchema.shape.name,
|
|
1993
|
+
workoutDate: serializedDateSchema,
|
|
1994
|
+
orderIndex: exerciseToWorkoutSplitDbSchema.shape.orderIndex,
|
|
1995
|
+
exerciseToWorkoutSplit: z18.object({
|
|
1996
|
+
sets: z18.array(workoutSetDbSchema.shape.reps),
|
|
1997
|
+
exercises: exerciseMetadataQueryDtoSchema
|
|
1998
|
+
})
|
|
1999
|
+
});
|
|
2000
|
+
var trackingByDateItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2001
|
+
workoutDate: true
|
|
2002
|
+
});
|
|
2003
|
+
var trackingBySplitNameItemQueryDtoSchema = trackingMapItemQueryDtoSchema.omit({
|
|
2004
|
+
splitName: true
|
|
2005
|
+
});
|
|
2006
|
+
var exerciseTrackingAndStatsQueryDtoSchema = z18.object({
|
|
2007
|
+
exerciseTrackingAnalysis: exerciseTrackingAnalysisQueryDtoSchema,
|
|
2008
|
+
exerciseTrackingMaps: z18.object({
|
|
2009
|
+
byDate: z18.record(z18.string(), z18.array(trackingByDateItemQueryDtoSchema)),
|
|
2010
|
+
byExerciseToSplitId: z18.record(z18.string(), z18.array(trackingMapItemQueryDtoSchema)),
|
|
2011
|
+
bySplitName: z18.record(z18.string(), z18.array(trackingBySplitNameItemQueryDtoSchema))
|
|
2012
|
+
})
|
|
2013
|
+
});
|
|
2014
|
+
var exerciseTrackingAndStatsRowQueryDtoSchema = z18.object({
|
|
2015
|
+
data: exerciseTrackingAndStatsQueryDtoSchema
|
|
2016
|
+
});
|
|
2017
|
+
var workoutSplitLookupQueryDtoSchema = z18.object({
|
|
2018
|
+
workoutSplitId: workoutSplitDbSchema.shape.id
|
|
2019
|
+
});
|
|
2020
|
+
var workoutSummaryIdQueryDtoSchema = z18.object({
|
|
2021
|
+
id: z18.string().uuid()
|
|
2022
|
+
});
|
|
2023
|
+
var exerciseTrackingIdQueryDtoSchema = z18.object({
|
|
2024
|
+
id: exerciseTrackingDbSchema.shape.id
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
// src/modules/bootstrap/bootstrap.contracts.ts
|
|
2028
|
+
var bootstrapRequestSchema = z19.object({
|
|
2029
|
+
query: z19.object({
|
|
2030
|
+
tz: z19.string().optional()
|
|
2031
|
+
})
|
|
2032
|
+
});
|
|
2033
|
+
var bootstrapResponseSchema = z19.object({
|
|
2034
|
+
user: userDataQueryDtoSchema,
|
|
468
2035
|
workout: getWholeUserWorkoutPlanResponseSchema,
|
|
469
|
-
tracking:
|
|
2036
|
+
tracking: exerciseTrackingAndStatsQueryDtoSchema,
|
|
470
2037
|
messages: getAllUserMessagesResponseSchema,
|
|
471
2038
|
aerobics: userAerobicsResponseSchema
|
|
472
2039
|
});
|
|
2040
|
+
var bootstrapContract = {
|
|
2041
|
+
request: bootstrapRequestSchema,
|
|
2042
|
+
response: bootstrapResponseSchema
|
|
2043
|
+
};
|
|
473
2044
|
|
|
474
|
-
// src/modules/exercises/exercises.
|
|
475
|
-
|
|
476
|
-
var
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
)
|
|
486
|
-
|
|
487
|
-
// src/modules/oauth/apple/apple.schemas.ts
|
|
488
|
-
var import_zod12 = require("zod");
|
|
489
|
-
var appleNameInput = import_zod12.z.object({
|
|
490
|
-
givenName: import_zod12.z.string().nullable(),
|
|
491
|
-
familyName: import_zod12.z.string().nullable()
|
|
2045
|
+
// src/modules/exercises/exercises.dtos.ts
|
|
2046
|
+
import { z as z20 } from "zod/v4";
|
|
2047
|
+
var getAllExercisesExerciseQueryDtoSchema = z20.object({
|
|
2048
|
+
id: exerciseDbSchema.shape.id,
|
|
2049
|
+
name: exerciseDbSchema.shape.name,
|
|
2050
|
+
specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
|
|
2051
|
+
});
|
|
2052
|
+
var exercisesMapByMuscleQueryDtoSchema = z20.record(z20.string(), z20.array(getAllExercisesExerciseQueryDtoSchema));
|
|
2053
|
+
var exerciseMapByMuscleRowQueryDtoSchema = z20.object({
|
|
2054
|
+
result: z20.object({
|
|
2055
|
+
map: exercisesMapByMuscleQueryDtoSchema.nullable()
|
|
2056
|
+
}).nullable()
|
|
492
2057
|
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
2058
|
+
|
|
2059
|
+
// src/modules/exercises/exercises.contracts.ts
|
|
2060
|
+
var getAllExercisesResponseSchema = exercisesMapByMuscleQueryDtoSchema;
|
|
2061
|
+
var getAllExercisesContract = {
|
|
2062
|
+
response: getAllExercisesResponseSchema
|
|
2063
|
+
};
|
|
2064
|
+
|
|
2065
|
+
// src/modules/oauth/apple/apple.contracts.ts
|
|
2066
|
+
import { z as z21 } from "zod/v4";
|
|
2067
|
+
var appleNameInputSchema = z21.object({
|
|
2068
|
+
givenName: z21.string().nullable(),
|
|
2069
|
+
familyName: z21.string().nullable()
|
|
2070
|
+
});
|
|
2071
|
+
var appleOAuthRequestSchema = z21.object({
|
|
2072
|
+
body: z21.object({
|
|
2073
|
+
idToken: z21.string({
|
|
2074
|
+
error: "Missing or invalid Apple identityToken"
|
|
498
2075
|
}),
|
|
499
|
-
rawNonce:
|
|
500
|
-
name:
|
|
501
|
-
email:
|
|
2076
|
+
rawNonce: z21.string(),
|
|
2077
|
+
name: appleNameInputSchema.optional(),
|
|
2078
|
+
email: userDbSchema.shape.email.email().nullable()
|
|
502
2079
|
})
|
|
503
2080
|
});
|
|
2081
|
+
var appleOAuthContract = {
|
|
2082
|
+
request: appleOAuthRequestSchema
|
|
2083
|
+
};
|
|
2084
|
+
|
|
2085
|
+
// src/modules/oauth/apple/apple.dtos.ts
|
|
2086
|
+
import { z as z22 } from "zod/v4";
|
|
2087
|
+
var appleTokenVerificationResultDtoSchema = z22.object({
|
|
2088
|
+
appleSub: z22.string(),
|
|
2089
|
+
email: userDbSchema.shape.email.nullable(),
|
|
2090
|
+
emailVerified: z22.boolean(),
|
|
2091
|
+
fullName: userDbSchema.shape.name
|
|
2092
|
+
});
|
|
504
2093
|
|
|
505
|
-
// src/modules/oauth/google/google.
|
|
506
|
-
|
|
507
|
-
var
|
|
508
|
-
body:
|
|
509
|
-
idToken:
|
|
2094
|
+
// src/modules/oauth/google/google.contracts.ts
|
|
2095
|
+
import { z as z23 } from "zod/v4";
|
|
2096
|
+
var googleOAuthRequestSchema = z23.object({
|
|
2097
|
+
body: z23.object({
|
|
2098
|
+
idToken: z23.string().optional()
|
|
510
2099
|
})
|
|
511
2100
|
});
|
|
2101
|
+
var googleOAuthContract = {
|
|
2102
|
+
request: googleOAuthRequestSchema
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
// src/modules/oauth/google/google.dtos.ts
|
|
2106
|
+
import { z as z24 } from "zod/v4";
|
|
2107
|
+
var googleTokenVerificationResultDtoSchema = z24.object({
|
|
2108
|
+
googleSub: z24.string(),
|
|
2109
|
+
email: userDbSchema.shape.email.nullable(),
|
|
2110
|
+
emailVerified: z24.boolean(),
|
|
2111
|
+
fullName: userDbSchema.shape.name
|
|
2112
|
+
});
|
|
512
2113
|
|
|
513
|
-
// src/modules/oauth/oauth.
|
|
514
|
-
|
|
515
|
-
var oAuthLoginResponseSchema =
|
|
516
|
-
message:
|
|
517
|
-
user:
|
|
518
|
-
accessToken:
|
|
519
|
-
refreshToken:
|
|
520
|
-
missingFields:
|
|
2114
|
+
// src/modules/oauth/oauth.contracts.ts
|
|
2115
|
+
import { z as z25 } from "zod/v4";
|
|
2116
|
+
var oAuthLoginResponseSchema = z25.object({
|
|
2117
|
+
message: z25.string(),
|
|
2118
|
+
user: userDbSchema.shape.id,
|
|
2119
|
+
accessToken: z25.string(),
|
|
2120
|
+
refreshToken: z25.string(),
|
|
2121
|
+
missingFields: z25.array(z25.string()).nullable()
|
|
521
2122
|
});
|
|
522
2123
|
var proceedLoginResponseSchema = loginResponseSchema;
|
|
2124
|
+
var oAuthLoginContract = {
|
|
2125
|
+
response: oAuthLoginResponseSchema
|
|
2126
|
+
};
|
|
2127
|
+
|
|
2128
|
+
// src/modules/oauth/oauth.dtos.ts
|
|
2129
|
+
import { z as z26 } from "zod/v4";
|
|
2130
|
+
var oAuthLookupQueryDtoSchema = z26.object({
|
|
2131
|
+
userId: userDbSchema.shape.id.nullable(),
|
|
2132
|
+
missingFields: z26.string().nullable()
|
|
2133
|
+
});
|
|
2134
|
+
var oAuthLookupRawQueryDtoSchema = z26.object({
|
|
2135
|
+
user_id: userDbSchema.shape.id,
|
|
2136
|
+
missing_fields: z26.string().nullable()
|
|
2137
|
+
});
|
|
2138
|
+
var oAuthLookupRowQueryDtoSchema = z26.object({
|
|
2139
|
+
oauth_data: oAuthLookupRawQueryDtoSchema.nullable()
|
|
2140
|
+
});
|
|
2141
|
+
var oAuthLinkQueryDtoSchema = z26.object({
|
|
2142
|
+
userId: userDbSchema.shape.id.nullable()
|
|
2143
|
+
});
|
|
2144
|
+
var oAuthLinkRowQueryDtoSchema = z26.object({
|
|
2145
|
+
user_id: userDbSchema.shape.id.nullable()
|
|
2146
|
+
});
|
|
2147
|
+
var oAuthCreatedUserRowQueryDtoSchema = z26.object({
|
|
2148
|
+
user_id: userDbSchema.shape.id
|
|
2149
|
+
});
|
|
2150
|
+
|
|
2151
|
+
// src/modules/push/push.dtos.ts
|
|
2152
|
+
import { z as z27 } from "zod/v4";
|
|
2153
|
+
var userWithNotificationsEnabledQueryDtoSchema = z27.object({
|
|
2154
|
+
pushToken: userDbSchema.shape.pushToken,
|
|
2155
|
+
name: userDbSchema.shape.name
|
|
2156
|
+
});
|
|
2157
|
+
var userToHourlyReminderQueryDtoSchema = z27.object({
|
|
2158
|
+
userId: userDbSchema.shape.id,
|
|
2159
|
+
name: userDbSchema.shape.name,
|
|
2160
|
+
pushToken: userDbSchema.shape.pushToken,
|
|
2161
|
+
reminderOffsetMinutes: z27.number(),
|
|
2162
|
+
splitId: workoutSplitDbSchema.shape.id,
|
|
2163
|
+
splitName: workoutSplitDbSchema.shape.name.nullable(),
|
|
2164
|
+
estimatedTimeUtc: z27.string()
|
|
2165
|
+
});
|
|
2166
|
+
|
|
2167
|
+
// src/modules/user/create/create.contracts.ts
|
|
2168
|
+
import { z as z29 } from "zod/v4";
|
|
2169
|
+
|
|
2170
|
+
// src/modules/user/create/create.dtos.ts
|
|
2171
|
+
import { z as z28 } from "zod/v4";
|
|
2172
|
+
var createdUserQueryDtoSchema = z28.object({
|
|
2173
|
+
id: userDbSchema.shape.id,
|
|
2174
|
+
username: userDbSchema.shape.username,
|
|
2175
|
+
name: userDbSchema.shape.name,
|
|
2176
|
+
email: userDbSchema.shape.email,
|
|
2177
|
+
gender: userDbSchema.shape.gender,
|
|
2178
|
+
role: userDbSchema.shape.role,
|
|
2179
|
+
createdAt: serializedDateSchema
|
|
2180
|
+
});
|
|
2181
|
+
var createdUserRawQueryDtoSchema = createdUserQueryDtoSchema.omit({
|
|
2182
|
+
createdAt: true
|
|
2183
|
+
}).extend({
|
|
2184
|
+
created_at: serializedDateSchema
|
|
2185
|
+
});
|
|
2186
|
+
var createdUserRowQueryDtoSchema = z28.object({
|
|
2187
|
+
userData: createdUserRawQueryDtoSchema
|
|
2188
|
+
});
|
|
2189
|
+
var userExistsQueryDtoSchema = z28.object({
|
|
2190
|
+
id: userDbSchema.shape.id.nullable()
|
|
2191
|
+
});
|
|
523
2192
|
|
|
524
|
-
// src/modules/user/create/create.
|
|
525
|
-
var
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
});
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
})
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
2193
|
+
// src/modules/user/create/create.contracts.ts
|
|
2194
|
+
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");
|
|
2195
|
+
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");
|
|
2196
|
+
var createUserRequestSchema = z29.object({
|
|
2197
|
+
body: z29.object({
|
|
2198
|
+
username: usernameSchema,
|
|
2199
|
+
fullName: z29.preprocess((value) => value == null || typeof value === "string" && value.trim() === "" ? "User" : value, fullNameSchema),
|
|
2200
|
+
email: userDbSchema.shape.email.trim().toLowerCase().email("Invalid email format"),
|
|
2201
|
+
password: z29.string().min(8, "Password must be at least 8 characters long"),
|
|
2202
|
+
gender: z29.preprocess((value) => value === "" || value == null ? "Unknown" : value, z29.enum([
|
|
2203
|
+
"Male",
|
|
2204
|
+
"Female",
|
|
2205
|
+
"Other",
|
|
2206
|
+
"Unknown"
|
|
2207
|
+
]))
|
|
2208
|
+
})
|
|
2209
|
+
});
|
|
2210
|
+
var createUserUserSchema = createdUserQueryDtoSchema;
|
|
2211
|
+
var createUserResponseSchema = z29.object({
|
|
2212
|
+
message: z29.string(),
|
|
2213
|
+
user: createdUserQueryDtoSchema
|
|
2214
|
+
});
|
|
2215
|
+
var createUserContract = {
|
|
2216
|
+
request: createUserRequestSchema,
|
|
2217
|
+
response: createUserResponseSchema
|
|
2218
|
+
};
|
|
2219
|
+
|
|
2220
|
+
// src/modules/user/push-tokens/push-tokens.contracts.ts
|
|
2221
|
+
import { z as z30 } from "zod/v4";
|
|
2222
|
+
var saveUserPushTokenRequestSchema = z30.object({
|
|
2223
|
+
body: z30.object({
|
|
2224
|
+
token: userDbSchema.shape.pushToken.unwrap()
|
|
2225
|
+
})
|
|
2226
|
+
});
|
|
2227
|
+
var saveUserPushTokenContract = {
|
|
2228
|
+
request: saveUserPushTokenRequestSchema
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
// src/modules/user/update/update.contracts.ts
|
|
2232
|
+
import { z as z31 } from "zod/v4";
|
|
2233
|
+
var updateUserRequestSchema = z31.object({
|
|
2234
|
+
body: authenticatedUserForUpdateQueryDtoSchema
|
|
2235
|
+
});
|
|
2236
|
+
var updateAuthenticatedUserResponseSchema = z31.object({
|
|
2237
|
+
message: z31.string(),
|
|
2238
|
+
emailChanged: z31.boolean(),
|
|
2239
|
+
user: userDataQueryDtoSchema
|
|
2240
|
+
});
|
|
2241
|
+
var updateAuthenticatedUserContract = {
|
|
2242
|
+
request: updateUserRequestSchema,
|
|
2243
|
+
response: updateAuthenticatedUserResponseSchema
|
|
2244
|
+
};
|
|
2245
|
+
var userDataResponseSchema = z31.object({
|
|
2246
|
+
userData: userDataQueryDtoSchema
|
|
2247
|
+
});
|
|
2248
|
+
var userDataContract = {
|
|
2249
|
+
response: userDataResponseSchema
|
|
2250
|
+
};
|
|
2251
|
+
var getAuthenticatedUserByIdResponseSchema = userDataQueryDtoSchema;
|
|
2252
|
+
var getAuthenticatedUserByIdContract = {
|
|
2253
|
+
response: getAuthenticatedUserByIdResponseSchema
|
|
2254
|
+
};
|
|
2255
|
+
var deleteProfilePicRequestSchema = z31.object({
|
|
2256
|
+
body: z31.object({
|
|
2257
|
+
profilePicPath: z31.string()
|
|
2258
|
+
})
|
|
2259
|
+
});
|
|
2260
|
+
var deleteUserProfilePicContract = {
|
|
2261
|
+
request: deleteProfilePicRequestSchema
|
|
2262
|
+
};
|
|
2263
|
+
var setProfilePicAndUpdateDBResponseSchema = z31.object({
|
|
2264
|
+
profilePicPath: z31.string(),
|
|
2265
|
+
url: z31.string(),
|
|
2266
|
+
message: z31.string()
|
|
2267
|
+
});
|
|
2268
|
+
var setProfilePicAndUpdateDBContract = {
|
|
2269
|
+
response: setProfilePicAndUpdateDBResponseSchema
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
// src/modules/video-analysis/video-analysis.contracts.ts
|
|
2273
|
+
import { z as z32 } from "zod/v4";
|
|
2274
|
+
var getPresignedUrlFromS3RequestSchema = z32.object({
|
|
2275
|
+
body: z32.object({
|
|
2276
|
+
exercise: exerciseDbSchema.shape.name,
|
|
2277
|
+
fileType: z32.string(),
|
|
2278
|
+
jobId: z32.string()
|
|
2279
|
+
})
|
|
2280
|
+
});
|
|
2281
|
+
var getPresignedUrlFromS3ResponseSchema = z32.object({
|
|
2282
|
+
uploadUrl: z32.string(),
|
|
2283
|
+
fileKey: z32.string(),
|
|
2284
|
+
requestId: z32.string()
|
|
2285
|
+
});
|
|
2286
|
+
var getPresignedUrlFromS3Contract = {
|
|
2287
|
+
request: getPresignedUrlFromS3RequestSchema,
|
|
2288
|
+
response: getPresignedUrlFromS3ResponseSchema
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
// src/modules/video-analysis/video-analysis.dtos.ts
|
|
2292
|
+
import { z as z33 } from "zod/v4";
|
|
2293
|
+
var enqueueAnalyzeVideoParamsDtoSchema = z33.object({
|
|
2294
|
+
fileKey: z33.string(),
|
|
2295
|
+
exercise: z33.string(),
|
|
2296
|
+
userId: userDbSchema.shape.id,
|
|
2297
|
+
requestId: z33.string(),
|
|
2298
|
+
sentryTrace: z33.string().optional(),
|
|
2299
|
+
baggage: z33.string().optional()
|
|
2300
|
+
});
|
|
2301
|
+
var analyzeVideoPayloadDtoSchema = enqueueAnalyzeVideoParamsDtoSchema.extend({
|
|
2302
|
+
expiresAt: z33.number()
|
|
2303
|
+
});
|
|
2304
|
+
var squatRepetitionDtoSchema = z33.object({
|
|
2305
|
+
depth: z33.object({
|
|
2306
|
+
value: z33.number(),
|
|
2307
|
+
status: z33.string(),
|
|
2308
|
+
confidence: z33.number()
|
|
2309
|
+
}),
|
|
2310
|
+
backLean: z33.object({
|
|
2311
|
+
value: z33.number(),
|
|
2312
|
+
excessive: z33.boolean(),
|
|
2313
|
+
confidence: z33.number()
|
|
2314
|
+
}),
|
|
2315
|
+
audit: z33.object({
|
|
2316
|
+
framesAnalyzed: z33.number(),
|
|
2317
|
+
validFrames: z33.number(),
|
|
2318
|
+
cameraAngle: z33.string(),
|
|
2319
|
+
rawBottomAngle: z33.number(),
|
|
2320
|
+
samplingRate: z33.string()
|
|
2321
|
+
})
|
|
2322
|
+
});
|
|
2323
|
+
var analyzeVideoResultPayloadDtoSchema = /* @__PURE__ */ __name((resultSchema) => z33.intersection(z33.object({
|
|
2324
|
+
jobId: z33.string(),
|
|
2325
|
+
userId: userDbSchema.shape.id,
|
|
2326
|
+
exercise: z33.string(),
|
|
2327
|
+
requestId: z33.string().optional()
|
|
2328
|
+
}), z33.discriminatedUnion("status", [
|
|
2329
|
+
z33.object({
|
|
2330
|
+
status: z33.literal("completed"),
|
|
2331
|
+
result: z33.array(resultSchema),
|
|
2332
|
+
error: z33.null()
|
|
2333
|
+
}),
|
|
2334
|
+
z33.object({
|
|
2335
|
+
status: z33.literal("failed"),
|
|
2336
|
+
result: z33.null(),
|
|
2337
|
+
error: z33.string()
|
|
2338
|
+
})
|
|
2339
|
+
])), "analyzeVideoResultPayloadDtoSchema");
|
|
2340
|
+
|
|
2341
|
+
// src/modules/web-sockets/web-sockets.contracts.ts
|
|
2342
|
+
import { z as z34 } from "zod/v4";
|
|
2343
|
+
var generateTicketRequestSchema = z34.object({
|
|
2344
|
+
body: z34.object({
|
|
2345
|
+
username: userDbSchema.shape.username
|
|
2346
|
+
})
|
|
2347
|
+
});
|
|
2348
|
+
var generateTicketResponseSchema = z34.object({
|
|
2349
|
+
ticket: z34.string()
|
|
2350
|
+
});
|
|
2351
|
+
var generateTicketContract = {
|
|
2352
|
+
request: generateTicketRequestSchema,
|
|
2353
|
+
response: generateTicketResponseSchema
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
// src/modules/workout/tracking/tracking.contracts.ts
|
|
2357
|
+
import { z as z35 } from "zod/v4";
|
|
2358
|
+
var getExerciseTrackingRequestSchema = z35.object({
|
|
2359
|
+
query: z35.object({
|
|
2360
|
+
tz: z35.string().optional()
|
|
2361
|
+
})
|
|
2362
|
+
});
|
|
2363
|
+
var getExerciseTrackingResponseSchema = exerciseTrackingAndStatsQueryDtoSchema;
|
|
2364
|
+
var getExerciseTrackingContract = {
|
|
2365
|
+
request: getExerciseTrackingRequestSchema,
|
|
2366
|
+
response: getExerciseTrackingResponseSchema
|
|
2367
|
+
};
|
|
2368
|
+
var finishWorkoutRequestSchema = z35.object({
|
|
2369
|
+
body: z35.object({
|
|
2370
|
+
workout: z35.array(finishedWorkoutEntryQueryDtoSchema),
|
|
2371
|
+
tz: z35.string().optional(),
|
|
2372
|
+
workoutStartUtc: z35.string().datetime("workoutStartUtc must be a valid ISO datetime"),
|
|
2373
|
+
workoutEndUtc: z35.string().datetime("workoutEndUtc must be a valid ISO datetime").optional().nullable()
|
|
2374
|
+
})
|
|
2375
|
+
});
|
|
2376
|
+
var finishUserWorkoutResponseSchema = exerciseTrackingAndStatsQueryDtoSchema;
|
|
2377
|
+
var finishUserWorkoutContract = {
|
|
2378
|
+
request: finishWorkoutRequestSchema,
|
|
2379
|
+
response: finishUserWorkoutResponseSchema
|
|
2380
|
+
};
|
|
2381
|
+
export {
|
|
2382
|
+
accessTokenPayloadDtoSchema,
|
|
2383
|
+
addAerobicInputQueryDtoSchema,
|
|
2384
|
+
addAerobicsRequestSchema,
|
|
2385
|
+
addUserAerobicsContract,
|
|
2386
|
+
addWorkoutContract,
|
|
2387
|
+
addWorkoutRequestSchema,
|
|
597
2388
|
addWorkoutResponseSchema,
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
2389
|
+
addWorkoutSplitPayloadQueryDtoSchema,
|
|
2390
|
+
adherenceExerciseStatsQueryDtoSchema,
|
|
2391
|
+
aerobicTrackingDbSchema,
|
|
2392
|
+
aerobicsDailyRecordQueryDtoSchema,
|
|
2393
|
+
aerobicsWeeklyRecordQueryDtoSchema,
|
|
2394
|
+
allUserMessageQueryDtoSchema,
|
|
2395
|
+
analyzeVideoPayloadDtoSchema,
|
|
2396
|
+
analyzeVideoResultPayloadDtoSchema,
|
|
2397
|
+
appleOAuthContract,
|
|
2398
|
+
appleOAuthRequestSchema,
|
|
2399
|
+
appleTokenVerificationResultDtoSchema,
|
|
2400
|
+
authenticatedUserForUpdateQueryDtoSchema,
|
|
2401
|
+
bootstrapContract,
|
|
2402
|
+
bootstrapRequestSchema,
|
|
604
2403
|
bootstrapResponseSchema,
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
2404
|
+
changeEmailAndVerifyContract,
|
|
2405
|
+
changeEmailAndVerifyRequestSchema,
|
|
2406
|
+
changeEmailTokenPayloadDtoSchema,
|
|
2407
|
+
checkUserVerifyContract,
|
|
2408
|
+
checkUserVerifyRequestSchema,
|
|
2409
|
+
createUserContract,
|
|
2410
|
+
createUserRequestSchema,
|
|
608
2411
|
createUserResponseSchema,
|
|
609
2412
|
createUserUserSchema,
|
|
610
|
-
|
|
2413
|
+
createdUserQueryDtoSchema,
|
|
2414
|
+
createdUserRawQueryDtoSchema,
|
|
2415
|
+
createdUserRowQueryDtoSchema,
|
|
2416
|
+
deleteMessageContract,
|
|
2417
|
+
deleteMessageRequestSchema,
|
|
611
2418
|
deleteMessageResponseSchema,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
2419
|
+
deleteProfilePicRequestSchema,
|
|
2420
|
+
deleteUserProfilePicContract,
|
|
2421
|
+
deletedMessageQueryDtoSchema,
|
|
2422
|
+
emailVerifyPayloadDtoSchema,
|
|
2423
|
+
enqueueAnalyzeVideoParamsDtoSchema,
|
|
2424
|
+
exerciseAssignmentIdQueryDtoSchema,
|
|
2425
|
+
exerciseDbSchema,
|
|
2426
|
+
exerciseInPlanQueryDtoSchema,
|
|
2427
|
+
exerciseMapByMuscleRowQueryDtoSchema,
|
|
2428
|
+
exerciseMetadataQueryDtoSchema,
|
|
2429
|
+
exerciseToWorkoutSplitDbSchema,
|
|
2430
|
+
exerciseToWorkoutSplitExpandedViewDbSchema,
|
|
2431
|
+
exerciseTrackingAnalysisQueryDtoSchema,
|
|
2432
|
+
exerciseTrackingAndStatsQueryDtoSchema,
|
|
2433
|
+
exerciseTrackingAndStatsRowQueryDtoSchema,
|
|
2434
|
+
exerciseTrackingDbSchema,
|
|
2435
|
+
exerciseTrackingExpandedViewDbSchema,
|
|
2436
|
+
exerciseTrackingIdQueryDtoSchema,
|
|
2437
|
+
exerciseTrackingPrMaxQueryDtoSchema,
|
|
2438
|
+
exercisesMapByMuscleQueryDtoSchema,
|
|
2439
|
+
finishUserWorkoutContract,
|
|
619
2440
|
finishUserWorkoutResponseSchema,
|
|
620
|
-
|
|
621
|
-
|
|
2441
|
+
finishWorkoutRequestSchema,
|
|
2442
|
+
finishedWorkoutEntryQueryDtoSchema,
|
|
2443
|
+
forgotPasswordPayloadDtoSchema,
|
|
2444
|
+
generateTicketContract,
|
|
2445
|
+
generateTicketRequestSchema,
|
|
622
2446
|
generateTicketResponseSchema,
|
|
623
|
-
|
|
2447
|
+
getAerobicsRequestSchema,
|
|
2448
|
+
getAllExercisesContract,
|
|
2449
|
+
getAllExercisesExerciseQueryDtoSchema,
|
|
624
2450
|
getAllExercisesResponseSchema,
|
|
625
|
-
|
|
2451
|
+
getAllMessagesRequestSchema,
|
|
2452
|
+
getAllUserMessagesContract,
|
|
626
2453
|
getAllUserMessagesResponseSchema,
|
|
2454
|
+
getAnalyticsContract,
|
|
627
2455
|
getAnalyticsResponseSchema,
|
|
2456
|
+
getAuthenticatedUserByIdContract,
|
|
628
2457
|
getAuthenticatedUserByIdResponseSchema,
|
|
629
|
-
|
|
2458
|
+
getExerciseTrackingContract,
|
|
2459
|
+
getExerciseTrackingRequestSchema,
|
|
630
2460
|
getExerciseTrackingResponseSchema,
|
|
2461
|
+
getPresignedUrlFromS3Contract,
|
|
2462
|
+
getPresignedUrlFromS3RequestSchema,
|
|
631
2463
|
getPresignedUrlFromS3ResponseSchema,
|
|
632
|
-
|
|
2464
|
+
getUserAerobicsContract,
|
|
2465
|
+
getWholeUserWorkoutPlanContract,
|
|
633
2466
|
getWholeUserWorkoutPlanResponseSchema,
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
2467
|
+
getWholeWorkoutPlanRequestSchema,
|
|
2468
|
+
goalAdherenceQueryDtoSchema,
|
|
2469
|
+
goalAdherenceRowQueryDtoSchema,
|
|
2470
|
+
googleOAuthContract,
|
|
2471
|
+
googleOAuthRequestSchema,
|
|
2472
|
+
googleTokenVerificationResultDtoSchema,
|
|
2473
|
+
lastLoginQueryDtoSchema,
|
|
2474
|
+
loginContract,
|
|
2475
|
+
loginRequestSchema,
|
|
637
2476
|
loginResponseSchema,
|
|
2477
|
+
logoutContract,
|
|
638
2478
|
logoutResponseSchema,
|
|
639
|
-
|
|
2479
|
+
markMessageAsReadContract,
|
|
2480
|
+
markMessageAsReadRequestSchema,
|
|
640
2481
|
markMessageAsReadResponseSchema,
|
|
641
|
-
|
|
2482
|
+
messageAfterSendQueryDtoSchema,
|
|
2483
|
+
messageAsReadQueryDtoSchema,
|
|
2484
|
+
messageDbSchema,
|
|
2485
|
+
oAuthCreatedUserRowQueryDtoSchema,
|
|
2486
|
+
oAuthLinkQueryDtoSchema,
|
|
2487
|
+
oAuthLinkRowQueryDtoSchema,
|
|
2488
|
+
oAuthLoginContract,
|
|
642
2489
|
oAuthLoginResponseSchema,
|
|
2490
|
+
oAuthLookupQueryDtoSchema,
|
|
2491
|
+
oAuthLookupRawQueryDtoSchema,
|
|
2492
|
+
oAuthLookupRowQueryDtoSchema,
|
|
2493
|
+
oauthAccountDbSchema,
|
|
643
2494
|
proceedLoginResponseSchema,
|
|
2495
|
+
prsViewDbSchema,
|
|
2496
|
+
refreshTokenContract,
|
|
644
2497
|
refreshTokenResponseSchema,
|
|
645
|
-
|
|
2498
|
+
resetPasswordContract,
|
|
2499
|
+
resetPasswordRequestSchema,
|
|
646
2500
|
resetPasswordResponseSchema,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
2501
|
+
saveUserPushTokenContract,
|
|
2502
|
+
saveUserPushTokenRequestSchema,
|
|
2503
|
+
sendChangePassEmailContract,
|
|
2504
|
+
sendChangePassEmailRequestSchema,
|
|
2505
|
+
sendVerificationMailContract,
|
|
2506
|
+
sendVerificationMailRequestSchema,
|
|
2507
|
+
serializedDateSchema,
|
|
2508
|
+
setProfilePicAndUpdateDBContract,
|
|
650
2509
|
setProfilePicAndUpdateDBResponseSchema,
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
2510
|
+
squatRepetitionDtoSchema,
|
|
2511
|
+
timezoneSchema,
|
|
2512
|
+
tokenVersionQueryDtoSchema,
|
|
2513
|
+
trackingByDateItemQueryDtoSchema,
|
|
2514
|
+
trackingBySplitNameItemQueryDtoSchema,
|
|
2515
|
+
trackingMapItemQueryDtoSchema,
|
|
2516
|
+
trackingSetDbSchema,
|
|
2517
|
+
updateAuthenticatedUserContract,
|
|
654
2518
|
updateAuthenticatedUserResponseSchema,
|
|
655
|
-
|
|
2519
|
+
updateUserRequestSchema,
|
|
2520
|
+
userAerobicsQueryDtoSchema,
|
|
656
2521
|
userAerobicsResponseSchema,
|
|
2522
|
+
userAerobicsRowQueryDtoSchema,
|
|
2523
|
+
userAfterBumpQueryDtoSchema,
|
|
2524
|
+
userByIdentifierQueryDtoSchema,
|
|
2525
|
+
userByIdentifierRawQueryDtoSchema,
|
|
2526
|
+
userByIdentifierRowQueryDtoSchema,
|
|
2527
|
+
userByUsernameRawQueryDtoSchema,
|
|
2528
|
+
userByUsernameRowQueryDtoSchema,
|
|
2529
|
+
userConflictQueryDtoSchema,
|
|
2530
|
+
userDataContract,
|
|
2531
|
+
userDataQueryDtoSchema,
|
|
657
2532
|
userDataResponseSchema,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
2533
|
+
userDataRowQueryDtoSchema,
|
|
2534
|
+
userDbSchema,
|
|
2535
|
+
userExistsQueryDtoSchema,
|
|
2536
|
+
userInsertDbSchema,
|
|
2537
|
+
userMessageIdentityQueryDtoSchema,
|
|
2538
|
+
userProfilePicQueryDtoSchema,
|
|
2539
|
+
userReminderSettingDbSchema,
|
|
2540
|
+
userSplitInformationDbSchema,
|
|
2541
|
+
userToHourlyReminderQueryDtoSchema,
|
|
2542
|
+
userUpdateDbSchema,
|
|
2543
|
+
userWithNotificationsEnabledQueryDtoSchema,
|
|
2544
|
+
verifyAccountRequestSchema,
|
|
2545
|
+
verifyUserAccountContract,
|
|
2546
|
+
weeklyDataQueryDtoSchema,
|
|
2547
|
+
wholeUserWorkoutPlanQueryDtoSchema,
|
|
2548
|
+
workoutExerciseInputQueryDtoSchema,
|
|
2549
|
+
workoutExerciseMetadataQueryDtoSchema,
|
|
2550
|
+
workoutPlanDbSchema,
|
|
2551
|
+
workoutPlanIdQueryDtoSchema,
|
|
2552
|
+
workoutRmRecordQueryDtoSchema,
|
|
2553
|
+
workoutRmsQueryDtoSchema,
|
|
2554
|
+
workoutRmsRowQueryDtoSchema,
|
|
2555
|
+
workoutSetDbSchema,
|
|
2556
|
+
workoutSplitDbSchema,
|
|
2557
|
+
workoutSplitIdQueryDtoSchema,
|
|
2558
|
+
workoutSplitLookupQueryDtoSchema,
|
|
2559
|
+
workoutSplitQueryDtoSchema,
|
|
2560
|
+
workoutSplitsMapItemQueryDtoSchema,
|
|
2561
|
+
workoutSplitsMapQueryDtoSchema,
|
|
2562
|
+
workoutSplitsRowQueryDtoSchema,
|
|
2563
|
+
workoutSummaryDbSchema,
|
|
2564
|
+
workoutSummaryIdQueryDtoSchema
|
|
2565
|
+
};
|