Skip to content
Merged
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: 0 additions & 1 deletion lib/api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,3 @@ lib/src/model/user_class_dto.dart
lib/src/model/user_state.dart
lib/src/serializers.dart
pubspec.yaml
test/install_plugin_request_test.dart
2 changes: 1 addition & 1 deletion lib/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Authentication schemes defined for the API:

- **Type**: OAuth
- **Flow**: accessCode
- **Authorization URL**: http://localhost:8080/realms/polyglot/authorize
- **Authorization URL**: https://auth.gaggao.com/authorize
- **Scopes**:
- **openid**: OpenID Connect
- **profile**: User profile
Expand Down
4 changes: 2 additions & 2 deletions lib/api/doc/SchoolUserDto.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Name | Type | Description | Notes
**street** | **String** | | [optional]
**city** | **String** | | [optional]
**zip** | **String** | | [optional]
**birthday** | [**Date**](Date.md) | |
**entryDate** | [**Date**](Date.md) | |
**birthday** | [**Date**](Date.md) | | [optional]
**entryDate** | [**Date**](Date.md) | | [optional]
**leaveDate** | [**Date**](Date.md) | | [optional]
**role** | [**Roles**](Roles.md) | |
**state** | [**UserState**](UserState.md) | | [optional]
Expand Down
38 changes: 22 additions & 16 deletions lib/api/lib/src/model/school_user_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ abstract class SchoolUserDto implements Built<SchoolUserDto, SchoolUserDtoBuilde
String? get zip;

@BuiltValueField(wireName: r'birthday')
Date get birthday;
Date? get birthday;

@BuiltValueField(wireName: r'entryDate')
Date get entryDate;
Date? get entryDate;

@BuiltValueField(wireName: r'leaveDate')
Date? get leaveDate;
Expand Down Expand Up @@ -222,16 +222,20 @@ class _$SchoolUserDtoSerializer implements PrimitiveSerializer<SchoolUserDto> {
specifiedType: const FullType.nullable(String),
);
}
yield r'birthday';
yield serializers.serialize(
object.birthday,
specifiedType: const FullType(Date),
);
yield r'entryDate';
yield serializers.serialize(
object.entryDate,
specifiedType: const FullType(Date),
);
if (object.birthday != null) {
yield r'birthday';
yield serializers.serialize(
object.birthday,
specifiedType: const FullType.nullable(Date),
);
}
if (object.entryDate != null) {
yield r'entryDate';
yield serializers.serialize(
object.entryDate,
specifiedType: const FullType.nullable(Date),
);
}
if (object.leaveDate != null) {
yield r'leaveDate';
yield serializers.serialize(
Expand Down Expand Up @@ -410,15 +414,17 @@ class _$SchoolUserDtoSerializer implements PrimitiveSerializer<SchoolUserDto> {
case r'birthday':
final valueDes = serializers.deserialize(
value,
specifiedType: const FullType(Date),
) as Date;
specifiedType: const FullType.nullable(Date),
) as Date?;
if (valueDes == null) continue;
result.birthday = valueDes;
break;
case r'entryDate':
final valueDes = serializers.deserialize(
value,
specifiedType: const FullType(Date),
) as Date;
specifiedType: const FullType.nullable(Date),
) as Date?;
if (valueDes == null) continue;
result.entryDate = valueDes;
break;
case r'leaveDate':
Expand Down
20 changes: 6 additions & 14 deletions lib/api/lib/src/model/school_user_dto.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/services/private_data_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class PrivateDataAdapter {

static DateTime _dateOr(String? s, DateTime fallback) => _date(s) ?? fallback;

static Date? _dateOnly(String? s) {
final d = _date(s);
return d == null ? null : Date(d.year, d.month, d.day);
}

static GradeDto grade(PrivateGrade g) => GradeDto((b) => b
..id = g.id
..score = g.score
Expand Down Expand Up @@ -56,6 +61,8 @@ class PrivateDataAdapter {
..firstName = info?.firstName ?? ''
..lastName = info?.lastName ?? ''
..email = info?.email ?? ''
..birthday = _dateOnly(info?.birthday)
..entryDate = _dateOnly(info?.entryDate)
..role = Roles.student
..grades = ListBuilder<GradeDto>(grades.map(grade))
..absences = ListBuilder<AbsenceDto>(absences.map(absence)));
Expand Down
Loading