Add descriptor system for MFT.

Commit
4a56a2feff30c90d86c79ffb722b1174174d6c9d
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
src/MyFitnessTracker-Glorp/MFTDescriptorSystem.class.st
index 00000000..2e102ac1 000000..100644
@@ -0,0 +1,340 @@
1 Added: Class {
2 Added: #name : 'MFTDescriptorSystem',
3 Added: #superclass : 'DescriptorSystem',
4 Added: #category : 'MyFitnessTracker-Glorp',
5 Added: #package : 'MyFitnessTracker-Glorp'
6 Added: }
7 Added:
8 Added: { #category : 'class models' }
9 Added: MFTDescriptorSystem >> classModelForMFTExercise: aClassModel [
10 Added:
11 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
12 Added: aClassModel
13 Added: newAttributeNamed: #englishName;
14 Added: newAttributeNamed: #frenchName;
15 Added: newAttributeNamed: #primaryMuscleGroup
16 Added: ]
17 Added:
18 Added: { #category : 'class models' }
19 Added: MFTDescriptorSystem >> classModelForMFTMuscle: aClassModel [
20 Added:
21 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
22 Added: aClassModel
23 Added: newAttributeNamed: #primaryMuscleGroupId;
24 Added: newAttributeNamed: #latinName;
25 Added: newAttributeNamed: #englishName;
26 Added: newAttributeNamed: #function
27 Added: ]
28 Added:
29 Added: { #category : 'class models' }
30 Added: MFTDescriptorSystem >> classModelForMFTMuscleGroup: aClassModel [
31 Added:
32 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
33 Added: aClassModel
34 Added: newAttributeNamed: #englishName;
35 Added: newAttributeNamed: #frenchName;
36 Added: newAttributeNamed: #function;
37 Added: newAttributeNamed: #muscles collectionOf: MFTMuscle
38 Added: ]
39 Added:
40 Added: { #category : 'class models' }
41 Added: MFTDescriptorSystem >> classModelForMFTSet: aClassModel [
42 Added:
43 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
44 Added: aClassModel
45 Added: newAttributeNamed: #exerciseId;
46 Added: newAttributeNamed: #number;
47 Added: newAttributeNamed: #groupId;
48 Added: newAttributeNamed: #reps;
49 Added: newAttributeNamed: #load;
50 Added: newAttributeNamed: #rpe;
51 Added: newAttributeNamed: #restAfter
52 Added: ]
53 Added:
54 Added: { #category : 'class models' }
55 Added: MFTDescriptorSystem >> classModelForMFTUser: aClassModel [
56 Added:
57 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
58 Added: aClassModel
59 Added: newAttributeNamed: #username type: String;
60 Added: newAttributeNamed: #passwordHash type: String;
61 Added: newAttributeNamed: #realFirstName type: String;
62 Added: newAttributeNamed: #realLastName type: String;
63 Added: newAttributeNamed: #dateOfBirth;
64 Added: newAttributeNamed: #isLoggedIn;
65 Added: newAttributeNamed: #lastLoginDateAndTime;
66 Added: newAttributeNamed: #accountRegisterDateAndTime;
67 Added: newAttributeNamed: #workouts collectionOf: MFTWorkout;
68 Added: newAttributeNamed: #weights collectionOf: MFTWeight
69 Added: ]
70 Added:
71 Added: { #category : 'class models' }
72 Added: MFTDescriptorSystem >> classModelForMFTWeight: aClassModel [
73 Added:
74 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
75 Added: aClassModel
76 Added: newAttributeNamed: #userId;
77 Added: newAttributeNamed: #date;
78 Added: newAttributeNamed: #kilograms
79 Added: ]
80 Added:
81 Added: { #category : 'class models' }
82 Added: MFTDescriptorSystem >> classModelForMFTWorkout: aClassModel [
83 Added:
84 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
85 Added: aClassModel
86 Added: newAttributeNamed: #userId;
87 Added: newAttributeNamed: #date;
88 Added: newAttributeNamed: #primaryMuscleGroupId;
89 Added: newAttributeNamed: #secondaryMuscleGroupIds
90 Added: collectionOf: MFTMuscleGroup;
91 Added: newAttributeNamed: #setGroups collectionOf: MFTSetGroup;
92 Added: newAttributeNamed: #restAfter
93 Added: ]
94 Added:
95 Added: { #category : 'class models' }
96 Added: MFTDescriptorSystem >> classModelForMFTWorkoutPlan: aClassModel [
97 Added:
98 Added: (aClassModel newAttributeNamed: #id) useDirectAccess: true.
99 Added: aClassModel newAttributeNamed: #workouts collectionOf: MFTWorkout
100 Added: ]
101 Added:
102 Added: { #category : 'descriptors' }
103 Added: MFTDescriptorSystem >> descriptorForMFTExercise: aDescriptor [
104 Added:
105 Added: | table |
106 Added: table := self tableNamed: 'EXERCISE'.
107 Added: aDescriptor table: table.
108 Added: aDescriptor directMappingFor: #id.
109 Added: (aDescriptor newMapping: DirectMapping)
110 Added: from: #englishName
111 Added: to: (table fieldNamed: 'englishName').
112 Added: (aDescriptor newMapping: DirectMapping)
113 Added: from: #frenchName
114 Added: to: (table fieldNamed: 'frenchName').
115 Added: (aDescriptor newMapping: DirectMapping)
116 Added: from: #primaryMuscleGroupId
117 Added: to: (table fieldNamed: 'primaryMuscleGroupId')
118 Added: ]
119 Added:
120 Added: { #category : 'descriptors' }
121 Added: MFTDescriptorSystem >> descriptorForMFTMuscle: aDescriptor [
122 Added:
123 Added: | table |
124 Added: table := self tableNamed: 'MUSCLE'.
125 Added: aDescriptor table: table.
126 Added: aDescriptor directMappingFor: #id.
127 Added: (aDescriptor newMapping: DirectMapping)
128 Added: from: #primaryMuscleGroupId
129 Added: to: (table fieldNamed: 'primaryMuscleGroupId').
130 Added: (aDescriptor newMapping: DirectMapping)
131 Added: from: #latinName
132 Added: to: (table fieldNamed: 'latinName').
133 Added: (aDescriptor newMapping: DirectMapping)
134 Added: from: #englishName
135 Added: to: (table fieldNamed: 'englishName').
136 Added: (aDescriptor newMapping: DirectMapping)
137 Added: from: #function
138 Added: to: (table fieldNamed: 'function')
139 Added: ]
140 Added:
141 Added: { #category : 'descriptors' }
142 Added: MFTDescriptorSystem >> descriptorForMFTMuscleGroup: aDescriptor [
143 Added:
144 Added: | table |
145 Added: table := self tableNamed: 'MUSCLE_GROUP'.
146 Added: aDescriptor table: table.
147 Added: aDescriptor directMappingFor: #id.
148 Added: aDescriptor directMappingFor: #englishName.
149 Added: aDescriptor directMappingFor: #frenchName.
150 Added: aDescriptor directMappingFor: #function
151 Added: ]
152 Added:
153 Added: { #category : 'descriptors' }
154 Added: MFTDescriptorSystem >> descriptorForMFTSet: aDescriptor [
155 Added:
156 Added: | table |
157 Added: table := self tableNamed: 'WORKOUT'.
158 Added: aDescriptor table: table.
159 Added: aDescriptor directMappingFor: #id.
160 Added: (aDescriptor newMapping: DirectMapping)
161 Added: from: #exerciseId
162 Added: to: (table fieldNamed: 'Id').
163 Added: aDescriptor directMappingFor: #number.
164 Added: aDescriptor directMappingFor: #groupId.
165 Added: (aDescriptor newMapping: DirectMapping)
166 Added: from: #groupId
167 Added: to: (table fieldNamed: 'Id').
168 Added: aDescriptor directMappingFor: #reps.
169 Added: aDescriptor directMappingFor: #load.
170 Added: aDescriptor directMappingFor: #rpe.
171 Added: aDescriptor directMappingFor: #restAfter
172 Added: ]
173 Added:
174 Added: { #category : 'descriptors' }
175 Added: MFTDescriptorSystem >> descriptorForMFTWeight: aDescriptor [
176 Added:
177 Added: | table |
178 Added: table := self tableNamed: 'WORKOUT'.
179 Added: aDescriptor table: table.
180 Added: aDescriptor directMappingFor: #id.
181 Added: (aDescriptor newMapping: DirectMapping)
182 Added: from: #userId
183 Added: to: (table fieldNamed: 'userId').
184 Added: aDescriptor directMappingFor: #date.
185 Added: aDescriptor directMappingFor: #kilograms
186 Added: ]
187 Added:
188 Added: { #category : 'descriptors' }
189 Added: MFTDescriptorSystem >> descriptorForMFTWorkout: aDescriptor [
190 Added:
191 Added: | table |
192 Added: table := self tableNamed: 'WORKOUT'.
193 Added: aDescriptor table: table.
194 Added: aDescriptor directMappingFor: #id.
195 Added: (aDescriptor newMapping: DirectMapping)
196 Added: from: #userId
197 Added: to: (table fieldNamed: 'userId').
198 Added: aDescriptor directMappingFor: #date.
199 Added: (aDescriptor newMapping: DirectMapping)
200 Added: from: #primaryMuscleGroupId
201 Added: to: (table fieldNamed: 'primaryMuscleGroupId').
202 Added: (aDescriptor newMapping: DirectMapping)
203 Added: from: #secondaryMuscleGroupIds
204 Added: to: (table fieldNamed: 'secondaryMuscleGroupId').
205 Added: aDescriptor directMappingFor: #restAfter
206 Added: ]
207 Added:
208 Added: { #category : 'tables' }
209 Added: MFTDescriptorSystem >> tableForEXERCISE: aTable [
210 Added:
211 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
212 Added: aTable createFieldNamed: 'englishName' type: (platform varChar: 100).
213 Added: aTable createFieldNamed: 'frenchName' type: (platform varChar: 100).
214 Added: aTable
215 Added: createFieldNamed: 'primaryMuscle'
216 Added: type: (platform varchar: 100)
217 Added: ]
218 Added:
219 Added: { #category : 'tables' }
220 Added: MFTDescriptorSystem >> tableForMUSCLE: aTable [
221 Added:
222 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
223 Added: aTable createFieldNamed: 'latinName' type: (platform varChar: 100).
224 Added: aTable createFieldNamed: 'englishName' type: (platform varChar: 100).
225 Added: aTable createFieldNamed: 'englishName' type: (platform varChar: 100).
226 Added: aTable
227 Added: createFieldNamed: 'primaryMuscleGroupId'
228 Added: type: (platform foreignKey: MFTMuscleGroup).
229 Added: aTable createFieldNamed: 'function' type: (platform varChar: 100)
230 Added: ]
231 Added:
232 Added: { #category : 'tables' }
233 Added: MFTDescriptorSystem >> tableForMUSCLEGROUP: aTable [
234 Added:
235 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
236 Added: aTable
237 Added: createFieldNamed: 'englishName' type: (platform varChar: 100);
238 Added: createFieldNamed: 'frenchName' type: (platform varChar: 100);
239 Added: createFieldNamed: 'function' type: (platform varChar: 100);
240 Added: createFieldNamed: 'muscles'
241 Added: type: (platform foreignKey: MFTMuscleGroup)
242 Added: ]
243 Added:
244 Added: { #category : 'tables' }
245 Added: MFTDescriptorSystem >> tableForSET: aTable [
246 Added:
247 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
248 Added: aTable
249 Added: createFieldNamed: 'workoutId'
250 Added: type: (platform foreignKey: #Workout).
251 Added: aTable
252 Added: createFieldNamed: 'exerciseId'
253 Added: type: (platform foreignKey: #Exercise).
254 Added: aTable createFieldNamed: 'number' type: platform integer.
255 Added: aTable createFieldNamed: 'groupId' type: platform integer.
256 Added: aTable createFieldNamed: 'reps' type: platform integer.
257 Added: aTable createFieldNamed: 'load' type: platform integer.
258 Added: aTable createFieldNamed: 'rpe' type: platform integer.
259 Added: aTable createFieldNamed: 'restAfter' type: platform float4
260 Added: ]
261 Added:
262 Added: { #category : 'tables' }
263 Added: MFTDescriptorSystem >> tableForUSER: aTable [
264 Added:
265 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
266 Added: aTable
267 Added: createFieldNamed: 'username' type: (platform varchar: 100);
268 Added: createFieldNamed: 'passwordHash' type: (platform varchar: 100);
269 Added: createFieldNamed: 'realFirstName' type: (platform varChar: 100);
270 Added: createFieldNamed: 'realLastName' type: (platform varChar: 100);
271 Added: createFieldNamed: 'dateOfBirth' type: platform date;
272 Added: createFieldNamed: 'isLoggedIn' type: platform boolean;
273 Added: createFieldNamed: 'lastLoginDateAndTime' type: platform date;
274 Added: createFieldNamed: 'accountRegisterDateAndTime' type: platform date
275 Added: ]
276 Added:
277 Added: { #category : 'tables' }
278 Added: MFTDescriptorSystem >> tableForWEIGHT: aTable [
279 Added:
280 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
281 Added: aTable
282 Added: createFieldNamed: 'userId'
283 Added: type: (platform foreignKey: MFTUser).
284 Added: aTable createFieldNamed: 'date' type: platform date.
285 Added: aTable createFieldNamed: 'kilograms' type: platform integer
286 Added: ]
287 Added:
288 Added: { #category : 'tables' }
289 Added: MFTDescriptorSystem >> tableForWEIGHT_ON_USER: aTable [
290 Added:
291 Added: | weightField userField |
292 Added: weightField := aTable
293 Added: createFieldNamed: 'workoutId'
294 Added: type: platform integer.
295 Added: userField := aTable createFieldNamed: 'userId' type: platform integer.
296 Added: weightField bePrimaryKey.
297 Added: userField bePrimaryKey.
298 Added: aTable
299 Added: addForeignKeyFrom: weightField
300 Added: to: ((self tableNamed: 'WEIGHT') fieldNamed: 'id').
301 Added: aTable
302 Added: addForeignKeyFrom: userField
303 Added: to: ((self tableNamed: 'USER') fieldNamed: 'id')
304 Added: ]
305 Added:
306 Added: { #category : 'tables' }
307 Added: MFTDescriptorSystem >> tableForWORKOUT: aTable [
308 Added:
309 Added: (aTable createFieldNamed: 'id' type: platform serial) bePrimaryKey.
310 Added: aTable
311 Added: createFieldNamed: 'userId'
312 Added: type: (platform foreignKey: MFTUser).
313 Added: aTable createFieldNamed: 'date' type: platform date.
314 Added: aTable
315 Added: createFieldNamed: 'primaryMuscleGroupId'
316 Added: type: (platform varChar: 100).
317 Added: aTable
318 Added: createFieldNamed: 'sencondaryMuscleGroupIds'
319 Added: type: (platform varChar: 100).
320 Added: aTable createFieldNamed: 'setGroups' type: (platform varChar: 100).
321 Added: aTable createFieldNamed: 'rpe' type: (platform varChar: 100)
322 Added: ]
323 Added:
324 Added: { #category : 'tables' }
325 Added: MFTDescriptorSystem >> tableForWORKOUT_ON_USER: aTable [
326 Added:
327 Added: | workoutField userField |
328 Added: workoutField := aTable
329 Added: createFieldNamed: 'workoutId'
330 Added: type: platform integer.
331 Added: userField := aTable createFieldNamed: 'userId' type: platform integer.
332 Added: workoutField bePrimaryKey.
333 Added: userField bePrimaryKey.
334 Added: aTable
335 Added: addForeignKeyFrom: workoutField
336 Added: to: ((self tableNamed: 'WORKOUT') fieldNamed: 'id').
337 Added: aTable
338 Added: addForeignKeyFrom: userField
339 Added: to: ((self tableNamed: 'USER') fieldNamed: 'id')
340 Added: ]
src/MyFitnessTracker-Glorp/ManifestMyFitnessTrackerGlorp.class.st
index 00000000..24416ff1 000000..100644
@@ -0,0 +1,10 @@
1 Added: "
2 Added: 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 Added: "
4 Added: Class {
5 Added: #name : 'ManifestMyFitnessTrackerGlorp',
6 Added: #superclass : 'PackageManifest',
7 Added: #category : 'MyFitnessTracker-Glorp-Manifest',
8 Added: #package : 'MyFitnessTracker-Glorp',
9 Added: #tag : 'Manifest'
10 Added: }
src/MyFitnessTracker-Glorp/package.st
index 00000000..80051b13 000000..100644
@@ -0,0 +1,1 @@
1 Added: Package { #name : 'MyFitnessTracker-Glorp' }