From a26466971c6b7802d7bb5d9b67d681e3753b110e Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Wed, 24 Jul 2024 13:45:50 +0200 Subject: [PATCH] feat: Force id on toRaw --- .../lib/src/data/bout.dart | 6 +++--- .../lib/src/data/bout_action.dart | 2 +- .../lib/src/data/club.dart | 2 +- .../lib/src/data/competition/competition.dart | 2 +- .../src/data/competition/competition_bout.dart | 4 ++-- .../src/data/competition/competition_person.dart | 4 ++-- .../competition_team_participation.dart | 4 ++-- .../lib/src/data/lineup.dart | 6 +++--- .../lib/src/data/membership.dart | 6 +++--- .../lib/src/data/organization.dart | 2 +- .../lib/src/data/participant_state.dart | 2 +- .../lib/src/data/participation.dart | 6 +++--- .../lib/src/data/person.dart | 2 +- .../lib/src/data/team.dart | 4 ++-- .../lib/src/data/team_match/division.dart | 6 +++--- .../data/team_match/division_weight_class.dart | 4 ++-- .../lib/src/data/team_match/league.dart | 4 ++-- .../team_match/league_team_participation.dart | 4 ++-- .../lib/src/data/team_match/team_match.dart | 16 ++++++++-------- .../lib/src/data/team_match/team_match_bout.dart | 4 ++-- .../lib/src/data/wrestling_event.dart | 2 +- 21 files changed, 46 insertions(+), 46 deletions(-) diff --git a/wrestling_scoreboard_common/lib/src/data/bout.dart b/wrestling_scoreboard_common/lib/src/data/bout.dart index 8203cce2..c8c6ae1c 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.dart @@ -29,9 +29,9 @@ class Bout with _$Bout implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - 'red_id': r?.id, - 'blue_id': b?.id, - 'weight_class_id': weightClass?.id, + 'red_id': r?.id!, + 'blue_id': b?.id!, + 'weight_class_id': weightClass?.id!, 'winner_role': winnerRole?.name, 'bout_result': result?.name, 'duration_millis': duration.inMilliseconds, diff --git a/wrestling_scoreboard_common/lib/src/data/bout_action.dart b/wrestling_scoreboard_common/lib/src/data/bout_action.dart index b8d3d733..a2b6cdf1 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_action.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_action.dart @@ -38,7 +38,7 @@ class BoutAction with _$BoutAction implements DataObject { 'duration_millis': duration.inMilliseconds, 'bout_role': role.name, 'point_count': pointCount, - 'bout_id': bout.id, + 'bout_id': bout.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/club.dart b/wrestling_scoreboard_common/lib/src/data/club.dart index 23c37e09..36b1bb70 100644 --- a/wrestling_scoreboard_common/lib/src/data/club.dart +++ b/wrestling_scoreboard_common/lib/src/data/club.dart @@ -25,7 +25,7 @@ class Club with _$Club implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - 'organization_id': organization.id, + 'organization_id': organization.id!, 'no': no, 'name': name, }; diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition.dart index 4a782218..b43978f7 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.dart @@ -47,7 +47,7 @@ class Competition extends WrestlingEvent with _$Competition { return super.toRaw() ..addAll({ 'name': name, - 'bout_config_id': boutConfig.id, + 'bout_config_id': boutConfig.id!, }); } diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart index d3afa7ed..3ea66cbe 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart @@ -32,8 +32,8 @@ class CompetitionBout with _$CompetitionBout implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'competition_id': competition.id, - 'bout_id': bout.id, + 'competition_id': competition.id!, + 'bout_id': bout.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart index 9d005b0d..d0a13824 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart @@ -31,8 +31,8 @@ class CompetitionPerson with _$CompetitionPerson implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'competition_id': competition.id, - 'person_id': person.id, + 'competition_id': competition.id!, + 'person_id': person.id!, 'person_role': role.name, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.dart index 56dc512c..d6d9d874 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.dart @@ -23,8 +23,8 @@ class CompetitionTeamParticipation with _$CompetitionTeamParticipation implement Map toRaw() { return { if (id != null) 'id': id, - 'competition_id': competition.id, - 'team_id': team.id, + 'competition_id': competition.id!, + 'team_id': team.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/lineup.dart b/wrestling_scoreboard_common/lib/src/data/lineup.dart index b1f16f14..19610a1f 100644 --- a/wrestling_scoreboard_common/lib/src/data/lineup.dart +++ b/wrestling_scoreboard_common/lib/src/data/lineup.dart @@ -34,9 +34,9 @@ class Lineup with _$Lineup implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'team_id': team.id, - 'leader_id': leader?.id, - 'coach_id': coach?.id, + 'team_id': team.id!, + 'leader_id': leader?.id!, + 'coach_id': coach?.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/membership.dart b/wrestling_scoreboard_common/lib/src/data/membership.dart index 9098a019..30cecc25 100644 --- a/wrestling_scoreboard_common/lib/src/data/membership.dart +++ b/wrestling_scoreboard_common/lib/src/data/membership.dart @@ -40,9 +40,9 @@ class Membership with _$Membership implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - if (organization != null) 'organization_id': organization?.id, - 'person_id': person.id, - 'club_id': club.id, + if (organization != null) 'organization_id': organization?.id!, + 'person_id': person.id!, + 'club_id': club.id!, 'no': no, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/organization.dart b/wrestling_scoreboard_common/lib/src/data/organization.dart index 9ebb6880..8a7dcb55 100644 --- a/wrestling_scoreboard_common/lib/src/data/organization.dart +++ b/wrestling_scoreboard_common/lib/src/data/organization.dart @@ -42,7 +42,7 @@ class Organization with _$Organization implements DataObject { if (id != null) 'id': id, 'name': name, 'abbreviation': abbreviation, - 'parent_id': parent?.id, + 'parent_id': parent?.id!, 'api_provider': apiProvider?.name, 'report_provider': reportProvider?.name, }; diff --git a/wrestling_scoreboard_common/lib/src/data/participant_state.dart b/wrestling_scoreboard_common/lib/src/data/participant_state.dart index 0a1e3ed8..a6fde6d4 100644 --- a/wrestling_scoreboard_common/lib/src/data/participant_state.dart +++ b/wrestling_scoreboard_common/lib/src/data/participant_state.dart @@ -31,7 +31,7 @@ class ParticipantState with _$ParticipantState implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'participation_id': participation.id, + 'participation_id': participation.id!, 'classification_points': classificationPoints, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/participation.dart b/wrestling_scoreboard_common/lib/src/data/participation.dart index 8ef61e3b..d9a03504 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.dart @@ -44,9 +44,9 @@ class Participation with _$Participation implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'weight_class_id': weightClass?.id, - 'lineup_id': lineup.id, - 'membership_id': membership.id, + 'weight_class_id': weightClass?.id!, + 'lineup_id': lineup.id!, + 'membership_id': membership.id!, 'weight': weight?.toString(), }; } diff --git a/wrestling_scoreboard_common/lib/src/data/person.dart b/wrestling_scoreboard_common/lib/src/data/person.dart index 99f35ea3..b9ecbcb2 100644 --- a/wrestling_scoreboard_common/lib/src/data/person.dart +++ b/wrestling_scoreboard_common/lib/src/data/person.dart @@ -55,7 +55,7 @@ class Person with _$Person implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - if (organization != null) 'organization_id': organization?.id, + if (organization != null) 'organization_id': organization?.id!, 'prename': prename, 'surname': surname, 'gender': gender?.name, diff --git a/wrestling_scoreboard_common/lib/src/data/team.dart b/wrestling_scoreboard_common/lib/src/data/team.dart index 8a544696..efc586d8 100644 --- a/wrestling_scoreboard_common/lib/src/data/team.dart +++ b/wrestling_scoreboard_common/lib/src/data/team.dart @@ -39,10 +39,10 @@ class Team with _$Team implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - if (organization != null) 'organization_id': organization?.id, + if (organization != null) 'organization_id': organization?.id!, 'name': name, 'description': description, - 'club_id': club.id, + 'club_id': club.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/division.dart b/wrestling_scoreboard_common/lib/src/data/team_match/division.dart index 3476af30..7106ee4c 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/division.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/division.dart @@ -47,13 +47,13 @@ class Division with _$Division implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - 'organization_id': organization.id, + 'organization_id': organization.id!, 'name': name, 'start_date': startDate, 'end_date': endDate, - 'bout_config_id': boutConfig.id, + 'bout_config_id': boutConfig.id!, 'season_partitions': seasonPartitions, - 'parent_id': parent?.id, + 'parent_id': parent?.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/division_weight_class.dart b/wrestling_scoreboard_common/lib/src/data/team_match/division_weight_class.dart index 75581c11..08916fd5 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/division_weight_class.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/division_weight_class.dart @@ -25,8 +25,8 @@ class DivisionWeightClass with _$DivisionWeightClass implements DataObject { return { if (id != null) 'id': id, 'pos': pos, - 'division_id': division.id, - 'weight_class_id': weightClass.id, + 'division_id': division.id!, + 'weight_class_id': weightClass.id!, 'season_partition': seasonPartition, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league.dart index c9a438e2..98ecbaf9 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league.dart @@ -42,11 +42,11 @@ class League with _$League implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - if (organization != null) 'organization_id': organization?.id, + if (organization != null) 'organization_id': organization?.id!, 'name': name, 'start_date': startDate, 'end_date': endDate, - 'division_id': division.id, + 'division_id': division.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.dart index e24c9f2e..61bd7f49 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.dart @@ -22,8 +22,8 @@ class LeagueTeamParticipation with _$LeagueTeamParticipation implements DataObje Map toRaw() { return { if (id != null) 'id': id, - 'league_id': league.id, - 'team_id': team.id, + 'league_id': league.id!, + 'team_id': team.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart index e769144d..c02426e2 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart @@ -75,15 +75,15 @@ class TeamMatch extends WrestlingEvent with _$TeamMatch { Map toRaw() { return super.toRaw() ..addAll({ - 'home_id': home.id, - 'guest_id': guest.id, - 'league_id': league?.id, + 'home_id': home.id!, + 'guest_id': guest.id!, + 'league_id': league?.id!, 'season_partition': seasonPartition, - 'referee_id': referee?.id, - 'judge_id': judge?.id, - 'mat_chairman_id': matChairman?.id, - 'transcript_writer_id': transcriptWriter?.id, - 'time_keeper_id': timeKeeper?.id, + 'referee_id': referee?.id!, + 'judge_id': judge?.id!, + 'mat_chairman_id': matChairman?.id!, + 'transcript_writer_id': transcriptWriter?.id!, + 'time_keeper_id': timeKeeper?.id!, }); } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.dart index b0be5a6a..91cff45d 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.dart @@ -35,8 +35,8 @@ class TeamMatchBout with _$TeamMatchBout implements DataObject { return { if (id != null) 'id': id, 'pos': pos, - 'team_match_id': teamMatch.id, - 'bout_id': bout.id, + 'team_match_id': teamMatch.id!, + 'bout_id': bout.id!, }; } diff --git a/wrestling_scoreboard_common/lib/src/data/wrestling_event.dart b/wrestling_scoreboard_common/lib/src/data/wrestling_event.dart index 0687aaa5..5ef77908 100644 --- a/wrestling_scoreboard_common/lib/src/data/wrestling_event.dart +++ b/wrestling_scoreboard_common/lib/src/data/wrestling_event.dart @@ -31,7 +31,7 @@ abstract class WrestlingEvent implements DataObject { return { if (id != null) 'id': id, if (orgSyncId != null) 'org_sync_id': orgSyncId, - if (organization != null) 'organization_id': organization?.id, + if (organization != null) 'organization_id': organization?.id!, 'no': no, 'location': location, 'date': date,