-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from B3-3iL-DLW/refactor/refactor-data-layer-api
Refactor/refactor data layer api
- Loading branch information
Showing
9 changed files
with
66 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
frontend/app_student/lib/api/day_schedule/repositories/day_schedule.dart
This file was deleted.
Oops, something went wrong.
20 changes: 14 additions & 6 deletions
20
frontend/app_student/lib/api/week_schedule/models/week_schedule_model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import 'package:app_student/api/day_schedule/entities/day_schedule_entity.dart'; | ||
|
||
import 'package:app_student/api/day_schedule/models/day_schedule_model.dart'; | ||
import '../entities/week_schedule_entity.dart'; | ||
|
||
class WeekScheduleModel { | ||
final WeekScheduleEntity weekSchedule; | ||
final String code; | ||
final List<DayScheduleModel> daySchedules; | ||
|
||
WeekScheduleModel({ | ||
required this.weekSchedule, | ||
required this.code, | ||
required this.daySchedules, | ||
}); | ||
|
||
String get code => weekSchedule.code; | ||
List<DayScheduleEntity> get daySchedules => weekSchedule.daySchedules; | ||
factory WeekScheduleModel.fromEntity(WeekScheduleEntity entity) { | ||
return WeekScheduleModel( | ||
code: entity.code, | ||
daySchedules: entity.daySchedules | ||
.map((dayScheduleEntity) => | ||
DayScheduleModel.fromEntity(dayScheduleEntity)) | ||
.toList(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
frontend/app_student/lib/week_schedule/cubit/week_schedule_cubit.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 2 additions & 39 deletions
41
frontend/app_student/lib/week_schedule/views/week_schedule.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
frontend/app_student/lib/week_schedule/views/widgets/day_schedule_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:app_student/api/day_schedule/models/day_schedule_model.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class DayScheduleWidget extends StatelessWidget { | ||
final DayScheduleModel daySchedule; | ||
|
||
const DayScheduleWidget({super.key, required this.daySchedule}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExpansionTile( | ||
title: Text('Date: ${daySchedule.date}'), | ||
children: daySchedule.events.map((event) { | ||
return ListTile( | ||
title: Text('Event: ${event.activite}'), | ||
subtitle: Text( | ||
'Start at: ${event.horaires.startAt}, End Time: ${event.horaires.endAt}'), | ||
); | ||
}).toList(), | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
frontend/app_student/lib/week_schedule/views/widgets/week_schedule_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:app_student/api/week_schedule/models/week_schedule_model.dart'; | ||
import 'package:app_student/week_schedule/views/widgets/day_schedule_widget.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class WeekScheduleWidget extends StatelessWidget { | ||
final WeekScheduleModel weekSchedule; | ||
|
||
const WeekScheduleWidget({super.key, required this.weekSchedule}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExpansionTile( | ||
title: Text('Code: ${weekSchedule.code}'), | ||
children: weekSchedule.daySchedules.map((daySchedule) { | ||
return DayScheduleWidget(daySchedule: daySchedule); | ||
}).toList(), | ||
); | ||
} | ||
} |