Add types throughout the DescriptorSystem.

Commit
0db7c66f0ca92dfa9f0d169dbc68d0c47fc96fa4
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
src/MyFitnessTracker-Database/MFTDescriptorSystem.class.st
index fcd0be56..40733cb8 100644..100644
@@ -8,14 +8,20 @@
8 8 #package : 'MyFitnessTracker-Database'
9 9 }
10 10
11 Added: { #category : 'as yet unclassified' }
12 Added: MFTDescriptorSystem class >> defaultDatabaseName [
13 Added:
14 Added: ^ 'mft.sqlite3'
15 Added: ]
16 Added:
11 17 { #category : 'class models' }
12 18 MFTDescriptorSystem >> classModelForMFTExercise: aClassModel [
13 19
14 20 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
15 21 aClassModel
16 Removed: newAttributeNamed: #englishName;
17 Removed: newAttributeNamed: #frenchName;
18 Removed: newAttributeNamed: #primaryMuscleGroup
22 Added: newAttributeNamed: #englishName type: String;
23 Added: newAttributeNamed: #frenchName type: String;
24 Added: newAttributeNamed: #primaryMuscleGroup type: MFTMuscleGroup
19 25 ]
20 26
21 27 { #category : 'class models' }
@@ -23,10 +29,10 @@
23 29
24 30 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
25 31 aClassModel
26 Removed: newAttributeNamed: #primaryMuscleGroupId;
27 Removed: newAttributeNamed: #latinName;
28 Removed: newAttributeNamed: #englishName;
29 Removed: newAttributeNamed: #function
32 Added: newAttributeNamed: #primaryMuscleGroup type: MFTMuscleGroup;
33 Added: newAttributeNamed: #latinName type: String;
34 Added: newAttributeNamed: #englishName type: String;
35 Added: newAttributeNamed: #function type: String
30 36 ]
31 37
32 38 { #category : 'class models' }
@@ -34,9 +40,9 @@
34 40
35 41 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
36 42 aClassModel
37 Removed: newAttributeNamed: #englishName;
38 Removed: newAttributeNamed: #frenchName;
39 Removed: newAttributeNamed: #function;
43 Added: newAttributeNamed: #englishName type: String;
44 Added: newAttributeNamed: #frenchName type: String;
45 Added: newAttributeNamed: #function type: String;
40 46 newAttributeNamed: #muscles collectionOf: MFTMuscle
41 47 ]
42 48
@@ -45,13 +51,13 @@
45 51
46 52 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
47 53 aClassModel
48 Removed: newAttributeNamed: #exerciseId;
49 Removed: newAttributeNamed: #number;
50 Removed: newAttributeNamed: #groupId;
51 Removed: newAttributeNamed: #reps;
52 Removed: newAttributeNamed: #load;
53 Removed: newAttributeNamed: #rpe;
54 Removed: newAttributeNamed: #restAfter
54 Added: newAttributeNamed: #exercise type: MFTExercise;
55 Added: newAttributeNamed: #setNumber type: Integer;
56 Added: newAttributeNamed: #setGroup type: Integer;
57 Added: newAttributeNamed: #reps type: Integer;
58 Added: newAttributeNamed: #load type: Float;
59 Added: newAttributeNamed: #rpe type: Integer;
60 Added: newAttributeNamed: #restAfter type: Float
55 61 ]
56 62
57 63 { #category : 'class models' }
@@ -63,10 +69,10 @@
63 69 newAttributeNamed: #passwordHash type: String;
64 70 newAttributeNamed: #realFirstName type: String;
65 71 newAttributeNamed: #realLastName type: String;
66 Removed: newAttributeNamed: #dateOfBirth;
67 Removed: newAttributeNamed: #isLoggedIn;
68 Removed: newAttributeNamed: #lastLoginDateAndTime;
69 Removed: newAttributeNamed: #accountRegisterDateAndTime;
72 Added: newAttributeNamed: #dateOfBirth type: Date;
73 Added: newAttributeNamed: #isLoggedIn type: Boolean;
74 Added: newAttributeNamed: #lastLoginDateAndTime type: DateAndTime;
75 Added: newAttributeNamed: #accountRegisterDateAndTime type: DateAndTime;
70 76 newAttributeNamed: #workouts collectionOf: MFTWorkout;
71 77 newAttributeNamed: #weights collectionOf: MFTWeight
72 78 ]
@@ -76,9 +82,9 @@
76 82
77 83 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
78 84 aClassModel
79 Removed: newAttributeNamed: #userId;
80 Removed: newAttributeNamed: #date;
81 Removed: newAttributeNamed: #kilograms
85 Added: newAttributeNamed: #user type: MFTUser;
86 Added: newAttributeNamed: #date type: Date;
87 Added: newAttributeNamed: #kilograms type: Integer
82 88 ]
83 89
84 90 { #category : 'class models' }
@@ -86,13 +92,13 @@
86 92
87 93 (aClassModel newAttributeNamed: #id) useDirectAccess: true.
88 94 aClassModel
89 Removed: newAttributeNamed: #userId;
90 Removed: newAttributeNamed: #date;
91 Removed: newAttributeNamed: #primaryMuscleGroupId;
92 Removed: newAttributeNamed: #secondaryMuscleGroupIds
95 Added: newAttributeNamed: #user type: MFTUser;
96 Added: newAttributeNamed: #date type: DateAndTime;
97 Added: newAttributeNamed: #primaryMuscleGroup type: MFTMuscleGroup;
98 Added: newAttributeNamed: #secondaryMuscleGroups
93 99 collectionOf: MFTMuscleGroup;
94 100 newAttributeNamed: #setGroups collectionOf: MFTSetGroup;
95 Removed: newAttributeNamed: #restAfter
101 Added: newAttributeNamed: #restAfter type: Float
96 102 ]
97 103
98 104 { #category : 'class models' }
@@ -121,8 +127,8 @@
121 127 aDescriptor table: table.
122 128 aDescriptor directMappingFor: #id.
123 129 (aDescriptor newMapping: DirectMapping)
124 Removed: from: #primaryMuscleGroupId
125 Removed: to: ((self tableNamed:'MUSCLEGROUP') fieldNamed: 'id').
130 Added: from: #primaryMuscleGroup
131 Added: to: ((self tableNamed: 'MUSCLEGROUP') fieldNamed: 'id').
126 132 (aDescriptor newMapping: DirectMapping)
127 133 from: #latinName
128 134 to: (table fieldNamed: 'latinName').
@@ -150,14 +156,14 @@
150 156 MFTDescriptorSystem >> descriptorForMFTSet: aDescriptor [
151 157
152 158 | table |
153 Removed: table := self tableNamed: 'SET'.
159 Added: table := self tableNamed: 'WORKOUTSET'.
154 160 aDescriptor table: table.
155 161 aDescriptor directMappingFor: #id.
156 162 (aDescriptor newMapping: DirectMapping)
157 Removed: from: #exerciseId
158 Removed: to: (table fieldNamed: 'Id').
159 Removed: aDescriptor directMappingFor: #number.
160 Removed: aDescriptor directMappingFor: #group.
163 Added: from: #exercise
164 Added: to: ((self tableNamed: 'EXERCISE') fieldNamed: 'id').
165 Added: aDescriptor directMappingFor: #setNumber.
166 Added: aDescriptor directMappingFor: #setGroup.
161 167 aDescriptor directMappingFor: #reps.
162 168 aDescriptor directMappingFor: #load.
163 169 aDescriptor directMappingFor: #rpe.
@@ -171,7 +177,9 @@
171 177 table := self tableNamed: 'WEIGHT'.
172 178 aDescriptor table: table.
173 179 aDescriptor directMappingFor: #id.
174 Removed: (aDescriptor newMapping: OneToOneMapping) attributeName: #userId.
180 Added: (aDescriptor newMapping: DirectMapping)
181 Added: from: #user
182 Added: to: ((self tableNamed: 'USER') fieldNamed: 'id').
175 183 aDescriptor directMappingFor: #date.
176 184 aDescriptor directMappingFor: #kilograms
177 185 ]
@@ -183,12 +191,15 @@
183 191 table := self tableNamed: 'WORKOUT'.
184 192 aDescriptor table: table.
185 193 aDescriptor directMappingFor: #id.
186 Removed: (aDescriptor newMapping: OneToOneMapping) attributeName: #user.
194 Added: (aDescriptor newMapping: DirectMapping)
195 Added: from: #user
196 Added: to: ((self tableNamed: 'USER') fieldNamed: 'id').
187 197 aDescriptor directMappingFor: #date.
188 Removed: (aDescriptor newMapping: OneToOneMapping) attributeName:
189 Removed: #primaryMuscleGroup.
190 Removed:
191 Removed: aDescriptor newMapping: ManyToManyMapping
198 Added: (aDescriptor newMapping: DirectMapping)
199 Added: from: #primaryMuscleGroup
200 Added: to: ((self tableNamed: 'MUSCLEGROUP') fieldNamed: 'id').
201 Added: (aDescriptor newMapping: ManyToManyMapping) attributeName:
202 Added: #secondaryMuscleGroups
192 203 ]
193 204
194 205 { #category : 'tables' }
@@ -235,32 +246,6 @@
235 246 ]
236 247
237 248 { #category : 'tables' }
238 Removed: MFTDescriptorSystem >> tableForSET: aTable [
239 Removed:
240 Removed: | workoutField exerciseField |
241 Removed: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
242 Removed: workoutField := aTable
243 Removed: createFieldNamed: 'workoutId'
244 Removed: type: platform integer.
245 Removed: exerciseField := aTable
246 Removed: createFieldNamed: 'exerciseId'
247 Removed: type: platform integer.
248 Removed: aTable createFieldNamed: 'group' type: platform integer.
249 Removed: aTable createFieldNamed: 'number' type: platform integer.
250 Removed: aTable createFieldNamed: 'reps' type: platform integer.
251 Removed: aTable createFieldNamed: 'load' type: platform integer.
252 Removed: aTable createFieldNamed: 'rpe' type: platform integer.
253 Removed: aTable createFieldNamed: 'restAfter' type: platform float4.
254 Removed:
255 Removed: aTable
256 Removed: addForeignKeyFrom: workoutField
257 Removed: to: ((self tableNamed: 'WORKOUT') fieldNamed: 'id').
258 Removed: aTable
259 Removed: addForeignKeyFrom: exerciseField
260 Removed: to: ((self tableNamed: 'EXERCISE') fieldNamed: 'id')
261 Removed: ]
262 Removed:
263 Removed: { #category : 'tables' }
264 249 MFTDescriptorSystem >> tableForUSER: aTable [
265 250
266 251 (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
@@ -303,6 +288,32 @@
303 288 aTable
304 289 addForeignKeyFrom: userField
305 290 to: ((self tableNamed: 'USER') fieldNamed: 'id')
291 Added: ]
292 Added:
293 Added: { #category : 'tables' }
294 Added: MFTDescriptorSystem >> tableForWORKOUTSET: aTable [
295 Added:
296 Added: | workoutField exerciseField |
297 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
298 Added: workoutField := aTable
299 Added: createFieldNamed: 'workoutId'
300 Added: type: platform integer.
301 Added: exerciseField := aTable
302 Added: createFieldNamed: 'exerciseId'
303 Added: type: platform integer.
304 Added: aTable createFieldNamed: 'setGroup' type: platform integer.
305 Added: aTable createFieldNamed: 'setNumber' type: platform integer.
306 Added: aTable createFieldNamed: 'reps' type: platform integer.
307 Added: aTable createFieldNamed: 'load' type: platform integer.
308 Added: aTable createFieldNamed: 'rpe' type: platform integer.
309 Added: aTable createFieldNamed: 'restAfter' type: platform float4.
310 Added:
311 Added: aTable
312 Added: addForeignKeyFrom: workoutField
313 Added: to: ((self tableNamed: 'WORKOUT') fieldNamed: 'id').
314 Added: aTable
315 Added: addForeignKeyFrom: exerciseField
316 Added: to: ((self tableNamed: 'EXERCISE') fieldNamed: 'id')
306 317 ]
307 318
308 319 { #category : 'as yet unclassified' }
src/MyFitnessTracker-Database/ManifestMyFitnessTrackerDatabase.class.st
index 6a5efae0..00000000 100644..000000
@@ -1,10 +0,0 @@
1 Removed: "
2 Removed: Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
3 Removed: "
4 Removed: Class {
5 Removed: #name : 'ManifestMyFitnessTrackerDatabase',
6 Removed: #superclass : 'PackageManifest',
7 Removed: #category : 'MyFitnessTracker-Database-Manifest',
8 Removed: #package : 'MyFitnessTracker-Database',
9 Removed: #tag : 'Manifest'
10 Removed: }