Skip to content

Commit

Permalink
Merge branch 'main' into sidhdhi/select-team-in-tournament
Browse files Browse the repository at this point in the history
# Conflicts:
#	khelo/assets/locales/app_en.arb
#	khelo/lib/ui/app_route.dart
  • Loading branch information
cp-sidhdhi-p committed Oct 18, 2024
2 parents 223c369 + d7c811c commit 3a44ed2
Show file tree
Hide file tree
Showing 21 changed files with 920 additions and 87 deletions.
1 change: 1 addition & 0 deletions data/lib/api/match/match_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MatchModel with _$MatchModel {
String? toss_winner_id,
String? current_playing_team_id,
RevisedTarget? revised_target,
@TimeStampJsonConverter() DateTime? updated_at,
}) = _MatchModel;

factory MatchModel.fromJson(Map<String, dynamic> json) =>
Expand Down
39 changes: 32 additions & 7 deletions data/lib/api/match/match_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ mixin _$MatchModel {
String? get toss_winner_id => throw _privateConstructorUsedError;
String? get current_playing_team_id => throw _privateConstructorUsedError;
RevisedTarget? get revised_target => throw _privateConstructorUsedError;
@TimeStampJsonConverter()
DateTime? get updated_at => throw _privateConstructorUsedError;

/// Serializes this MatchModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -107,7 +109,8 @@ abstract class $MatchModelCopyWith<$Res> {
TossDecision? toss_decision,
String? toss_winner_id,
String? current_playing_team_id,
RevisedTarget? revised_target});
RevisedTarget? revised_target,
@TimeStampJsonConverter() DateTime? updated_at});

$UserModelCopyWith<$Res>? get referee;
$RevisedTargetCopyWith<$Res>? get revised_target;
Expand Down Expand Up @@ -159,6 +162,7 @@ class _$MatchModelCopyWithImpl<$Res, $Val extends MatchModel>
Object? toss_winner_id = freezed,
Object? current_playing_team_id = freezed,
Object? revised_target = freezed,
Object? updated_at = freezed,
}) {
return _then(_value.copyWith(
id: null == id
Expand Down Expand Up @@ -285,6 +289,10 @@ class _$MatchModelCopyWithImpl<$Res, $Val extends MatchModel>
? _value.revised_target
: revised_target // ignore: cast_nullable_to_non_nullable
as RevisedTarget?,
updated_at: freezed == updated_at
? _value.updated_at
: updated_at // ignore: cast_nullable_to_non_nullable
as DateTime?,
) as $Val);
}

Expand Down Expand Up @@ -359,7 +367,8 @@ abstract class _$$MatchModelImplCopyWith<$Res>
TossDecision? toss_decision,
String? toss_winner_id,
String? current_playing_team_id,
RevisedTarget? revised_target});
RevisedTarget? revised_target,
@TimeStampJsonConverter() DateTime? updated_at});

@override
$UserModelCopyWith<$Res>? get referee;
Expand Down Expand Up @@ -411,6 +420,7 @@ class __$$MatchModelImplCopyWithImpl<$Res>
Object? toss_winner_id = freezed,
Object? current_playing_team_id = freezed,
Object? revised_target = freezed,
Object? updated_at = freezed,
}) {
return _then(_$MatchModelImpl(
id: null == id
Expand Down Expand Up @@ -537,6 +547,10 @@ class __$$MatchModelImplCopyWithImpl<$Res>
? _value.revised_target
: revised_target // ignore: cast_nullable_to_non_nullable
as RevisedTarget?,
updated_at: freezed == updated_at
? _value.updated_at
: updated_at // ignore: cast_nullable_to_non_nullable
as DateTime?,
));
}
}
Expand Down Expand Up @@ -579,7 +593,8 @@ class _$MatchModelImpl implements _MatchModel {
this.toss_decision,
this.toss_winner_id,
this.current_playing_team_id,
this.revised_target})
this.revised_target,
@TimeStampJsonConverter() this.updated_at})
: _teams = teams,
_players = players,
_team_ids = team_ids,
Expand Down Expand Up @@ -764,10 +779,13 @@ class _$MatchModelImpl implements _MatchModel {
final String? current_playing_team_id;
@override
final RevisedTarget? revised_target;
@override
@TimeStampJsonConverter()
final DateTime? updated_at;

@override
String toString() {
return 'MatchModel(id: $id, teams: $teams, match_type: $match_type, number_of_over: $number_of_over, over_per_bowler: $over_per_bowler, players: $players, team_ids: $team_ids, team_creator_ids: $team_creator_ids, power_play_overs1: $power_play_overs1, power_play_overs2: $power_play_overs2, power_play_overs3: $power_play_overs3, city: $city, ground: $ground, start_time: $start_time, start_at: $start_at, ball_type: $ball_type, pitch_type: $pitch_type, created_by: $created_by, umpires: $umpires, scorers: $scorers, commentators: $commentators, referee: $referee, umpire_ids: $umpire_ids, scorer_ids: $scorer_ids, commentator_ids: $commentator_ids, referee_id: $referee_id, match_status: $match_status, toss_decision: $toss_decision, toss_winner_id: $toss_winner_id, current_playing_team_id: $current_playing_team_id, revised_target: $revised_target)';
return 'MatchModel(id: $id, teams: $teams, match_type: $match_type, number_of_over: $number_of_over, over_per_bowler: $over_per_bowler, players: $players, team_ids: $team_ids, team_creator_ids: $team_creator_ids, power_play_overs1: $power_play_overs1, power_play_overs2: $power_play_overs2, power_play_overs3: $power_play_overs3, city: $city, ground: $ground, start_time: $start_time, start_at: $start_at, ball_type: $ball_type, pitch_type: $pitch_type, created_by: $created_by, umpires: $umpires, scorers: $scorers, commentators: $commentators, referee: $referee, umpire_ids: $umpire_ids, scorer_ids: $scorer_ids, commentator_ids: $commentator_ids, referee_id: $referee_id, match_status: $match_status, toss_decision: $toss_decision, toss_winner_id: $toss_winner_id, current_playing_team_id: $current_playing_team_id, revised_target: $revised_target, updated_at: $updated_at)';
}

@override
Expand Down Expand Up @@ -828,7 +846,9 @@ class _$MatchModelImpl implements _MatchModel {
other.current_playing_team_id, current_playing_team_id) ||
other.current_playing_team_id == current_playing_team_id) &&
(identical(other.revised_target, revised_target) ||
other.revised_target == revised_target));
other.revised_target == revised_target) &&
(identical(other.updated_at, updated_at) ||
other.updated_at == updated_at));
}

@JsonKey(includeFromJson: false, includeToJson: false)
Expand Down Expand Up @@ -865,7 +885,8 @@ class _$MatchModelImpl implements _MatchModel {
toss_decision,
toss_winner_id,
current_playing_team_id,
revised_target
revised_target,
updated_at
]);

/// Create a copy of MatchModel
Expand Down Expand Up @@ -920,7 +941,8 @@ abstract class _MatchModel implements MatchModel {
final TossDecision? toss_decision,
final String? toss_winner_id,
final String? current_playing_team_id,
final RevisedTarget? revised_target}) = _$MatchModelImpl;
final RevisedTarget? revised_target,
@TimeStampJsonConverter() final DateTime? updated_at}) = _$MatchModelImpl;

factory _MatchModel.fromJson(Map<String, dynamic> json) =
_$MatchModelImpl.fromJson;
Expand Down Expand Up @@ -992,6 +1014,9 @@ abstract class _MatchModel implements MatchModel {
String? get current_playing_team_id;
@override
RevisedTarget? get revised_target;
@override
@TimeStampJsonConverter()
DateTime? get updated_at;

/// Create a copy of MatchModel
/// with the given fields replaced by the non-null parameter values.
Expand Down
4 changes: 4 additions & 0 deletions data/lib/api/match/match_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions data/lib/api/tournament/tournament_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import '../../converter/timestamp_json_converter.dart';
import '../match/match_model.dart';
import '../team/team_model.dart';
import '../user/user_models.dart';

part 'tournament_model.freezed.dart';

Expand Down Expand Up @@ -47,8 +48,11 @@ class TournamentModel with _$TournamentModel {

@freezed
class TournamentMember with _$TournamentMember {
@JsonSerializable(explicitToJson: true)
const factory TournamentMember({
required String id,
@JsonKey(includeToJson: false, includeFromJson: false)
@Default(UserModel(id: '')) UserModel user,
@Default(TournamentMemberRole.admin) TournamentMemberRole role,
}) = _TournamentMember;

Expand Down
58 changes: 52 additions & 6 deletions data/lib/api/tournament/tournament_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ TournamentMember _$TournamentMemberFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$TournamentMember {
String get id => throw _privateConstructorUsedError;
@JsonKey(includeToJson: false, includeFromJson: false)
UserModel get user => throw _privateConstructorUsedError;
TournamentMemberRole get role => throw _privateConstructorUsedError;

/// Serializes this TournamentMember to a JSON map.
Expand All @@ -536,7 +538,12 @@ abstract class $TournamentMemberCopyWith<$Res> {
TournamentMember value, $Res Function(TournamentMember) then) =
_$TournamentMemberCopyWithImpl<$Res, TournamentMember>;
@useResult
$Res call({String id, TournamentMemberRole role});
$Res call(
{String id,
@JsonKey(includeToJson: false, includeFromJson: false) UserModel user,
TournamentMemberRole role});

$UserModelCopyWith<$Res> get user;
}

/// @nodoc
Expand All @@ -555,19 +562,34 @@ class _$TournamentMemberCopyWithImpl<$Res, $Val extends TournamentMember>
@override
$Res call({
Object? id = null,
Object? user = null,
Object? role = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserModel,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
as TournamentMemberRole,
) as $Val);
}

/// Create a copy of TournamentMember
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserModelCopyWith<$Res> get user {
return $UserModelCopyWith<$Res>(_value.user, (value) {
return _then(_value.copyWith(user: value) as $Val);
});
}
}

/// @nodoc
Expand All @@ -578,7 +600,13 @@ abstract class _$$TournamentMemberImplCopyWith<$Res>
__$$TournamentMemberImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String id, TournamentMemberRole role});
$Res call(
{String id,
@JsonKey(includeToJson: false, includeFromJson: false) UserModel user,
TournamentMemberRole role});

@override
$UserModelCopyWith<$Res> get user;
}

/// @nodoc
Expand All @@ -595,13 +623,18 @@ class __$$TournamentMemberImplCopyWithImpl<$Res>
@override
$Res call({
Object? id = null,
Object? user = null,
Object? role = null,
}) {
return _then(_$TournamentMemberImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
user: null == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as UserModel,
role: null == role
? _value.role
: role // ignore: cast_nullable_to_non_nullable
Expand All @@ -611,23 +644,30 @@ class __$$TournamentMemberImplCopyWithImpl<$Res>
}

/// @nodoc
@JsonSerializable()
@JsonSerializable(explicitToJson: true)
class _$TournamentMemberImpl implements _TournamentMember {
const _$TournamentMemberImpl(
{required this.id, this.role = TournamentMemberRole.admin});
{required this.id,
@JsonKey(includeToJson: false, includeFromJson: false)
this.user = const UserModel(id: ''),
this.role = TournamentMemberRole.admin});

factory _$TournamentMemberImpl.fromJson(Map<String, dynamic> json) =>
_$$TournamentMemberImplFromJson(json);

@override
final String id;
@override
@JsonKey(includeToJson: false, includeFromJson: false)
final UserModel user;
@override
@JsonKey()
final TournamentMemberRole role;

@override
String toString() {
return 'TournamentMember(id: $id, role: $role)';
return 'TournamentMember(id: $id, user: $user, role: $role)';
}

@override
Expand All @@ -636,12 +676,13 @@ class _$TournamentMemberImpl implements _TournamentMember {
(other.runtimeType == runtimeType &&
other is _$TournamentMemberImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.user, user) || other.user == user) &&
(identical(other.role, role) || other.role == role));
}

@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, role);
int get hashCode => Object.hash(runtimeType, id, user, role);

/// Create a copy of TournamentMember
/// with the given fields replaced by the non-null parameter values.
Expand All @@ -663,6 +704,8 @@ class _$TournamentMemberImpl implements _TournamentMember {
abstract class _TournamentMember implements TournamentMember {
const factory _TournamentMember(
{required final String id,
@JsonKey(includeToJson: false, includeFromJson: false)
final UserModel user,
final TournamentMemberRole role}) = _$TournamentMemberImpl;

factory _TournamentMember.fromJson(Map<String, dynamic> json) =
Expand All @@ -671,6 +714,9 @@ abstract class _TournamentMember implements TournamentMember {
@override
String get id;
@override
@JsonKey(includeToJson: false, includeFromJson: false)
UserModel get user;
@override
TournamentMemberRole get role;

/// Create a copy of TournamentMember
Expand Down
Loading

0 comments on commit 3a44ed2

Please sign in to comment.