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_classes_response.dart';
|
||||
|
||||
class TimetableGetClasses {
|
||||
final Dio _dio;
|
||||
|
||||
TimetableGetClasses({Dio? dio}) : _dio = dio ?? MarianumConnectApi.dio();
|
||||
|
||||
Future<TimetableGetClassesResponse> run() async {
|
||||
try {
|
||||
final response = await _dio.get<List<dynamic>>(
|
||||
MarianumConnectEndpoint.resolve('timetable/elements/classes'),
|
||||
);
|
||||
final list = response.data!
|
||||
.map((e) => McTimetableClass.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
return TimetableGetClassesResponse(result: list);
|
||||
} on DioException catch (e) {
|
||||
throw mapMarianumConnectError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../api_response.dart';
|
||||
|
||||
part 'timetable_get_classes_response.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class McTimetableClass {
|
||||
final int id;
|
||||
final String shortName;
|
||||
final String longName;
|
||||
|
||||
McTimetableClass({
|
||||
required this.id,
|
||||
required this.shortName,
|
||||
required this.longName,
|
||||
});
|
||||
|
||||
factory McTimetableClass.fromJson(Map<String, dynamic> json) =>
|
||||
_$McTimetableClassFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$McTimetableClassToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class TimetableGetClassesResponse extends ApiResponse {
|
||||
final List<McTimetableClass> result;
|
||||
|
||||
TimetableGetClassesResponse({required this.result});
|
||||
|
||||
factory TimetableGetClassesResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$TimetableGetClassesResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TimetableGetClassesResponseToJson(this);
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'timetable_get_classes_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
McTimetableClass _$McTimetableClassFromJson(Map<String, dynamic> json) =>
|
||||
McTimetableClass(
|
||||
id: (json['id'] as num).toInt(),
|
||||
shortName: json['shortName'] as String,
|
||||
longName: json['longName'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'shortName': instance.shortName,
|
||||
'longName': instance.longName,
|
||||
};
|
||||
|
||||
TimetableGetClassesResponse _$TimetableGetClassesResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) =>
|
||||
TimetableGetClassesResponse(
|
||||
result: (json['result'] as List<dynamic>)
|
||||
.map((e) => McTimetableClass.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> _$TimetableGetClassesResponseToJson(
|
||||
TimetableGetClassesResponse instance,
|
||||
) => <String, dynamic>{
|
||||
'headers': ?instance.headers,
|
||||
'result': instance.result.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
Reference in New Issue
Block a user