implemented foreign timetable support for students, teachers, rooms, and classes, including a searchable element picker with favorites support, introduced a capabilities system for feature gating, refactored the timetable UI into a reusable TimetableCalendarView component, and redesigned the chat input field with a unified emoji picker and integrated attachment actions.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../errors/marianumconnect_error.dart';
|
||||
import '../../marianumconnect_api.dart';
|
||||
import '../../marianumconnect_endpoint.dart';
|
||||
import 'timetable_get_students_response.dart';
|
||||
|
||||
class TimetableGetStudents {
|
||||
final Dio _dio;
|
||||
|
||||
TimetableGetStudents({Dio? dio}) : _dio = dio ?? MarianumConnectApi.dio();
|
||||
|
||||
Future<TimetableGetStudentsResponse> run() async {
|
||||
try {
|
||||
final response = await _dio.get<List<dynamic>>(
|
||||
MarianumConnectEndpoint.resolve('timetable/elements/students'),
|
||||
);
|
||||
final list = response.data!
|
||||
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
return TimetableGetStudentsResponse(result: list);
|
||||
} on DioException catch (e) {
|
||||
throw mapMarianumConnectError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../api_response.dart';
|
||||
|
||||
part 'timetable_get_students_response.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class McTimetableStudent {
|
||||
final int id;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
final String displayName;
|
||||
|
||||
McTimetableStudent({
|
||||
required this.id,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.displayName,
|
||||
});
|
||||
|
||||
factory McTimetableStudent.fromJson(Map<String, dynamic> json) =>
|
||||
_$McTimetableStudentFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$McTimetableStudentToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class TimetableGetStudentsResponse extends ApiResponse {
|
||||
final List<McTimetableStudent> result;
|
||||
|
||||
TimetableGetStudentsResponse({required this.result});
|
||||
|
||||
factory TimetableGetStudentsResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$TimetableGetStudentsResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TimetableGetStudentsResponseToJson(this);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'timetable_get_students_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
McTimetableStudent _$McTimetableStudentFromJson(Map<String, dynamic> json) =>
|
||||
McTimetableStudent(
|
||||
id: (json['id'] as num).toInt(),
|
||||
firstName: json['firstName'] as String,
|
||||
lastName: json['lastName'] as String,
|
||||
displayName: json['displayName'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'firstName': instance.firstName,
|
||||
'lastName': instance.lastName,
|
||||
'displayName': instance.displayName,
|
||||
};
|
||||
|
||||
TimetableGetStudentsResponse _$TimetableGetStudentsResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) =>
|
||||
TimetableGetStudentsResponse(
|
||||
result: (json['result'] as List<dynamic>)
|
||||
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
)
|
||||
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$TimetableGetStudentsResponseToJson(
|
||||
TimetableGetStudentsResponse instance,
|
||||
) => <String, dynamic>{
|
||||
'headers': ?instance.headers,
|
||||
'result': instance.result.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
Reference in New Issue
Block a user