Skip to content

Commit

Permalink
Merge pull request #133 from canopas/Mayank/implement-tournament-list…
Browse files Browse the repository at this point in the history
…-home

Implement tournament list home
  • Loading branch information
cp-mayank authored Nov 12, 2024
2 parents 23a576e + d27ca83 commit 5d5ca3c
Show file tree
Hide file tree
Showing 29 changed files with 1,099 additions and 352 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 @@ -18,6 +18,7 @@ class MatchModel with _$MatchModel {
const factory MatchModel({
required String id,
required List<MatchTeamModel> teams,
String? tournament_id,
required MatchType match_type,
required int number_of_over,
required int over_per_bowler,
Expand Down
24 changes: 23 additions & 1 deletion data/lib/api/match/match_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MatchModel _$MatchModelFromJson(Map<String, dynamic> json) {
mixin _$MatchModel {
String get id => throw _privateConstructorUsedError;
List<MatchTeamModel> get teams => throw _privateConstructorUsedError;
String? get tournament_id => throw _privateConstructorUsedError;
MatchType get match_type => throw _privateConstructorUsedError;
int get number_of_over => throw _privateConstructorUsedError;
int get over_per_bowler => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -78,6 +79,7 @@ abstract class $MatchModelCopyWith<$Res> {
$Res call(
{String id,
List<MatchTeamModel> teams,
String? tournament_id,
MatchType match_type,
int number_of_over,
int over_per_bowler,
Expand Down Expand Up @@ -133,6 +135,7 @@ class _$MatchModelCopyWithImpl<$Res, $Val extends MatchModel>
$Res call({
Object? id = null,
Object? teams = null,
Object? tournament_id = freezed,
Object? match_type = null,
Object? number_of_over = null,
Object? over_per_bowler = null,
Expand Down Expand Up @@ -173,6 +176,10 @@ class _$MatchModelCopyWithImpl<$Res, $Val extends MatchModel>
? _value.teams
: teams // ignore: cast_nullable_to_non_nullable
as List<MatchTeamModel>,
tournament_id: freezed == tournament_id
? _value.tournament_id
: tournament_id // ignore: cast_nullable_to_non_nullable
as String?,
match_type: null == match_type
? _value.match_type
: match_type // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -336,6 +343,7 @@ abstract class _$$MatchModelImplCopyWith<$Res>
$Res call(
{String id,
List<MatchTeamModel> teams,
String? tournament_id,
MatchType match_type,
int number_of_over,
int over_per_bowler,
Expand Down Expand Up @@ -391,6 +399,7 @@ class __$$MatchModelImplCopyWithImpl<$Res>
$Res call({
Object? id = null,
Object? teams = null,
Object? tournament_id = freezed,
Object? match_type = null,
Object? number_of_over = null,
Object? over_per_bowler = null,
Expand Down Expand Up @@ -431,6 +440,10 @@ class __$$MatchModelImplCopyWithImpl<$Res>
? _value._teams
: teams // ignore: cast_nullable_to_non_nullable
as List<MatchTeamModel>,
tournament_id: freezed == tournament_id
? _value.tournament_id
: tournament_id // ignore: cast_nullable_to_non_nullable
as String?,
match_type: null == match_type
? _value.match_type
: match_type // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -562,6 +575,7 @@ class _$MatchModelImpl implements _MatchModel {
const _$MatchModelImpl(
{required this.id,
required final List<MatchTeamModel> teams,
this.tournament_id,
required this.match_type,
required this.number_of_over,
required this.over_per_bowler,
Expand Down Expand Up @@ -622,6 +636,8 @@ class _$MatchModelImpl implements _MatchModel {
return EqualUnmodifiableListView(_teams);
}

@override
final String? tournament_id;
@override
final MatchType match_type;
@override
Expand Down Expand Up @@ -785,7 +801,7 @@ class _$MatchModelImpl implements _MatchModel {

@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, updated_at: $updated_at)';
return 'MatchModel(id: $id, teams: $teams, tournament_id: $tournament_id, 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 All @@ -795,6 +811,8 @@ class _$MatchModelImpl implements _MatchModel {
other is _$MatchModelImpl &&
(identical(other.id, id) || other.id == id) &&
const DeepCollectionEquality().equals(other._teams, _teams) &&
(identical(other.tournament_id, tournament_id) ||
other.tournament_id == tournament_id) &&
(identical(other.match_type, match_type) ||
other.match_type == match_type) &&
(identical(other.number_of_over, number_of_over) ||
Expand Down Expand Up @@ -857,6 +875,7 @@ class _$MatchModelImpl implements _MatchModel {
runtimeType,
id,
const DeepCollectionEquality().hash(_teams),
tournament_id,
match_type,
number_of_over,
over_per_bowler,
Expand Down Expand Up @@ -909,6 +928,7 @@ abstract class _MatchModel implements MatchModel {
const factory _MatchModel(
{required final String id,
required final List<MatchTeamModel> teams,
final String? tournament_id,
required final MatchType match_type,
required final int number_of_over,
required final int over_per_bowler,
Expand Down Expand Up @@ -952,6 +972,8 @@ abstract class _MatchModel implements MatchModel {
@override
List<MatchTeamModel> get teams;
@override
String? get tournament_id;
@override
MatchType get match_type;
@override
int get number_of_over;
Expand Down
2 changes: 2 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.

14 changes: 14 additions & 0 deletions data/lib/api/tournament/tournament_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class TournamentModel with _$TournamentModel {
String? profile_img_url,
String? banner_img_url,
required TournamentType type,
@JsonKey(includeFromJson: false, includeToJson: false)
@Default(TournamentStatus.upcoming)
TournamentStatus status,
@Default([]) List<TournamentMember> members,
required String created_by,
@TimeStampJsonConverter() DateTime? created_at,
Expand Down Expand Up @@ -82,6 +85,17 @@ enum TournamentType {
const TournamentType(this.value);
}

@JsonEnum(valueField: "value")
enum TournamentStatus {
upcoming(1),
running(2),
finish(3);

final int value;

const TournamentStatus(this.value);
}

enum TournamentMemberRole {
organizer,
admin;
Expand Down
30 changes: 29 additions & 1 deletion data/lib/api/tournament/tournament_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ mixin _$TournamentModel {
String? get profile_img_url => throw _privateConstructorUsedError;
String? get banner_img_url => throw _privateConstructorUsedError;
TournamentType get type => throw _privateConstructorUsedError;
@JsonKey(includeFromJson: false, includeToJson: false)
TournamentStatus get status => throw _privateConstructorUsedError;
List<TournamentMember> get members => throw _privateConstructorUsedError;
String get created_by => throw _privateConstructorUsedError;
@TimeStampJsonConverter()
Expand Down Expand Up @@ -64,6 +66,8 @@ abstract class $TournamentModelCopyWith<$Res> {
String? profile_img_url,
String? banner_img_url,
TournamentType type,
@JsonKey(includeFromJson: false, includeToJson: false)
TournamentStatus status,
List<TournamentMember> members,
String created_by,
@TimeStampJsonConverter() DateTime? created_at,
Expand Down Expand Up @@ -99,6 +103,7 @@ class _$TournamentModelCopyWithImpl<$Res, $Val extends TournamentModel>
Object? profile_img_url = freezed,
Object? banner_img_url = freezed,
Object? type = null,
Object? status = null,
Object? members = null,
Object? created_by = null,
Object? created_at = freezed,
Expand Down Expand Up @@ -131,6 +136,10 @@ class _$TournamentModelCopyWithImpl<$Res, $Val extends TournamentModel>
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as TournamentType,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as TournamentStatus,
members: null == members
? _value.members
: members // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -189,6 +198,8 @@ abstract class _$$TournamentModelImplCopyWith<$Res>
String? profile_img_url,
String? banner_img_url,
TournamentType type,
@JsonKey(includeFromJson: false, includeToJson: false)
TournamentStatus status,
List<TournamentMember> members,
String created_by,
@TimeStampJsonConverter() DateTime? created_at,
Expand Down Expand Up @@ -222,6 +233,7 @@ class __$$TournamentModelImplCopyWithImpl<$Res>
Object? profile_img_url = freezed,
Object? banner_img_url = freezed,
Object? type = null,
Object? status = null,
Object? members = null,
Object? created_by = null,
Object? created_at = freezed,
Expand Down Expand Up @@ -254,6 +266,10 @@ class __$$TournamentModelImplCopyWithImpl<$Res>
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as TournamentType,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as TournamentStatus,
members: null == members
? _value._members
: members // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -308,6 +324,8 @@ class _$TournamentModelImpl implements _TournamentModel {
this.profile_img_url,
this.banner_img_url,
required this.type,
@JsonKey(includeFromJson: false, includeToJson: false)
this.status = TournamentStatus.upcoming,
final List<TournamentMember> members = const [],
required this.created_by,
@TimeStampJsonConverter() this.created_at,
Expand Down Expand Up @@ -341,6 +359,9 @@ class _$TournamentModelImpl implements _TournamentModel {
final String? banner_img_url;
@override
final TournamentType type;
@override
@JsonKey(includeFromJson: false, includeToJson: false)
final TournamentStatus status;
final List<TournamentMember> _members;
@override
@JsonKey()
Expand Down Expand Up @@ -408,7 +429,7 @@ class _$TournamentModelImpl implements _TournamentModel {

@override
String toString() {
return 'TournamentModel(id: $id, name: $name, profile_img_url: $profile_img_url, banner_img_url: $banner_img_url, type: $type, members: $members, created_by: $created_by, created_at: $created_at, start_date: $start_date, end_date: $end_date, team_ids: $team_ids, match_ids: $match_ids, teams: $teams, matches: $matches, keyStats: $keyStats)';
return 'TournamentModel(id: $id, name: $name, profile_img_url: $profile_img_url, banner_img_url: $banner_img_url, type: $type, status: $status, members: $members, created_by: $created_by, created_at: $created_at, start_date: $start_date, end_date: $end_date, team_ids: $team_ids, match_ids: $match_ids, teams: $teams, matches: $matches, keyStats: $keyStats)';
}

@override
Expand All @@ -423,6 +444,7 @@ class _$TournamentModelImpl implements _TournamentModel {
(identical(other.banner_img_url, banner_img_url) ||
other.banner_img_url == banner_img_url) &&
(identical(other.type, type) || other.type == type) &&
(identical(other.status, status) || other.status == status) &&
const DeepCollectionEquality().equals(other._members, _members) &&
(identical(other.created_by, created_by) ||
other.created_by == created_by) &&
Expand All @@ -449,6 +471,7 @@ class _$TournamentModelImpl implements _TournamentModel {
profile_img_url,
banner_img_url,
type,
status,
const DeepCollectionEquality().hash(_members),
created_by,
created_at,
Expand Down Expand Up @@ -484,6 +507,8 @@ abstract class _TournamentModel implements TournamentModel {
final String? profile_img_url,
final String? banner_img_url,
required final TournamentType type,
@JsonKey(includeFromJson: false, includeToJson: false)
final TournamentStatus status,
final List<TournamentMember> members,
required final String created_by,
@TimeStampJsonConverter() final DateTime? created_at,
Expand Down Expand Up @@ -512,6 +537,9 @@ abstract class _TournamentModel implements TournamentModel {
@override
TournamentType get type;
@override
@JsonKey(includeFromJson: false, includeToJson: false)
TournamentStatus get status;
@override
List<TournamentMember> get members;
@override
String get created_by;
Expand Down
Loading

0 comments on commit 5d5ca3c

Please sign in to comment.