Skip to content

Commit

Permalink
feat: Force id on toRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Aug 2, 2024
1 parent 2141336 commit a264669
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions wrestling_scoreboard_common/lib/src/data/bout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion wrestling_scoreboard_common/lib/src/data/bout_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
};
}

Expand Down
2 changes: 1 addition & 1 deletion wrestling_scoreboard_common/lib/src/data/club.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class CompetitionBout with _$CompetitionBout implements DataObject {
Map<String, dynamic> toRaw() {
return {
if (id != null) 'id': id,
'competition_id': competition.id,
'bout_id': bout.id,
'competition_id': competition.id!,
'bout_id': bout.id!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class CompetitionPerson with _$CompetitionPerson implements DataObject {
Map<String, dynamic> 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,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class CompetitionTeamParticipation with _$CompetitionTeamParticipation implement
Map<String, dynamic> toRaw() {
return {
if (id != null) 'id': id,
'competition_id': competition.id,
'team_id': team.id,
'competition_id': competition.id!,
'team_id': team.id!,
};
}

Expand Down
6 changes: 3 additions & 3 deletions wrestling_scoreboard_common/lib/src/data/lineup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class Lineup with _$Lineup implements DataObject {
Map<String, dynamic> 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!,
};
}

Expand Down
6 changes: 3 additions & 3 deletions wrestling_scoreboard_common/lib/src/data/membership.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
2 changes: 1 addition & 1 deletion wrestling_scoreboard_common/lib/src/data/organization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ParticipantState with _$ParticipantState implements DataObject {
Map<String, dynamic> toRaw() {
return {
if (id != null) 'id': id,
'participation_id': participation.id,
'participation_id': participation.id!,
'classification_points': classificationPoints,
};
}
Expand Down
6 changes: 3 additions & 3 deletions wrestling_scoreboard_common/lib/src/data/participation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class Participation with _$Participation implements DataObject {
Map<String, dynamic> 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(),
};
}
Expand Down
2 changes: 1 addition & 1 deletion wrestling_scoreboard_common/lib/src/data/person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions wrestling_scoreboard_common/lib/src/data/team.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class LeagueTeamParticipation with _$LeagueTeamParticipation implements DataObje
Map<String, dynamic> toRaw() {
return {
if (id != null) 'id': id,
'league_id': league.id,
'team_id': team.id,
'league_id': league.id!,
'team_id': team.id!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ class TeamMatch extends WrestlingEvent with _$TeamMatch {
Map<String, dynamic> 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!,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a264669

Please sign in to comment.