Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/models/Trainee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export interface TraineeEducationInfo {
quitDate?: Date;
assignments: Assignment[];
tests: Test[];
averageTestScore: number | null;
comments?: string;
}

Expand Down
46 changes: 25 additions & 21 deletions server/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ paths:
schema:
$ref: '#/components/schemas/LoginRequest'
responses:
200:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
401:
'401':
description: Authentication failed. The provided token may be invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
403:
'403':
description: Unauthorized user - The user is not allowed to login
content:
application/json:
Expand All @@ -74,13 +74,13 @@ paths:
security:
- cookie_token:
responses:
200:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
401:
'401':
description: Unauthorized
content:
application/json:
Expand All @@ -95,9 +95,9 @@ paths:
security:
- cookie_token:
responses:
204:
'204':
description: successful operation
401:
'401':
description: Not logged in.
content:
application/json:
Expand Down Expand Up @@ -509,7 +509,7 @@ paths:
type: string
example: '3jvz35Z'
responses:
204:
'204':
description: successful operation

/trainees/{id}/interactions:
Expand All @@ -528,7 +528,7 @@ paths:
type: string
example: '3jvz35Z'
responses:
200:
'200':
description: Successful operation
content:
application/json:
Expand Down Expand Up @@ -668,7 +668,7 @@ paths:
type: string
example: '3jvz35Z'
responses:
200:
'200':
description: Successful operation
content:
application/json:
Expand Down Expand Up @@ -808,7 +808,7 @@ paths:
type: string
example: '3jvz35Z'
responses:
200:
'200':
description: Successful operation
content:
application/json:
Expand Down Expand Up @@ -1077,7 +1077,7 @@ paths:
security:
- cookie_token: []
responses:
200:
'200':
description: A list of users
content:
application/json:
Expand All @@ -1099,19 +1099,19 @@ paths:
schema:
$ref: '#/components/schemas/CreateUser'
responses:
201:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
400:
'400':
description: Invalid user data
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
409:
'409':
description: Email already in use
content:
application/json:
Expand Down Expand Up @@ -1140,19 +1140,19 @@ paths:
schema:
$ref: '#/components/schemas/UpdateUser'
responses:
200:
'200':
description: User updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
400:
'400':
description: Invalid user data
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
404:
'404':
description: User not found
content:
application/json:
Expand All @@ -1173,9 +1173,9 @@ paths:
type: string
description: The ID of the user to delete
responses:
204:
'204':
description: User deleted successfully
404:
'404':
description: User not found
content:
application/json:
Expand Down Expand Up @@ -1210,7 +1210,7 @@ paths:
example: '2025-01-01'

responses:
200:
'200':
description: successful operation
content:
application/json:
Expand Down Expand Up @@ -1473,6 +1473,10 @@ components:
type: array
items:
$ref: '#/components/schemas/Test'
averageTestScore:
type: number
example: 7.6
nullable: true
comments:
type: string

Expand Down
6 changes: 6 additions & 0 deletions server/src/schemas/TraineeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
TraineeEducationInfo,
TraineeEmploymentInfo,
TraineePersonalInfo,
calculateAverageTestScore,
getDisplayName,
getProfileURL,
} from '../models';
Expand Down Expand Up @@ -189,8 +190,13 @@ TraineeSchema.virtual('profileURL').get(function () {
return getProfileURL(this as Trainee);
});

TraineeEducationInfoSchema.virtual('averageTestScore').get(function (this: TraineeEducationInfo) {
return calculateAverageTestScore(this.tests);
});

TraineeSchema.set('toJSON', jsonFormatting);
StrikeSchema.set('toJSON', jsonFormatting);
TraineeEducationInfoSchema.set('toJSON', jsonFormatting);
InteractionSchema.set('toJSON', jsonFormatting);
TestSchema.set('toJSON', jsonFormatting);
EmploymentHistorySchema.set('toJSON', jsonFormatting);
Expand Down
Loading