You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
686 B
26 lines
686 B
import 'package:bowl_in/model/GameDetail.dart';
|
|
|
|
import '../../model/User.dart';
|
|
import '../fields/GameDetailFields.dart';
|
|
|
|
class GameDetailMapper {
|
|
static Map<String, dynamic> toJson(GameDetail gameDetail) {
|
|
return {
|
|
GameDetailFields.id: gameDetail.id,
|
|
GameDetailFields.date: gameDetail.time.toIso8601String(),
|
|
GameDetailFields.nameWinner: gameDetail.winner?.name,
|
|
GameDetailFields.host: gameDetail.host
|
|
};
|
|
}
|
|
|
|
static GameDetail toModel(Map<String, dynamic> json, User winner) {
|
|
return GameDetail(
|
|
json[GameDetailFields.id],
|
|
json[GameDetailFields.date],
|
|
json[winner],
|
|
json[GameDetailFields.host],
|
|
[],
|
|
);
|
|
}
|
|
}
|