@virtality/schema 0.0.1-alpha.0.6 → 0.0.1-alpha.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtality/schema",
3
- "version": "0.0.1-alpha.0.6",
3
+ "version": "0.0.1-alpha.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,54 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `phone` on the `User` table. All the data in the column will be lost.
5
+
6
+ */
7
+ -- AlterTable
8
+ ALTER TABLE "Patient" ADD COLUMN "occupation" TEXT;
9
+
10
+ -- AlterTable
11
+ ALTER TABLE "ProgramExercise" ALTER COLUMN "restTime" SET DEFAULT 5;
12
+
13
+ -- AlterTable
14
+ ALTER TABLE "User" DROP COLUMN "phone",
15
+ ADD COLUMN "phoneNumber" TEXT,
16
+ ADD COLUMN "phoneNumberVerified" BOOLEAN;
17
+
18
+ -- CreateTable
19
+ CREATE TABLE "Preset" (
20
+ "id" TEXT NOT NULL,
21
+ "userId" TEXT,
22
+ "name" TEXT NOT NULL,
23
+ "pathology" TEXT NOT NULL,
24
+ "start" INTEGER,
25
+ "end" INTEGER,
26
+ "createdAt" TIMESTAMP(6) NOT NULL,
27
+ "updatedAt" TIMESTAMP(6) NOT NULL,
28
+ "deletedAt" TIMESTAMP(6),
29
+
30
+ CONSTRAINT "Preset_pkey" PRIMARY KEY ("id")
31
+ );
32
+
33
+ -- CreateTable
34
+ CREATE TABLE "PresetExercise" (
35
+ "id" TEXT NOT NULL,
36
+ "presetId" TEXT NOT NULL,
37
+ "exerciseId" TEXT NOT NULL,
38
+ "sets" INTEGER NOT NULL DEFAULT 3,
39
+ "reps" INTEGER NOT NULL DEFAULT 10,
40
+ "restTime" INTEGER NOT NULL DEFAULT 5,
41
+ "holdTime" INTEGER NOT NULL DEFAULT 1,
42
+ "speed" DOUBLE PRECISION NOT NULL DEFAULT 1,
43
+
44
+ CONSTRAINT "PresetExercise_pkey" PRIMARY KEY ("id")
45
+ );
46
+
47
+ -- AddForeignKey
48
+ ALTER TABLE "Preset" ADD CONSTRAINT "Preset_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
49
+
50
+ -- AddForeignKey
51
+ ALTER TABLE "PresetExercise" ADD CONSTRAINT "PresetExercise_exerciseId_fkey" FOREIGN KEY ("exerciseId") REFERENCES "Exercise"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
52
+
53
+ -- AddForeignKey
54
+ ALTER TABLE "PresetExercise" ADD CONSTRAINT "PresetExercise_presetId_fkey" FOREIGN KEY ("presetId") REFERENCES "Preset"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -26,26 +26,28 @@ model Account {
26
26
  }
27
27
 
28
28
  model User {
29
- id String @id(map: "user_pkey")
30
- name String
31
- email String @unique(map: "user_email_key")
32
- emailVerified Boolean
33
- image String? @unique
34
- createdAt DateTime @db.Timestamp(6)
35
- updatedAt DateTime @db.Timestamp(6)
36
- deletedAt DateTime? @db.Timestamp(6)
37
- phone String?
38
- stripeCustomerId String?
39
- banExpires DateTime?
40
- banReason String?
41
- banned Boolean?
42
- role String? @default("user")
43
- accounts Account[]
44
- devices Device[]
45
- invitations Invitation[]
46
- members Member[]
47
- patientProgram PatientProgram[]
48
- sessions Session[]
29
+ id String @id(map: "user_pkey")
30
+ name String
31
+ email String @unique(map: "user_email_key")
32
+ emailVerified Boolean
33
+ image String? @unique
34
+ createdAt DateTime @db.Timestamp(6)
35
+ updatedAt DateTime @db.Timestamp(6)
36
+ deletedAt DateTime? @db.Timestamp(6)
37
+ phoneNumber String?
38
+ phoneNumberVerified Boolean?
39
+ stripeCustomerId String?
40
+ banExpires DateTime?
41
+ banReason String?
42
+ banned Boolean?
43
+ role String? @default("user")
44
+ accounts Account[]
45
+ devices Device[]
46
+ invitations Invitation[]
47
+ members Member[]
48
+ patientProgram PatientProgram[]
49
+ sessions Session[]
50
+ userPreset Preset[]
49
51
  }
50
52
 
51
53
  model Session {
@@ -146,6 +148,7 @@ model Exercise {
146
148
  isNew Boolean @default(false)
147
149
  programExercise ProgramExercise[]
148
150
  sessionExercise SessionExercise[]
151
+ PresetExercise PresetExercise[]
149
152
  }
150
153
 
151
154
  model Patient {
@@ -159,6 +162,7 @@ model Patient {
159
162
  weight String?
160
163
  height String?
161
164
  history String?
165
+ occupation String?
162
166
  language Language @default(Greek)
163
167
  image String? @unique
164
168
  createdAt DateTime @default(now()) @db.Timestamp(6)
@@ -167,6 +171,33 @@ model Patient {
167
171
  patientProgram PatientProgram[]
168
172
  }
169
173
 
174
+ model Preset {
175
+ id String @id
176
+ userId String?
177
+ name String
178
+ pathology String
179
+ start Int?
180
+ end Int?
181
+ createdAt DateTime @db.Timestamp(6)
182
+ updatedAt DateTime @db.Timestamp(6)
183
+ deletedAt DateTime? @db.Timestamp(6)
184
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
185
+ presetExercise PresetExercise[]
186
+ }
187
+
188
+ model PresetExercise {
189
+ id String @id
190
+ presetId String
191
+ exerciseId String
192
+ sets Int @default(3)
193
+ reps Int @default(10)
194
+ restTime Int @default(5)
195
+ holdTime Int @default(1)
196
+ speed Float @default(1)
197
+ exercise Exercise @relation(fields: [exerciseId], references: [id])
198
+ preset Preset @relation(fields: [presetId], references: [id], onDelete: Cascade)
199
+ }
200
+
170
201
  model PatientProgram {
171
202
  id String @id(map: "patient_program_pkey")
172
203
  name String
@@ -184,7 +215,7 @@ model ProgramExercise {
184
215
  exerciseId String
185
216
  sets Int @default(3)
186
217
  reps Int @default(10)
187
- restTime Int @default(30)
218
+ restTime Int @default(5)
188
219
  holdTime Int @default(1)
189
220
  speed Float @default(1)
190
221
  exercise Exercise @relation(fields: [exerciseId], references: [id])