40 lines
1.1 KiB
Dart
40 lines
1.1 KiB
Dart
class DutySchedule {
|
|
DutySchedule({
|
|
required this.id,
|
|
required this.userId,
|
|
required this.shiftType,
|
|
required this.startTime,
|
|
required this.endTime,
|
|
required this.status,
|
|
required this.createdAt,
|
|
required this.checkInAt,
|
|
required this.checkInLocation,
|
|
});
|
|
|
|
final String id;
|
|
final String userId;
|
|
final String shiftType;
|
|
final DateTime startTime;
|
|
final DateTime endTime;
|
|
final String status;
|
|
final DateTime createdAt;
|
|
final DateTime? checkInAt;
|
|
final Object? checkInLocation;
|
|
|
|
factory DutySchedule.fromMap(Map<String, dynamic> map) {
|
|
return DutySchedule(
|
|
id: map['id'] as String,
|
|
userId: map['user_id'] as String,
|
|
shiftType: map['shift_type'] as String? ?? 'normal',
|
|
startTime: DateTime.parse(map['start_time'] as String),
|
|
endTime: DateTime.parse(map['end_time'] as String),
|
|
status: map['status'] as String? ?? 'scheduled',
|
|
createdAt: DateTime.parse(map['created_at'] as String),
|
|
checkInAt: map['check_in_at'] == null
|
|
? null
|
|
: DateTime.parse(map['check_in_at'] as String),
|
|
checkInLocation: map['check_in_location'],
|
|
);
|
|
}
|
|
}
|