Skip to content

Commit b652a8b

Browse files
authored
Feature/eventsdetails (#154)
* Add an event detail page * Detail event load the data itself * No need to sort events * Add a first version for the hours * add summary for the events * Fix missing days * Improve even tui * Fix offby one error for months * Better border
1 parent ca80c99 commit b652a8b

15 files changed

Lines changed: 647 additions & 101 deletions

App/lib/services/event_service.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class EventService extends ApiService {
3030
return await call(() => api.apiEventsGet(type: type, start: start?.toUtc(), end: end?.toUtc(), personId: person));
3131
}
3232

33+
Future<List<EventSummary>?> eventsSummary(int? type, DateTime? start, DateTime? end, {int? person}) async {
34+
var api = await getService();
35+
return await call(() => api.apiEventsSummaryGet(type: type, start: start?.toUtc(), end: end?.toUtc(), personId: person));
36+
}
37+
3338
Future<List<Event>?> agenda(DateTime? start, DateTime? end) async {
3439
var api = await getService();
3540
return await call(() => api.apiPatientsAgendaGet(start: start?.toUtc(), end: end?.toUtc()));

App/lib/services/swagger/generated_code/swagger.swagger.chopper.dart

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

App/lib/services/swagger/generated_code/swagger.swagger.dart

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,37 @@ abstract class Swagger extends ChopperService {
7575
@Get(path: '/api/status')
7676
Future<chopper.Response<Status>> _apiStatusGet();
7777

78+
///
79+
///@param type
80+
///@param start
81+
///@param end
82+
///@param personId
83+
Future<chopper.Response<List<EventSummary>>> apiEventsSummaryGet({
84+
required int? type,
85+
required DateTime? start,
86+
required DateTime? end,
87+
int? personId,
88+
}) {
89+
generatedMapping.putIfAbsent(
90+
EventSummary, () => EventSummary.fromJsonFactory);
91+
92+
return _apiEventsSummaryGet(
93+
type: type, start: start, end: end, personId: personId);
94+
}
95+
96+
///
97+
///@param type
98+
///@param start
99+
///@param end
100+
///@param personId
101+
@Get(path: '/api/events/summary')
102+
Future<chopper.Response<List<EventSummary>>> _apiEventsSummaryGet({
103+
@Query('type') required int? type,
104+
@Query('start') required DateTime? start,
105+
@Query('end') required DateTime? end,
106+
@Query('personId') int? personId,
107+
});
108+
78109
///
79110
///@param type
80111
///@param start
@@ -1033,6 +1064,48 @@ extension $EventExtension on Event {
10331064
}
10341065
}
10351066

1067+
@JsonSerializable(explicitToJson: true)
1068+
class EventSummary {
1069+
const EventSummary({
1070+
this.data,
1071+
});
1072+
1073+
factory EventSummary.fromJson(Map<String, dynamic> json) =>
1074+
_$EventSummaryFromJson(json);
1075+
1076+
static const toJsonFactory = _$EventSummaryToJson;
1077+
Map<String, dynamic> toJson() => _$EventSummaryToJson(this);
1078+
1079+
@JsonKey(name: 'data')
1080+
final Map<String, dynamic>? data;
1081+
static const fromJsonFactory = _$EventSummaryFromJson;
1082+
1083+
@override
1084+
bool operator ==(Object other) {
1085+
return identical(this, other) ||
1086+
(other is EventSummary &&
1087+
(identical(other.data, data) ||
1088+
const DeepCollectionEquality().equals(other.data, data)));
1089+
}
1090+
1091+
@override
1092+
String toString() => jsonEncode(this);
1093+
1094+
@override
1095+
int get hashCode =>
1096+
const DeepCollectionEquality().hash(data) ^ runtimeType.hashCode;
1097+
}
1098+
1099+
extension $EventSummaryExtension on EventSummary {
1100+
EventSummary copyWith({Map<String, dynamic>? data}) {
1101+
return EventSummary(data: data ?? this.data);
1102+
}
1103+
1104+
EventSummary copyWithWrapped({Wrapped<Map<String, dynamic>?>? data}) {
1105+
return EventSummary(data: (data != null ? data.value : this.data));
1106+
}
1107+
}
1108+
10361109
@JsonSerializable(explicitToJson: true)
10371110
class EventType {
10381111
const EventType({

App/lib/services/swagger/generated_code/swagger.swagger.g.dart

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)