diff --git a/README.md b/README.md index d51fba77..d92fbb42 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Repository for managing Wrestling software client, server and shared libraries. -Tags: scoreboard, wrestling, scoring, bracket, mat, team fight, tournament +Tags: scoreboard, wrestling, scoring, bracket, mat, team fight, competition, tournament ## Screenshots diff --git a/wrestling_scoreboard_client/README.md b/wrestling_scoreboard_client/README.md index f251362e..37262c81 100644 --- a/wrestling_scoreboard_client/README.md +++ b/wrestling_scoreboard_client/README.md @@ -1,8 +1,8 @@ # Wrestling Scoreboard Client -Wrestling software for managing team bouts and tournaments. +Wrestling software for managing team matches and competitions. -Tags: scoreboard, wrestling, scoring, bracket, mat, team bout, tournament +Tags: scoreboard, wrestling, scoring, bracket, mat, team bout, competition ## Deployment diff --git a/wrestling_scoreboard_client/debian/debian.yaml b/wrestling_scoreboard_client/debian/debian.yaml index 072cb934..91ca5564 100644 --- a/wrestling_scoreboard_client/debian/debian.yaml +++ b/wrestling_scoreboard_client/debian/debian.yaml @@ -10,7 +10,7 @@ control: Priority: optional Depends: libgcrypt20, libgstreamer-plugins-base1.0-0, libgstreamer1.0-dev, libgtk-3-0, libjpeg-turbo8, liblz4-1, libstdc++6, libzstd1 Maintainer: August Oberhauser - Description: Wrestling software for managing team bouts and tournaments. + Description: Wrestling software for managing team matches and competitions. options: exec_out_dir: build/linux/x64/release/debian/ diff --git a/wrestling_scoreboard_client/debian/gui/wrestling_scoreboard_client.desktop b/wrestling_scoreboard_client/debian/gui/wrestling_scoreboard_client.desktop index 0aa1f9c8..cba93313 100644 --- a/wrestling_scoreboard_client/debian/gui/wrestling_scoreboard_client.desktop +++ b/wrestling_scoreboard_client/debian/gui/wrestling_scoreboard_client.desktop @@ -2,9 +2,9 @@ Version=0.0.1 Name=Wrestling Scoreboard GenericName=Sports event administration -Comment=Wrestling software for managing team bouts and tournaments. +Comment=Wrestling software for managing team matches and competitions. Terminal=false Type=Application Categories=Utility -Keywords=Wrestling;Scoreboard;Tournament;Scoring;Bracket;Mat;Ringen;Lutte; +Keywords=Wrestling;Scoreboard;Competition;Tournament;Scoring;Bracket;Mat;Ringen;Lutte; Icon=wrestling_scoreboard_client diff --git a/wrestling_scoreboard_client/docs/score_sheets/Score-Sheet-2018-Tournament.pdf b/wrestling_scoreboard_client/docs/score_sheets/Score-Sheet-2018-Competition.pdf similarity index 100% rename from wrestling_scoreboard_client/docs/score_sheets/Score-Sheet-2018-Tournament.pdf rename to wrestling_scoreboard_client/docs/score_sheets/Score-Sheet-2018-Competition.pdf diff --git a/wrestling_scoreboard_client/lib/mocks/mock_data_provider.dart b/wrestling_scoreboard_client/lib/mocks/mock_data_provider.dart index f2a66b1c..75414e00 100644 --- a/wrestling_scoreboard_client/lib/mocks/mock_data_provider.dart +++ b/wrestling_scoreboard_client/lib/mocks/mock_data_provider.dart @@ -39,7 +39,7 @@ class MockDataProvider extends DataProvider { if (filterObject != null) { switch (T) { case const (Bout): - if (filterObject is Tournament) return getBoutsOfTournament(filterObject).cast(); + if (filterObject is Competition) return getBoutsOfCompetition(filterObject).cast(); if (filterObject is TeamMatch) return getBoutsOfTeamMatch(filterObject).cast(); throw DataUnimplementedError(CRUD.read, T, filterObject); case const (Membership): @@ -82,7 +82,7 @@ class MockDataProvider extends DataProvider { if (wrestlingEvent is TeamMatch) { oldBouts = getBoutsOfTeamMatch(wrestlingEvent); } else { - oldBouts = getBoutsOfTournament(wrestlingEvent as Tournament); + oldBouts = getBoutsOfCompetition(wrestlingEvent as Competition); } final boutsAll = getBouts(); if (isReset) { @@ -91,10 +91,10 @@ class MockDataProvider extends DataProvider { for (var element in oldBouts) { teamMatchBoutsAll.removeWhere((tmf) => tmf.bout.equalDuringBout(element)); } - } else if (wrestlingEvent is Tournament) { - final tournamentBoutsAll = getTournamentBouts(); + } else if (wrestlingEvent is Competition) { + final competitionBoutsAll = getCompetitionBouts(); for (var element in oldBouts) { - tournamentBoutsAll.removeWhere((tof) => tof.bout.equalDuringBout(element)); + competitionBoutsAll.removeWhere((tof) => tof.bout.equalDuringBout(element)); } } @@ -112,15 +112,15 @@ class MockDataProvider extends DataProvider { await dataProvider.readMany(filterObject: wrestlingEvent.guest); teamParticipations = [homeParticipations, guestParticipations]; weightClasses = await dataProvider.readMany(filterObject: wrestlingEvent.league); - } else if (wrestlingEvent is Tournament) { + } else if (wrestlingEvent is Competition) { // TODO get all participations teamParticipations = []; weightClasses = []; - // throw UnimplementedError('generate bouts for tournaments not yet implemented'); + // throw UnimplementedError('generate bouts for competitions not yet implemented'); } else { teamParticipations = []; weightClasses = []; - throw UnimplementedError('generate bouts for tournaments not yet implemented'); + throw UnimplementedError('generate bouts for competitions not yet implemented'); } // Generate new bouts @@ -152,16 +152,16 @@ class MockDataProvider extends DataProvider { teamMatchBoutsAll.add(TeamMatchBout(id: generatedId, teamMatch: wrestlingEvent, bout: element, pos: key)); } }); - } else if (wrestlingEvent is Tournament) { - final tournamentBoutsAll = getTournamentBouts(); + } else if (wrestlingEvent is Competition) { + final competitionBoutsAll = getCompetitionBouts(); for (final element in newBoutsWithId) { - if (tournamentBoutsAll.where((tof) => tof.bout.equalDuringBout(element)).isEmpty) { + if (competitionBoutsAll.where((tof) => tof.bout.equalDuringBout(element)).isEmpty) { int generatedId; do { // Generate new id as long it is not taken yet generatedId = random.nextInt(0x7fffffff); - } while (tournamentBoutsAll.where((t) => t.id == element.id).isNotEmpty); - tournamentBoutsAll.add(TournamentBout(id: generatedId, tournament: wrestlingEvent, bout: element)); + } while (competitionBoutsAll.where((t) => t.id == element.id).isNotEmpty); + competitionBoutsAll.add(CompetitionBout(id: generatedId, competition: wrestlingEvent, bout: element)); } } } diff --git a/wrestling_scoreboard_client/lib/mocks/mocks.dart b/wrestling_scoreboard_client/lib/mocks/mocks.dart index 89dee8e6..a6ba1b0c 100644 --- a/wrestling_scoreboard_client/lib/mocks/mocks.dart +++ b/wrestling_scoreboard_client/lib/mocks/mocks.dart @@ -93,7 +93,7 @@ final List _persons = []; // TODO fill final List _teams = [_homeTeam, _homeTeamJuniors, _guestTeam]; final List _teamMatches = [initMenRPWMatch(), initJnRPWMatch()]; final List _teamMatchBouts = []; -final List _tournamentBouts = []; +final List _competitionBouts = []; final List _weightClasses = [wc57, wc130, wc61, wc98, wc66, wc86, wc71, wc80, wc75A, wc75B]; TeamMatch initMenRPWMatch() { @@ -147,8 +147,8 @@ List getClubs() => _clubs; List getBouts() => _bouts; -List getBoutsOfTournament(Tournament tournament) { - return getTournamentBouts().where((element) => element.tournament == tournament).map((e) => e.bout).toList(); +List getBoutsOfCompetition(Competition competition) { + return getCompetitionBouts().where((element) => element.competition == competition).map((e) => e.bout).toList(); } List getBoutsOfTeamMatch(TeamMatch match) { @@ -218,7 +218,7 @@ List getTeamMatchBoutsOfTeamMatch(TeamMatch match) { return getTeamMatchBouts().where((element) => element.teamMatch == match).toList(); } -List getTournamentBouts() => _tournamentBouts; +List getCompetitionBouts() => _competitionBouts; List getWeightClasses() => _weightClasses; diff --git a/wrestling_scoreboard_client/pubspec.yaml b/wrestling_scoreboard_client/pubspec.yaml index 940154fe..33529b12 100644 --- a/wrestling_scoreboard_client/pubspec.yaml +++ b/wrestling_scoreboard_client/pubspec.yaml @@ -1,5 +1,5 @@ name: wrestling_scoreboard_client -description: Wrestling software for managing team bouts and tournaments. +description: Wrestling software for managing team matches and competitions. publish_to: 'none' diff --git a/wrestling_scoreboard_client/web/index.html b/wrestling_scoreboard_client/web/index.html index 1fe870e1..2be7d829 100644 --- a/wrestling_scoreboard_client/web/index.html +++ b/wrestling_scoreboard_client/web/index.html @@ -18,7 +18,7 @@ - + diff --git a/wrestling_scoreboard_client/web/manifest.json b/wrestling_scoreboard_client/web/manifest.json index 6f0c6829..d5e40006 100644 --- a/wrestling_scoreboard_client/web/manifest.json +++ b/wrestling_scoreboard_client/web/manifest.json @@ -5,7 +5,7 @@ "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "Wrestling software for managing team bouts and tournaments.", + "description": "Wrestling software for managing team matches and competitions.", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ diff --git a/wrestling_scoreboard_common/lib/src/data.dart b/wrestling_scoreboard_common/lib/src/data.dart index 0973f8e3..af8542a0 100644 --- a/wrestling_scoreboard_common/lib/src/data.dart +++ b/wrestling_scoreboard_common/lib/src/data.dart @@ -14,9 +14,9 @@ export 'data/team_match/league_team_participation.dart'; export 'data/team_match/league_weight_class.dart'; export 'data/team_match/team_match.dart'; export 'data/team_match/team_match_bout.dart'; -export 'data/tournament/tournament.dart'; -export 'data/tournament/tournament_bout.dart'; -export 'data/tournament/tournament_person.dart'; -export 'data/tournament/tournament_team_participation.dart'; +export 'data/competition/competition.dart'; +export 'data/competition/competition_bout.dart'; +export 'data/competition/competition_person.dart'; +export 'data/competition/competition_team_participation.dart'; export 'data/weight_class.dart'; export 'data/wrestling_event.dart'; diff --git a/wrestling_scoreboard_common/lib/src/data/bout.dart b/wrestling_scoreboard_common/lib/src/data/bout.dart index aef0a93b..f178a6b1 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.dart @@ -59,7 +59,7 @@ class Bout with _$Bout implements DataObject { ); } - Bout updateClassificationPoints(List actions, {bool isTournament = false}) { + Bout updateClassificationPoints(List actions, {bool isCompetition = false}) { if (result != null && winnerRole != null) { var winner = winnerRole == BoutRole.red ? r : b; var looser = winnerRole == BoutRole.red ? b : r; @@ -67,8 +67,8 @@ class Bout with _$Bout implements DataObject { int? winnerClassificationPoints; int? looserClassificationPoints; if (winner != null) { - winnerClassificationPoints = isTournament - ? getClassificationPointsWinnerTournament(result!) + winnerClassificationPoints = isCompetition + ? getClassificationPointsWinnerCompetition(result!) : getClassificationPointsWinnerTeamMatch( result!, ParticipantState.getTechnicalPoints(actions, winnerRole!) - @@ -77,8 +77,8 @@ class Bout with _$Bout implements DataObject { } if (looser != null) { - looserClassificationPoints = isTournament - ? getClassificationPointsLooserTournament(result!) + looserClassificationPoints = isCompetition + ? getClassificationPointsLooserCompetition(result!) : getClassificationPointsLooserTeamMatch(result!); } return copyWith( @@ -107,7 +107,7 @@ class Bout with _$Bout implements DataObject { @override String get tableName => 'bout'; - static int getClassificationPointsWinnerTournament(BoutResult result) { + static int getClassificationPointsWinnerCompetition(BoutResult result) { switch (result) { case BoutResult.vfa: case BoutResult.vin: @@ -127,7 +127,7 @@ class Bout with _$Bout implements DataObject { } } - static int getClassificationPointsLooserTournament(BoutResult result) { + static int getClassificationPointsLooserCompetition(BoutResult result) { switch (result) { case BoutResult.vsu1: case BoutResult.vpo1: diff --git a/wrestling_scoreboard_common/lib/src/data/bout_config.dart b/wrestling_scoreboard_common/lib/src/data/bout_config.dart index 13011bf7..92bf159a 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_config.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_config.dart @@ -5,7 +5,7 @@ import 'data_object.dart'; part 'bout_config.freezed.dart'; part 'bout_config.g.dart'; -/// The general configuration for a bout, e.g. in a team competition or tournament. +/// The general configuration for a bout, e.g. in a team match or competition. @freezed class BoutConfig with _$BoutConfig implements DataObject { static const defaultPeriodDuration = Duration(minutes: 3); diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition.dart similarity index 72% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition.dart index df3ac2fe..899fc1c8 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.dart @@ -7,15 +7,15 @@ import '../participation.dart'; import '../weight_class.dart'; import '../wrestling_event.dart'; -part 'tournament.freezed.dart'; -part 'tournament.g.dart'; +part 'competition.freezed.dart'; +part 'competition.g.dart'; /// For team matches only. @freezed -class Tournament extends WrestlingEvent with _$Tournament { - const Tournament._(); +class Competition extends WrestlingEvent with _$Competition { + const Competition._(); - const factory Tournament({ + const factory Competition({ int? id, required String name, required BoutConfig boutConfig, @@ -24,14 +24,14 @@ class Tournament extends WrestlingEvent with _$Tournament { String? no, int? visitorsCount, String? comment, - }) = _Tournament; + }) = _Competition; - factory Tournament.fromJson(Map json) => _$TournamentFromJson(json); + factory Competition.fromJson(Map json) => _$CompetitionFromJson(json); - static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async { + static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async { final boutConfig = await getSingle(e['bout_config_id'] as int); // TODO fetch lineups, referees, weightClasses, etc. - return Tournament( + return Competition( id: e['id'] as int?, name: e['name'], location: e['location'] as String?, @@ -59,10 +59,10 @@ class Tournament extends WrestlingEvent with _$Tournament { } @override - String get tableName => 'tournament'; + String get tableName => 'competition'; @override - Tournament copyWithId(int? id) { + Competition copyWithId(int? id) { return copyWith(id: id); } } diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart similarity index 79% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament.freezed.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart index 86731fb5..8929e35d 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'tournament.dart'; +part of 'competition.dart'; // ************************************************************************** // FreezedGenerator @@ -14,12 +14,12 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); -Tournament _$TournamentFromJson(Map json) { - return _Tournament.fromJson(json); +Competition _$CompetitionFromJson(Map json) { + return _Competition.fromJson(json); } /// @nodoc -mixin _$Tournament { +mixin _$Competition { int? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; BoutConfig get boutConfig => throw _privateConstructorUsedError; @@ -31,15 +31,15 @@ mixin _$Tournament { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $TournamentCopyWith get copyWith => + $CompetitionCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $TournamentCopyWith<$Res> { - factory $TournamentCopyWith( - Tournament value, $Res Function(Tournament) then) = - _$TournamentCopyWithImpl<$Res, Tournament>; +abstract class $CompetitionCopyWith<$Res> { + factory $CompetitionCopyWith( + Competition value, $Res Function(Competition) then) = + _$CompetitionCopyWithImpl<$Res, Competition>; @useResult $Res call( {int? id, @@ -55,9 +55,9 @@ abstract class $TournamentCopyWith<$Res> { } /// @nodoc -class _$TournamentCopyWithImpl<$Res, $Val extends Tournament> - implements $TournamentCopyWith<$Res> { - _$TournamentCopyWithImpl(this._value, this._then); +class _$CompetitionCopyWithImpl<$Res, $Val extends Competition> + implements $CompetitionCopyWith<$Res> { + _$CompetitionCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -122,11 +122,11 @@ class _$TournamentCopyWithImpl<$Res, $Val extends Tournament> } /// @nodoc -abstract class _$$TournamentImplCopyWith<$Res> - implements $TournamentCopyWith<$Res> { - factory _$$TournamentImplCopyWith( - _$TournamentImpl value, $Res Function(_$TournamentImpl) then) = - __$$TournamentImplCopyWithImpl<$Res>; +abstract class _$$CompetitionImplCopyWith<$Res> + implements $CompetitionCopyWith<$Res> { + factory _$$CompetitionImplCopyWith( + _$CompetitionImpl value, $Res Function(_$CompetitionImpl) then) = + __$$CompetitionImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -144,11 +144,11 @@ abstract class _$$TournamentImplCopyWith<$Res> } /// @nodoc -class __$$TournamentImplCopyWithImpl<$Res> - extends _$TournamentCopyWithImpl<$Res, _$TournamentImpl> - implements _$$TournamentImplCopyWith<$Res> { - __$$TournamentImplCopyWithImpl( - _$TournamentImpl _value, $Res Function(_$TournamentImpl) _then) +class __$$CompetitionImplCopyWithImpl<$Res> + extends _$CompetitionCopyWithImpl<$Res, _$CompetitionImpl> + implements _$$CompetitionImplCopyWith<$Res> { + __$$CompetitionImplCopyWithImpl( + _$CompetitionImpl _value, $Res Function(_$CompetitionImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -163,7 +163,7 @@ class __$$TournamentImplCopyWithImpl<$Res> Object? visitorsCount = freezed, Object? comment = freezed, }) { - return _then(_$TournamentImpl( + return _then(_$CompetitionImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -202,8 +202,8 @@ class __$$TournamentImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$TournamentImpl extends _Tournament { - const _$TournamentImpl( +class _$CompetitionImpl extends _Competition { + const _$CompetitionImpl( {this.id, required this.name, required this.boutConfig, @@ -214,8 +214,8 @@ class _$TournamentImpl extends _Tournament { this.comment}) : super._(); - factory _$TournamentImpl.fromJson(Map json) => - _$$TournamentImplFromJson(json); + factory _$CompetitionImpl.fromJson(Map json) => + _$$CompetitionImplFromJson(json); @override final int? id; @@ -236,14 +236,14 @@ class _$TournamentImpl extends _Tournament { @override String toString() { - return 'Tournament(id: $id, name: $name, boutConfig: $boutConfig, location: $location, date: $date, no: $no, visitorsCount: $visitorsCount, comment: $comment)'; + return 'Competition(id: $id, name: $name, boutConfig: $boutConfig, location: $location, date: $date, no: $no, visitorsCount: $visitorsCount, comment: $comment)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$TournamentImpl && + other is _$CompetitionImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.boutConfig, boutConfig) || @@ -265,19 +265,19 @@ class _$TournamentImpl extends _Tournament { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$TournamentImplCopyWith<_$TournamentImpl> get copyWith => - __$$TournamentImplCopyWithImpl<_$TournamentImpl>(this, _$identity); + _$$CompetitionImplCopyWith<_$CompetitionImpl> get copyWith => + __$$CompetitionImplCopyWithImpl<_$CompetitionImpl>(this, _$identity); @override Map toJson() { - return _$$TournamentImplToJson( + return _$$CompetitionImplToJson( this, ); } } -abstract class _Tournament extends Tournament { - const factory _Tournament( +abstract class _Competition extends Competition { + const factory _Competition( {final int? id, required final String name, required final BoutConfig boutConfig, @@ -285,11 +285,11 @@ abstract class _Tournament extends Tournament { required final DateTime date, final String? no, final int? visitorsCount, - final String? comment}) = _$TournamentImpl; - const _Tournament._() : super._(); + final String? comment}) = _$CompetitionImpl; + const _Competition._() : super._(); - factory _Tournament.fromJson(Map json) = - _$TournamentImpl.fromJson; + factory _Competition.fromJson(Map json) = + _$CompetitionImpl.fromJson; @override int? get id; @@ -309,6 +309,6 @@ abstract class _Tournament extends Tournament { String? get comment; @override @JsonKey(ignore: true) - _$$TournamentImplCopyWith<_$TournamentImpl> get copyWith => + _$$CompetitionImplCopyWith<_$CompetitionImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.g.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition.g.dart similarity index 82% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament.g.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition.g.dart index de611037..bb24d7f3 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.g.dart @@ -1,13 +1,13 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'tournament.dart'; +part of 'competition.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_$TournamentImpl _$$TournamentImplFromJson(Map json) => - _$TournamentImpl( +_$CompetitionImpl _$$CompetitionImplFromJson(Map json) => + _$CompetitionImpl( id: json['id'] as int?, name: json['name'] as String, boutConfig: @@ -19,7 +19,7 @@ _$TournamentImpl _$$TournamentImplFromJson(Map json) => comment: json['comment'] as String?, ); -Map _$$TournamentImplToJson(_$TournamentImpl instance) => +Map _$$CompetitionImplToJson(_$CompetitionImpl instance) => { 'id': instance.id, 'name': instance.name, diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart new file mode 100644 index 00000000..ea4f5cad --- /dev/null +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.dart @@ -0,0 +1,49 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../data_object.dart'; +import '../bout.dart'; +import 'competition.dart'; + +part 'competition_bout.freezed.dart'; +part 'competition_bout.g.dart'; + +@freezed +class CompetitionBout with _$CompetitionBout implements DataObject { + const CompetitionBout._(); + + const factory CompetitionBout({ + int? id, + required Competition competition, + required Bout bout, + }) = _CompetitionBout; + + factory CompetitionBout.fromJson(Map json) => _$CompetitionBoutFromJson(json); + + static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async { + final competition = await getSingle(e['competition_id'] as int); + final bout = await getSingle(e['bout_id'] as int); + + return CompetitionBout( + id: e['id'] as int?, + competition: competition!, + bout: bout!, + ); + } + + @override + Map toRaw() { + return { + if (id != null) 'id': id, + 'competition_id': competition.id, + 'bout_id': bout.id, + }; + } + + @override + String get tableName => 'competition_bout'; + + @override + CompetitionBout copyWithId(int? id) { + return copyWith(id: id); + } +} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart similarity index 51% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.freezed.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart index 9453b8e5..0b5646e7 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'tournament_bout.dart'; +part of 'competition_bout.dart'; // ************************************************************************** // FreezedGenerator @@ -14,38 +14,38 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); -TournamentBout _$TournamentBoutFromJson(Map json) { - return _TournamentBout.fromJson(json); +CompetitionBout _$CompetitionBoutFromJson(Map json) { + return _CompetitionBout.fromJson(json); } /// @nodoc -mixin _$TournamentBout { +mixin _$CompetitionBout { int? get id => throw _privateConstructorUsedError; - Tournament get tournament => throw _privateConstructorUsedError; + Competition get competition => throw _privateConstructorUsedError; Bout get bout => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $TournamentBoutCopyWith get copyWith => + $CompetitionBoutCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $TournamentBoutCopyWith<$Res> { - factory $TournamentBoutCopyWith( - TournamentBout value, $Res Function(TournamentBout) then) = - _$TournamentBoutCopyWithImpl<$Res, TournamentBout>; +abstract class $CompetitionBoutCopyWith<$Res> { + factory $CompetitionBoutCopyWith( + CompetitionBout value, $Res Function(CompetitionBout) then) = + _$CompetitionBoutCopyWithImpl<$Res, CompetitionBout>; @useResult - $Res call({int? id, Tournament tournament, Bout bout}); + $Res call({int? id, Competition competition, Bout bout}); - $TournamentCopyWith<$Res> get tournament; + $CompetitionCopyWith<$Res> get competition; $BoutCopyWith<$Res> get bout; } /// @nodoc -class _$TournamentBoutCopyWithImpl<$Res, $Val extends TournamentBout> - implements $TournamentBoutCopyWith<$Res> { - _$TournamentBoutCopyWithImpl(this._value, this._then); +class _$CompetitionBoutCopyWithImpl<$Res, $Val extends CompetitionBout> + implements $CompetitionBoutCopyWith<$Res> { + _$CompetitionBoutCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -56,7 +56,7 @@ class _$TournamentBoutCopyWithImpl<$Res, $Val extends TournamentBout> @override $Res call({ Object? id = freezed, - Object? tournament = null, + Object? competition = null, Object? bout = null, }) { return _then(_value.copyWith( @@ -64,10 +64,10 @@ class _$TournamentBoutCopyWithImpl<$Res, $Val extends TournamentBout> ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, bout: null == bout ? _value.bout : bout // ignore: cast_nullable_to_non_nullable @@ -77,9 +77,9 @@ class _$TournamentBoutCopyWithImpl<$Res, $Val extends TournamentBout> @override @pragma('vm:prefer-inline') - $TournamentCopyWith<$Res> get tournament { - return $TournamentCopyWith<$Res>(_value.tournament, (value) { - return _then(_value.copyWith(tournament: value) as $Val); + $CompetitionCopyWith<$Res> get competition { + return $CompetitionCopyWith<$Res>(_value.competition, (value) { + return _then(_value.copyWith(competition: value) as $Val); }); } @@ -93,45 +93,45 @@ class _$TournamentBoutCopyWithImpl<$Res, $Val extends TournamentBout> } /// @nodoc -abstract class _$$TournamentBoutImplCopyWith<$Res> - implements $TournamentBoutCopyWith<$Res> { - factory _$$TournamentBoutImplCopyWith(_$TournamentBoutImpl value, - $Res Function(_$TournamentBoutImpl) then) = - __$$TournamentBoutImplCopyWithImpl<$Res>; +abstract class _$$CompetitionBoutImplCopyWith<$Res> + implements $CompetitionBoutCopyWith<$Res> { + factory _$$CompetitionBoutImplCopyWith(_$CompetitionBoutImpl value, + $Res Function(_$CompetitionBoutImpl) then) = + __$$CompetitionBoutImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? id, Tournament tournament, Bout bout}); + $Res call({int? id, Competition competition, Bout bout}); @override - $TournamentCopyWith<$Res> get tournament; + $CompetitionCopyWith<$Res> get competition; @override $BoutCopyWith<$Res> get bout; } /// @nodoc -class __$$TournamentBoutImplCopyWithImpl<$Res> - extends _$TournamentBoutCopyWithImpl<$Res, _$TournamentBoutImpl> - implements _$$TournamentBoutImplCopyWith<$Res> { - __$$TournamentBoutImplCopyWithImpl( - _$TournamentBoutImpl _value, $Res Function(_$TournamentBoutImpl) _then) +class __$$CompetitionBoutImplCopyWithImpl<$Res> + extends _$CompetitionBoutCopyWithImpl<$Res, _$CompetitionBoutImpl> + implements _$$CompetitionBoutImplCopyWith<$Res> { + __$$CompetitionBoutImplCopyWithImpl( + _$CompetitionBoutImpl _value, $Res Function(_$CompetitionBoutImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ Object? id = freezed, - Object? tournament = null, + Object? competition = null, Object? bout = null, }) { - return _then(_$TournamentBoutImpl( + return _then(_$CompetitionBoutImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, bout: null == bout ? _value.bout : bout // ignore: cast_nullable_to_non_nullable @@ -142,74 +142,74 @@ class __$$TournamentBoutImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$TournamentBoutImpl extends _TournamentBout { - const _$TournamentBoutImpl( - {this.id, required this.tournament, required this.bout}) +class _$CompetitionBoutImpl extends _CompetitionBout { + const _$CompetitionBoutImpl( + {this.id, required this.competition, required this.bout}) : super._(); - factory _$TournamentBoutImpl.fromJson(Map json) => - _$$TournamentBoutImplFromJson(json); + factory _$CompetitionBoutImpl.fromJson(Map json) => + _$$CompetitionBoutImplFromJson(json); @override final int? id; @override - final Tournament tournament; + final Competition competition; @override final Bout bout; @override String toString() { - return 'TournamentBout(id: $id, tournament: $tournament, bout: $bout)'; + return 'CompetitionBout(id: $id, competition: $competition, bout: $bout)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$TournamentBoutImpl && + other is _$CompetitionBoutImpl && (identical(other.id, id) || other.id == id) && - (identical(other.tournament, tournament) || - other.tournament == tournament) && + (identical(other.competition, competition) || + other.competition == competition) && (identical(other.bout, bout) || other.bout == bout)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, tournament, bout); + int get hashCode => Object.hash(runtimeType, id, competition, bout); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$TournamentBoutImplCopyWith<_$TournamentBoutImpl> get copyWith => - __$$TournamentBoutImplCopyWithImpl<_$TournamentBoutImpl>( + _$$CompetitionBoutImplCopyWith<_$CompetitionBoutImpl> get copyWith => + __$$CompetitionBoutImplCopyWithImpl<_$CompetitionBoutImpl>( this, _$identity); @override Map toJson() { - return _$$TournamentBoutImplToJson( + return _$$CompetitionBoutImplToJson( this, ); } } -abstract class _TournamentBout extends TournamentBout { - const factory _TournamentBout( +abstract class _CompetitionBout extends CompetitionBout { + const factory _CompetitionBout( {final int? id, - required final Tournament tournament, - required final Bout bout}) = _$TournamentBoutImpl; - const _TournamentBout._() : super._(); + required final Competition competition, + required final Bout bout}) = _$CompetitionBoutImpl; + const _CompetitionBout._() : super._(); - factory _TournamentBout.fromJson(Map json) = - _$TournamentBoutImpl.fromJson; + factory _CompetitionBout.fromJson(Map json) = + _$CompetitionBoutImpl.fromJson; @override int? get id; @override - Tournament get tournament; + Competition get competition; @override Bout get bout; @override @JsonKey(ignore: true) - _$$TournamentBoutImplCopyWith<_$TournamentBoutImpl> get copyWith => + _$$CompetitionBoutImplCopyWith<_$CompetitionBoutImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.g.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.g.dart similarity index 56% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.g.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition_bout.g.dart index 4e2b27ef..ff796f26 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.g.dart @@ -1,24 +1,24 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'tournament_bout.dart'; +part of 'competition_bout.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_$TournamentBoutImpl _$$TournamentBoutImplFromJson( +_$CompetitionBoutImpl _$$CompetitionBoutImplFromJson( Map json) => - _$TournamentBoutImpl( + _$CompetitionBoutImpl( id: json['id'] as int?, - tournament: - Tournament.fromJson(json['tournament'] as Map), + competition: + Competition.fromJson(json['competition'] as Map), bout: Bout.fromJson(json['bout'] as Map), ); -Map _$$TournamentBoutImplToJson( - _$TournamentBoutImpl instance) => +Map _$$CompetitionBoutImplToJson( + _$CompetitionBoutImpl instance) => { 'id': instance.id, - 'tournament': instance.tournament.toJson(), + 'competition': instance.competition.toJson(), 'bout': instance.bout.toJson(), }; diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart new file mode 100644 index 00000000..85db2d89 --- /dev/null +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.dart @@ -0,0 +1,50 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../enums/person_role.dart'; +import '../data_object.dart'; +import '../person.dart'; +import 'competition.dart'; + +part 'competition_person.freezed.dart'; +part 'competition_person.g.dart'; + +/// An action and its value that is fulfilled by the participant during a bout, e.g. points or caution +@freezed +class CompetitionPerson with _$CompetitionPerson implements DataObject { + const CompetitionPerson._(); + + const factory CompetitionPerson({ + int? id, + required Competition competition, + required Person person, + required PersonRole role, + }) = _CompetitionPerson; + + factory CompetitionPerson.fromJson(Map json) => _$CompetitionPersonFromJson(json); + + static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async => + CompetitionPerson( + id: e['id'] as int?, + competition: (await getSingle(e['competition_id'] as int))!, + person: (await getSingle(e['person_id'] as int))!, + role: PersonRoleParser.valueOf(e['person_role']), + ); + + @override + Map toRaw() { + return { + if (id != null) 'id': id, + 'competition_id': competition.id, + 'person_id': person.id, + 'person_role': role.name, + }; + } + + @override + String get tableName => 'competition_person'; + + @override + CompetitionPerson copyWithId(int? id) { + return copyWith(id: id); + } +} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart similarity index 54% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.freezed.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart index eb7074cd..d1b40c4c 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'tournament_person.dart'; +part of 'competition_person.dart'; // ************************************************************************** // FreezedGenerator @@ -14,39 +14,39 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); -TournamentPerson _$TournamentPersonFromJson(Map json) { - return _TournamentPerson.fromJson(json); +CompetitionPerson _$CompetitionPersonFromJson(Map json) { + return _CompetitionPerson.fromJson(json); } /// @nodoc -mixin _$TournamentPerson { +mixin _$CompetitionPerson { int? get id => throw _privateConstructorUsedError; - Tournament get tournament => throw _privateConstructorUsedError; + Competition get competition => throw _privateConstructorUsedError; Person get person => throw _privateConstructorUsedError; PersonRole get role => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $TournamentPersonCopyWith get copyWith => + $CompetitionPersonCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $TournamentPersonCopyWith<$Res> { - factory $TournamentPersonCopyWith( - TournamentPerson value, $Res Function(TournamentPerson) then) = - _$TournamentPersonCopyWithImpl<$Res, TournamentPerson>; +abstract class $CompetitionPersonCopyWith<$Res> { + factory $CompetitionPersonCopyWith( + CompetitionPerson value, $Res Function(CompetitionPerson) then) = + _$CompetitionPersonCopyWithImpl<$Res, CompetitionPerson>; @useResult - $Res call({int? id, Tournament tournament, Person person, PersonRole role}); + $Res call({int? id, Competition competition, Person person, PersonRole role}); - $TournamentCopyWith<$Res> get tournament; + $CompetitionCopyWith<$Res> get competition; $PersonCopyWith<$Res> get person; } /// @nodoc -class _$TournamentPersonCopyWithImpl<$Res, $Val extends TournamentPerson> - implements $TournamentPersonCopyWith<$Res> { - _$TournamentPersonCopyWithImpl(this._value, this._then); +class _$CompetitionPersonCopyWithImpl<$Res, $Val extends CompetitionPerson> + implements $CompetitionPersonCopyWith<$Res> { + _$CompetitionPersonCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -57,7 +57,7 @@ class _$TournamentPersonCopyWithImpl<$Res, $Val extends TournamentPerson> @override $Res call({ Object? id = freezed, - Object? tournament = null, + Object? competition = null, Object? person = null, Object? role = null, }) { @@ -66,10 +66,10 @@ class _$TournamentPersonCopyWithImpl<$Res, $Val extends TournamentPerson> ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, person: null == person ? _value.person : person // ignore: cast_nullable_to_non_nullable @@ -83,9 +83,9 @@ class _$TournamentPersonCopyWithImpl<$Res, $Val extends TournamentPerson> @override @pragma('vm:prefer-inline') - $TournamentCopyWith<$Res> get tournament { - return $TournamentCopyWith<$Res>(_value.tournament, (value) { - return _then(_value.copyWith(tournament: value) as $Val); + $CompetitionCopyWith<$Res> get competition { + return $CompetitionCopyWith<$Res>(_value.competition, (value) { + return _then(_value.copyWith(competition: value) as $Val); }); } @@ -99,46 +99,46 @@ class _$TournamentPersonCopyWithImpl<$Res, $Val extends TournamentPerson> } /// @nodoc -abstract class _$$TournamentPersonImplCopyWith<$Res> - implements $TournamentPersonCopyWith<$Res> { - factory _$$TournamentPersonImplCopyWith(_$TournamentPersonImpl value, - $Res Function(_$TournamentPersonImpl) then) = - __$$TournamentPersonImplCopyWithImpl<$Res>; +abstract class _$$CompetitionPersonImplCopyWith<$Res> + implements $CompetitionPersonCopyWith<$Res> { + factory _$$CompetitionPersonImplCopyWith(_$CompetitionPersonImpl value, + $Res Function(_$CompetitionPersonImpl) then) = + __$$CompetitionPersonImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? id, Tournament tournament, Person person, PersonRole role}); + $Res call({int? id, Competition competition, Person person, PersonRole role}); @override - $TournamentCopyWith<$Res> get tournament; + $CompetitionCopyWith<$Res> get competition; @override $PersonCopyWith<$Res> get person; } /// @nodoc -class __$$TournamentPersonImplCopyWithImpl<$Res> - extends _$TournamentPersonCopyWithImpl<$Res, _$TournamentPersonImpl> - implements _$$TournamentPersonImplCopyWith<$Res> { - __$$TournamentPersonImplCopyWithImpl(_$TournamentPersonImpl _value, - $Res Function(_$TournamentPersonImpl) _then) +class __$$CompetitionPersonImplCopyWithImpl<$Res> + extends _$CompetitionPersonCopyWithImpl<$Res, _$CompetitionPersonImpl> + implements _$$CompetitionPersonImplCopyWith<$Res> { + __$$CompetitionPersonImplCopyWithImpl(_$CompetitionPersonImpl _value, + $Res Function(_$CompetitionPersonImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ Object? id = freezed, - Object? tournament = null, + Object? competition = null, Object? person = null, Object? role = null, }) { - return _then(_$TournamentPersonImpl( + return _then(_$CompetitionPersonImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, person: null == person ? _value.person : person // ignore: cast_nullable_to_non_nullable @@ -153,21 +153,21 @@ class __$$TournamentPersonImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$TournamentPersonImpl extends _TournamentPerson { - const _$TournamentPersonImpl( +class _$CompetitionPersonImpl extends _CompetitionPerson { + const _$CompetitionPersonImpl( {this.id, - required this.tournament, + required this.competition, required this.person, required this.role}) : super._(); - factory _$TournamentPersonImpl.fromJson(Map json) => - _$$TournamentPersonImplFromJson(json); + factory _$CompetitionPersonImpl.fromJson(Map json) => + _$$CompetitionPersonImplFromJson(json); @override final int? id; @override - final Tournament tournament; + final Competition competition; @override final Person person; @override @@ -175,61 +175,61 @@ class _$TournamentPersonImpl extends _TournamentPerson { @override String toString() { - return 'TournamentPerson(id: $id, tournament: $tournament, person: $person, role: $role)'; + return 'CompetitionPerson(id: $id, competition: $competition, person: $person, role: $role)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$TournamentPersonImpl && + other is _$CompetitionPersonImpl && (identical(other.id, id) || other.id == id) && - (identical(other.tournament, tournament) || - other.tournament == tournament) && + (identical(other.competition, competition) || + other.competition == competition) && (identical(other.person, person) || other.person == person) && (identical(other.role, role) || other.role == role)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, tournament, person, role); + int get hashCode => Object.hash(runtimeType, id, competition, person, role); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$TournamentPersonImplCopyWith<_$TournamentPersonImpl> get copyWith => - __$$TournamentPersonImplCopyWithImpl<_$TournamentPersonImpl>( + _$$CompetitionPersonImplCopyWith<_$CompetitionPersonImpl> get copyWith => + __$$CompetitionPersonImplCopyWithImpl<_$CompetitionPersonImpl>( this, _$identity); @override Map toJson() { - return _$$TournamentPersonImplToJson( + return _$$CompetitionPersonImplToJson( this, ); } } -abstract class _TournamentPerson extends TournamentPerson { - const factory _TournamentPerson( +abstract class _CompetitionPerson extends CompetitionPerson { + const factory _CompetitionPerson( {final int? id, - required final Tournament tournament, + required final Competition competition, required final Person person, - required final PersonRole role}) = _$TournamentPersonImpl; - const _TournamentPerson._() : super._(); + required final PersonRole role}) = _$CompetitionPersonImpl; + const _CompetitionPerson._() : super._(); - factory _TournamentPerson.fromJson(Map json) = - _$TournamentPersonImpl.fromJson; + factory _CompetitionPerson.fromJson(Map json) = + _$CompetitionPersonImpl.fromJson; @override int? get id; @override - Tournament get tournament; + Competition get competition; @override Person get person; @override PersonRole get role; @override @JsonKey(ignore: true) - _$$TournamentPersonImplCopyWith<_$TournamentPersonImpl> get copyWith => + _$$CompetitionPersonImplCopyWith<_$CompetitionPersonImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.g.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.g.dart similarity index 69% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.g.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition_person.g.dart index 5becf2f0..927bd455 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.g.dart @@ -1,26 +1,26 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'tournament_person.dart'; +part of 'competition_person.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_$TournamentPersonImpl _$$TournamentPersonImplFromJson( +_$CompetitionPersonImpl _$$CompetitionPersonImplFromJson( Map json) => - _$TournamentPersonImpl( + _$CompetitionPersonImpl( id: json['id'] as int?, - tournament: - Tournament.fromJson(json['tournament'] as Map), + competition: + Competition.fromJson(json['competition'] as Map), person: Person.fromJson(json['person'] as Map), role: $enumDecode(_$PersonRoleEnumMap, json['role']), ); -Map _$$TournamentPersonImplToJson( - _$TournamentPersonImpl instance) => +Map _$$CompetitionPersonImplToJson( + _$CompetitionPersonImpl instance) => { 'id': instance.id, - 'tournament': instance.tournament.toJson(), + 'competition': instance.competition.toJson(), 'person': instance.person.toJson(), 'role': _$PersonRoleEnumMap[instance.role]!, }; 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 new file mode 100644 index 00000000..032cb52b --- /dev/null +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.dart @@ -0,0 +1,47 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../data_object.dart'; +import '../team.dart'; +import 'competition.dart'; + +part 'competition_team_participation.freezed.dart'; +part 'competition_team_participation.g.dart'; + +/// Team participates in a competition. +@freezed +class CompetitionTeamParticipation with _$CompetitionTeamParticipation implements DataObject { + const CompetitionTeamParticipation._(); + + const factory CompetitionTeamParticipation({ + int? id, + required Competition competition, + required Team team, + }) = _CompetitionTeamParticipation; + + factory CompetitionTeamParticipation.fromJson(Map json) => + _$CompetitionTeamParticipationFromJson(json); + + @override + Map toRaw() { + return { + if (id != null) 'id': id, + 'competition_id': competition.id, + 'team_id': team.id, + }; + } + + static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async => + CompetitionTeamParticipation( + id: e['id'] as int?, + competition: (await getSingle(e['competition_id'] as int))!, + team: (await getSingle(e['team_id'] as int))!, + ); + + @override + String get tableName => 'competition_team_participation'; + + @override + CompetitionTeamParticipation copyWithId(int? id) { + return copyWith(id: id); + } +} diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart new file mode 100644 index 00000000..1741e39f --- /dev/null +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart @@ -0,0 +1,224 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'competition_team_participation.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +CompetitionTeamParticipation _$CompetitionTeamParticipationFromJson( + Map json) { + return _CompetitionTeamParticipation.fromJson(json); +} + +/// @nodoc +mixin _$CompetitionTeamParticipation { + int? get id => throw _privateConstructorUsedError; + Competition get competition => throw _privateConstructorUsedError; + Team get team => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CompetitionTeamParticipationCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CompetitionTeamParticipationCopyWith<$Res> { + factory $CompetitionTeamParticipationCopyWith( + CompetitionTeamParticipation value, + $Res Function(CompetitionTeamParticipation) then) = + _$CompetitionTeamParticipationCopyWithImpl<$Res, + CompetitionTeamParticipation>; + @useResult + $Res call({int? id, Competition competition, Team team}); + + $CompetitionCopyWith<$Res> get competition; + $TeamCopyWith<$Res> get team; +} + +/// @nodoc +class _$CompetitionTeamParticipationCopyWithImpl<$Res, + $Val extends CompetitionTeamParticipation> + implements $CompetitionTeamParticipationCopyWith<$Res> { + _$CompetitionTeamParticipationCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? competition = null, + Object? team = null, + }) { + return _then(_value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, + team: null == team + ? _value.team + : team // ignore: cast_nullable_to_non_nullable + as Team, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $CompetitionCopyWith<$Res> get competition { + return $CompetitionCopyWith<$Res>(_value.competition, (value) { + return _then(_value.copyWith(competition: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $TeamCopyWith<$Res> get team { + return $TeamCopyWith<$Res>(_value.team, (value) { + return _then(_value.copyWith(team: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$CompetitionTeamParticipationImplCopyWith<$Res> + implements $CompetitionTeamParticipationCopyWith<$Res> { + factory _$$CompetitionTeamParticipationImplCopyWith( + _$CompetitionTeamParticipationImpl value, + $Res Function(_$CompetitionTeamParticipationImpl) then) = + __$$CompetitionTeamParticipationImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? id, Competition competition, Team team}); + + @override + $CompetitionCopyWith<$Res> get competition; + @override + $TeamCopyWith<$Res> get team; +} + +/// @nodoc +class __$$CompetitionTeamParticipationImplCopyWithImpl<$Res> + extends _$CompetitionTeamParticipationCopyWithImpl<$Res, + _$CompetitionTeamParticipationImpl> + implements _$$CompetitionTeamParticipationImplCopyWith<$Res> { + __$$CompetitionTeamParticipationImplCopyWithImpl( + _$CompetitionTeamParticipationImpl _value, + $Res Function(_$CompetitionTeamParticipationImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? competition = null, + Object? team = null, + }) { + return _then(_$CompetitionTeamParticipationImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + competition: null == competition + ? _value.competition + : competition // ignore: cast_nullable_to_non_nullable + as Competition, + team: null == team + ? _value.team + : team // ignore: cast_nullable_to_non_nullable + as Team, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$CompetitionTeamParticipationImpl extends _CompetitionTeamParticipation { + const _$CompetitionTeamParticipationImpl( + {this.id, required this.competition, required this.team}) + : super._(); + + factory _$CompetitionTeamParticipationImpl.fromJson( + Map json) => + _$$CompetitionTeamParticipationImplFromJson(json); + + @override + final int? id; + @override + final Competition competition; + @override + final Team team; + + @override + String toString() { + return 'CompetitionTeamParticipation(id: $id, competition: $competition, team: $team)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$CompetitionTeamParticipationImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.competition, competition) || + other.competition == competition) && + (identical(other.team, team) || other.team == team)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, competition, team); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$CompetitionTeamParticipationImplCopyWith<_$CompetitionTeamParticipationImpl> + get copyWith => __$$CompetitionTeamParticipationImplCopyWithImpl< + _$CompetitionTeamParticipationImpl>(this, _$identity); + + @override + Map toJson() { + return _$$CompetitionTeamParticipationImplToJson( + this, + ); + } +} + +abstract class _CompetitionTeamParticipation + extends CompetitionTeamParticipation { + const factory _CompetitionTeamParticipation( + {final int? id, + required final Competition competition, + required final Team team}) = _$CompetitionTeamParticipationImpl; + const _CompetitionTeamParticipation._() : super._(); + + factory _CompetitionTeamParticipation.fromJson(Map json) = + _$CompetitionTeamParticipationImpl.fromJson; + + @override + int? get id; + @override + Competition get competition; + @override + Team get team; + @override + @JsonKey(ignore: true) + _$$CompetitionTeamParticipationImplCopyWith<_$CompetitionTeamParticipationImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.g.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.g.dart similarity index 51% rename from wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.g.dart rename to wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.g.dart index de6f89f4..d8c906cd 100644 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.g.dart @@ -1,24 +1,24 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'tournament_team_participation.dart'; +part of 'competition_team_participation.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_$TournamentTeamParticipationImpl _$$TournamentTeamParticipationImplFromJson( +_$CompetitionTeamParticipationImpl _$$CompetitionTeamParticipationImplFromJson( Map json) => - _$TournamentTeamParticipationImpl( + _$CompetitionTeamParticipationImpl( id: json['id'] as int?, - tournament: - Tournament.fromJson(json['tournament'] as Map), + competition: + Competition.fromJson(json['competition'] as Map), team: Team.fromJson(json['team'] as Map), ); -Map _$$TournamentTeamParticipationImplToJson( - _$TournamentTeamParticipationImpl instance) => +Map _$$CompetitionTeamParticipationImplToJson( + _$CompetitionTeamParticipationImpl instance) => { 'id': instance.id, - 'tournament': instance.tournament.toJson(), + 'competition': instance.competition.toJson(), 'team': instance.team.toJson(), }; diff --git a/wrestling_scoreboard_common/lib/src/data/data_object.dart b/wrestling_scoreboard_common/lib/src/data/data_object.dart index a4fe4c25..6d26484f 100644 --- a/wrestling_scoreboard_common/lib/src/data/data_object.dart +++ b/wrestling_scoreboard_common/lib/src/data/data_object.dart @@ -46,14 +46,14 @@ abstract class DataObject { return TeamMatch.fromJson(json) as T; case const (TeamMatchBout): return TeamMatchBout.fromJson(json) as T; - case const (Tournament): - return Tournament.fromJson(json) as T; - case const (TournamentBout): - return TournamentBout.fromJson(json) as T; - case const (TournamentPerson): - return TournamentPerson.fromJson(json) as T; - case const (TournamentTeamParticipation): - return TournamentTeamParticipation.fromJson(json) as T; + case const (Competition): + return Competition.fromJson(json) as T; + case const (CompetitionBout): + return CompetitionBout.fromJson(json) as T; + case const (CompetitionPerson): + return CompetitionPerson.fromJson(json) as T; + case const (CompetitionTeamParticipation): + return CompetitionTeamParticipation.fromJson(json) as T; case const (WeightClass): return WeightClass.fromJson(json) as T; default: @@ -93,12 +93,12 @@ abstract class DataObject { return (await TeamMatch.fromRaw(raw, getSingle)) as T; case const (TeamMatchBout): return (await TeamMatchBout.fromRaw(raw, getSingle)) as T; - case const (Tournament): - return (await Tournament.fromRaw(raw, getSingle)) as T; - case const (TournamentPerson): - return (await TournamentPerson.fromRaw(raw, getSingle)) as T; - case const (TournamentTeamParticipation): - return (await TournamentTeamParticipation.fromRaw(raw, getSingle)) as T; + case const (Competition): + return (await Competition.fromRaw(raw, getSingle)) as T; + case const (CompetitionPerson): + return (await CompetitionPerson.fromRaw(raw, getSingle)) as T; + case const (CompetitionTeamParticipation): + return (await CompetitionTeamParticipation.fromRaw(raw, getSingle)) as T; case const (WeightClass): return (await WeightClass.fromRaw(raw)) as T; default: diff --git a/wrestling_scoreboard_common/lib/src/data/lineup.dart b/wrestling_scoreboard_common/lib/src/data/lineup.dart index a25f8639..e0f2f784 100644 --- a/wrestling_scoreboard_common/lib/src/data/lineup.dart +++ b/wrestling_scoreboard_common/lib/src/data/lineup.dart @@ -7,7 +7,7 @@ import 'team.dart'; part 'lineup.freezed.dart'; part 'lineup.g.dart'; -/// The lineup for a team match or tournament. +/// The lineup for a team match or competition. @freezed class Lineup with _$Lineup implements DataObject { const Lineup._(); diff --git a/wrestling_scoreboard_common/lib/src/data/participation.dart b/wrestling_scoreboard_common/lib/src/data/participation.dart index 0a36e7cd..88629087 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.dart @@ -8,7 +8,7 @@ import 'weight_class.dart'; part 'participation.freezed.dart'; part 'participation.g.dart'; -/// The participation of a person (member) on a team match or tournament through the teams lineup. +/// The participation of a person (member) on a team match or competition through the teams lineup. /// A person can participate in multiple weight classes, if wanted. But they only have to weight once. @freezed class Participation with _$Participation implements DataObject { diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.dart b/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.dart deleted file mode 100644 index 88883c86..00000000 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_bout.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -import '../data_object.dart'; -import '../bout.dart'; -import 'tournament.dart'; - -part 'tournament_bout.freezed.dart'; -part 'tournament_bout.g.dart'; - -@freezed -class TournamentBout with _$TournamentBout implements DataObject { - const TournamentBout._(); - - const factory TournamentBout({ - int? id, - required Tournament tournament, - required Bout bout, - }) = _TournamentBout; - - factory TournamentBout.fromJson(Map json) => _$TournamentBoutFromJson(json); - - static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async { - final tournament = await getSingle(e['tournament_id'] as int); - final bout = await getSingle(e['bout_id'] as int); - - return TournamentBout( - id: e['id'] as int?, - tournament: tournament!, - bout: bout!, - ); - } - - @override - Map toRaw() { - return { - if (id != null) 'id': id, - 'tournament_id': tournament.id, - 'bout_id': bout.id, - }; - } - - @override - String get tableName => 'tournament_bout'; - - @override - TournamentBout copyWithId(int? id) { - return copyWith(id: id); - } -} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.dart b/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.dart deleted file mode 100644 index 0fed5495..00000000 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_person.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -import '../../enums/person_role.dart'; -import '../data_object.dart'; -import '../person.dart'; -import 'tournament.dart'; - -part 'tournament_person.freezed.dart'; -part 'tournament_person.g.dart'; - -/// An action and its value that is fulfilled by the participant during a bout, e.g. points or caution -@freezed -class TournamentPerson with _$TournamentPerson implements DataObject { - const TournamentPerson._(); - - const factory TournamentPerson({ - int? id, - required Tournament tournament, - required Person person, - required PersonRole role, - }) = _TournamentPerson; - - factory TournamentPerson.fromJson(Map json) => _$TournamentPersonFromJson(json); - - static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async => - TournamentPerson( - id: e['id'] as int?, - tournament: (await getSingle(e['tournament_id'] as int))!, - person: (await getSingle(e['person_id'] as int))!, - role: PersonRoleParser.valueOf(e['person_role']), - ); - - @override - Map toRaw() { - return { - if (id != null) 'id': id, - 'tournament_id': tournament.id, - 'person_id': person.id, - 'person_role': role.name, - }; - } - - @override - String get tableName => 'tournament_person'; - - @override - TournamentPerson copyWithId(int? id) { - return copyWith(id: id); - } -} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.dart b/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.dart deleted file mode 100644 index 4ac12bff..00000000 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -import '../data_object.dart'; -import '../team.dart'; -import 'tournament.dart'; - -part 'tournament_team_participation.freezed.dart'; -part 'tournament_team_participation.g.dart'; - -/// Team participates in a tournament. -@freezed -class TournamentTeamParticipation with _$TournamentTeamParticipation implements DataObject { - const TournamentTeamParticipation._(); - - const factory TournamentTeamParticipation({ - int? id, - required Tournament tournament, - required Team team, - }) = _TournamentTeamParticipation; - - factory TournamentTeamParticipation.fromJson(Map json) => - _$TournamentTeamParticipationFromJson(json); - - @override - Map toRaw() { - return { - if (id != null) 'id': id, - 'tournament_id': tournament.id, - 'team_id': team.id, - }; - } - - static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async => - TournamentTeamParticipation( - id: e['id'] as int?, - tournament: (await getSingle(e['tournament_id'] as int))!, - team: (await getSingle(e['team_id'] as int))!, - ); - - @override - String get tableName => 'tournament_team_participation'; - - @override - TournamentTeamParticipation copyWithId(int? id) { - return copyWith(id: id); - } -} diff --git a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.freezed.dart deleted file mode 100644 index 69e148ef..00000000 --- a/wrestling_scoreboard_common/lib/src/data/tournament/tournament_team_participation.freezed.dart +++ /dev/null @@ -1,224 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'tournament_team_participation.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); - -TournamentTeamParticipation _$TournamentTeamParticipationFromJson( - Map json) { - return _TournamentTeamParticipation.fromJson(json); -} - -/// @nodoc -mixin _$TournamentTeamParticipation { - int? get id => throw _privateConstructorUsedError; - Tournament get tournament => throw _privateConstructorUsedError; - Team get team => throw _privateConstructorUsedError; - - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $TournamentTeamParticipationCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $TournamentTeamParticipationCopyWith<$Res> { - factory $TournamentTeamParticipationCopyWith( - TournamentTeamParticipation value, - $Res Function(TournamentTeamParticipation) then) = - _$TournamentTeamParticipationCopyWithImpl<$Res, - TournamentTeamParticipation>; - @useResult - $Res call({int? id, Tournament tournament, Team team}); - - $TournamentCopyWith<$Res> get tournament; - $TeamCopyWith<$Res> get team; -} - -/// @nodoc -class _$TournamentTeamParticipationCopyWithImpl<$Res, - $Val extends TournamentTeamParticipation> - implements $TournamentTeamParticipationCopyWith<$Res> { - _$TournamentTeamParticipationCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? tournament = null, - Object? team = null, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, - team: null == team - ? _value.team - : team // ignore: cast_nullable_to_non_nullable - as Team, - ) as $Val); - } - - @override - @pragma('vm:prefer-inline') - $TournamentCopyWith<$Res> get tournament { - return $TournamentCopyWith<$Res>(_value.tournament, (value) { - return _then(_value.copyWith(tournament: value) as $Val); - }); - } - - @override - @pragma('vm:prefer-inline') - $TeamCopyWith<$Res> get team { - return $TeamCopyWith<$Res>(_value.team, (value) { - return _then(_value.copyWith(team: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$TournamentTeamParticipationImplCopyWith<$Res> - implements $TournamentTeamParticipationCopyWith<$Res> { - factory _$$TournamentTeamParticipationImplCopyWith( - _$TournamentTeamParticipationImpl value, - $Res Function(_$TournamentTeamParticipationImpl) then) = - __$$TournamentTeamParticipationImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({int? id, Tournament tournament, Team team}); - - @override - $TournamentCopyWith<$Res> get tournament; - @override - $TeamCopyWith<$Res> get team; -} - -/// @nodoc -class __$$TournamentTeamParticipationImplCopyWithImpl<$Res> - extends _$TournamentTeamParticipationCopyWithImpl<$Res, - _$TournamentTeamParticipationImpl> - implements _$$TournamentTeamParticipationImplCopyWith<$Res> { - __$$TournamentTeamParticipationImplCopyWithImpl( - _$TournamentTeamParticipationImpl _value, - $Res Function(_$TournamentTeamParticipationImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? tournament = null, - Object? team = null, - }) { - return _then(_$TournamentTeamParticipationImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as int?, - tournament: null == tournament - ? _value.tournament - : tournament // ignore: cast_nullable_to_non_nullable - as Tournament, - team: null == team - ? _value.team - : team // ignore: cast_nullable_to_non_nullable - as Team, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$TournamentTeamParticipationImpl extends _TournamentTeamParticipation { - const _$TournamentTeamParticipationImpl( - {this.id, required this.tournament, required this.team}) - : super._(); - - factory _$TournamentTeamParticipationImpl.fromJson( - Map json) => - _$$TournamentTeamParticipationImplFromJson(json); - - @override - final int? id; - @override - final Tournament tournament; - @override - final Team team; - - @override - String toString() { - return 'TournamentTeamParticipation(id: $id, tournament: $tournament, team: $team)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$TournamentTeamParticipationImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.tournament, tournament) || - other.tournament == tournament) && - (identical(other.team, team) || other.team == team)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, id, tournament, team); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$TournamentTeamParticipationImplCopyWith<_$TournamentTeamParticipationImpl> - get copyWith => __$$TournamentTeamParticipationImplCopyWithImpl< - _$TournamentTeamParticipationImpl>(this, _$identity); - - @override - Map toJson() { - return _$$TournamentTeamParticipationImplToJson( - this, - ); - } -} - -abstract class _TournamentTeamParticipation - extends TournamentTeamParticipation { - const factory _TournamentTeamParticipation( - {final int? id, - required final Tournament tournament, - required final Team team}) = _$TournamentTeamParticipationImpl; - const _TournamentTeamParticipation._() : super._(); - - factory _TournamentTeamParticipation.fromJson(Map json) = - _$TournamentTeamParticipationImpl.fromJson; - - @override - int? get id; - @override - Tournament get tournament; - @override - Team get team; - @override - @JsonKey(ignore: true) - _$$TournamentTeamParticipationImplCopyWith<_$TournamentTeamParticipationImpl> - get copyWith => throw _privateConstructorUsedError; -} diff --git a/wrestling_scoreboard_common/lib/src/util/data_wrapper.dart b/wrestling_scoreboard_common/lib/src/util/data_wrapper.dart index 6d363d2b..4ea62c21 100644 --- a/wrestling_scoreboard_common/lib/src/util/data_wrapper.dart +++ b/wrestling_scoreboard_common/lib/src/util/data_wrapper.dart @@ -124,14 +124,14 @@ Future handleFromJson( handleMany: handleMany, handleSingleRaw: handleSingleRaw, handleManyRaw: handleManyRaw); - case const (Tournament): - return _handleFromJsonGeneric(json, + case const (Competition): + return _handleFromJsonGeneric(json, handleSingle: handleSingle, handleMany: handleMany, handleSingleRaw: handleSingleRaw, handleManyRaw: handleManyRaw); - case const (TournamentTeamParticipation): - return _handleFromJsonGeneric(json, + case const (CompetitionTeamParticipation): + return _handleFromJsonGeneric(json, handleSingle: handleSingle, handleMany: handleMany, handleSingleRaw: handleSingleRaw, @@ -225,8 +225,8 @@ String getTableNameFromType(Type t) { return 'team_match'; case const (TeamMatchBout): return 'team_match_bout'; - case const (Tournament): - return 'tournament'; + case const (Competition): + return 'competition'; case const (WeightClass): return 'weight_class'; default: @@ -266,8 +266,8 @@ Type getTypeFromTableName(String tableName) { return TeamMatch; case 'team_match_bout': return TeamMatchBout; - case 'tournament': - return Tournament; + case 'competition': + return Competition; case 'weight_class': return WeightClass; default: diff --git a/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql b/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql index 0f8559e3..7f878689 100644 --- a/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql +++ b/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql @@ -209,18 +209,18 @@ ALTER SEQUENCE public.club_id_seq OWNED BY public.club.id; -- --- Name: tournament_person; Type: TABLE; Schema: public; Owner: wrestling +-- Name: competition_person; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE TABLE public.tournament_person ( +CREATE TABLE public.competition_person ( id integer NOT NULL, - tournament_id integer NOT NULL, + competition_id integer NOT NULL, person_id integer NOT NULL, person_role public.person_role ); -ALTER TABLE public.tournament_person OWNER TO wrestling; +ALTER TABLE public.competition_person OWNER TO wrestling; -- -- Name: event_person_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling @@ -241,7 +241,7 @@ ALTER SEQUENCE public.event_person_id_seq OWNER TO wrestling; -- Name: event_person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.event_person_id_seq OWNED BY public.tournament_person.id; +ALTER SEQUENCE public.event_person_id_seq OWNED BY public.competition_person.id; -- @@ -744,36 +744,36 @@ ALTER SEQUENCE public.team_match_id_seq OWNED BY public.team_match.id; -- --- Name: tournament; Type: TABLE; Schema: public; Owner: wrestling +-- Name: competition; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE TABLE public.tournament ( +CREATE TABLE public.competition ( name character varying(127), bout_config_id integer NOT NULL ) INHERITS (public.wrestling_event); -ALTER TABLE public.tournament OWNER TO wrestling; +ALTER TABLE public.competition OWNER TO wrestling; -- --- Name: tournament_bout; Type: TABLE; Schema: public; Owner: wrestling +-- Name: competition_bout; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE TABLE public.tournament_bout ( +CREATE TABLE public.competition_bout ( id integer NOT NULL, - tournament_id integer NOT NULL, + competition_id integer NOT NULL, bout_id integer ); -ALTER TABLE public.tournament_bout OWNER TO wrestling; +ALTER TABLE public.competition_bout OWNER TO wrestling; -- --- Name: tournament_bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling -- -CREATE SEQUENCE public.tournament_bout_id_seq +CREATE SEQUENCE public.competition_bout_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -782,20 +782,20 @@ CREATE SEQUENCE public.tournament_bout_id_seq CACHE 1; -ALTER SEQUENCE public.tournament_bout_id_seq OWNER TO wrestling; +ALTER SEQUENCE public.competition_bout_id_seq OWNER TO wrestling; -- --- Name: tournament_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.tournament_bout_id_seq OWNED BY public.tournament_bout.id; +ALTER SEQUENCE public.competition_bout_id_seq OWNED BY public.competition_bout.id; -- --- Name: tournament_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling -- -CREATE SEQUENCE public.tournament_id_seq +CREATE SEQUENCE public.competition_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -804,13 +804,13 @@ CREATE SEQUENCE public.tournament_id_seq CACHE 1; -ALTER SEQUENCE public.tournament_id_seq OWNER TO wrestling; +ALTER SEQUENCE public.competition_id_seq OWNER TO wrestling; -- --- Name: tournament_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.tournament_id_seq OWNED BY public.tournament.id; +ALTER SEQUENCE public.competition_id_seq OWNED BY public.competition.id; -- @@ -978,24 +978,24 @@ ALTER TABLE ONLY public.team_match_bout ALTER COLUMN id SET DEFAULT nextval('pub -- --- Name: tournament id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: competition id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament ALTER COLUMN id SET DEFAULT nextval('public.tournament_id_seq'::regclass); +ALTER TABLE ONLY public.competition ALTER COLUMN id SET DEFAULT nextval('public.competition_id_seq'::regclass); -- --- Name: tournament_bout id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: competition_bout id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_bout ALTER COLUMN id SET DEFAULT nextval('public.tournament_bout_id_seq'::regclass); +ALTER TABLE ONLY public.competition_bout ALTER COLUMN id SET DEFAULT nextval('public.competition_bout_id_seq'::regclass); -- --- Name: tournament_person id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: competition_person id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_person ALTER COLUMN id SET DEFAULT nextval('public.event_person_id_seq'::regclass); +ALTER TABLE ONLY public.competition_person ALTER COLUMN id SET DEFAULT nextval('public.event_person_id_seq'::regclass); -- @@ -1208,27 +1208,27 @@ COPY public.team_match_bout (id, team_match_id, bout_id, pos) FROM stdin; -- --- Data for Name: tournament; Type: TABLE DATA; Schema: public; Owner: wrestling +-- Data for Name: competition; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.tournament (id, date, location, visitors_count, comment, no, name, bout_config_id) FROM stdin; -1 2021-07-17 Quahog 15 \N \N The Griffin-Simpson Tournament 1 +COPY public.competition (id, date, location, visitors_count, comment, no, name, bout_config_id) FROM stdin; +1 2021-07-17 Quahog 15 \N \N The Griffin-Simpson Competition 1 \. -- --- Data for Name: tournament_bout; Type: TABLE DATA; Schema: public; Owner: wrestling +-- Data for Name: competition_bout; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.tournament_bout (id, tournament_id, bout_id) FROM stdin; +COPY public.competition_bout (id, competition_id, bout_id) FROM stdin; \. -- --- Data for Name: tournament_person; Type: TABLE DATA; Schema: public; Owner: wrestling +-- Data for Name: competition_person; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.tournament_person (id, tournament_id, person_id, person_role) FROM stdin; +COPY public.competition_person (id, competition_id, person_id, person_role) FROM stdin; \. @@ -1371,17 +1371,17 @@ SELECT pg_catalog.setval('public.team_match_id_seq', 1, true); -- --- Name: tournament_bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.tournament_bout_id_seq', 1, false); +SELECT pg_catalog.setval('public.competition_bout_id_seq', 1, false); -- --- Name: tournament_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.tournament_id_seq', 1, false); +SELECT pg_catalog.setval('public.competition_id_seq', 1, false); -- @@ -1415,10 +1415,10 @@ ALTER TABLE ONLY public.club -- --- Name: tournament_person event_person_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_person event_person_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_person +ALTER TABLE ONLY public.competition_person ADD CONSTRAINT event_person_pk PRIMARY KEY (id); @@ -1535,19 +1535,19 @@ ALTER TABLE ONLY public.team -- --- Name: tournament_bout tournament_bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_bout competition_bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_bout - ADD CONSTRAINT tournament_bout_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_pk PRIMARY KEY (id); -- --- Name: tournament tournament_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition competition_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament - ADD CONSTRAINT tournament_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.competition + ADD CONSTRAINT competition_pk PRIMARY KEY (id); -- @@ -1584,7 +1584,7 @@ CREATE UNIQUE INDEX club_no_uindex ON public.club USING btree (no); -- Name: event_person_id_uindex; Type: INDEX; Schema: public; Owner: wrestling -- -CREATE UNIQUE INDEX event_person_id_uindex ON public.tournament_person USING btree (id); +CREATE UNIQUE INDEX event_person_id_uindex ON public.competition_person USING btree (id); -- @@ -1609,19 +1609,19 @@ CREATE UNIQUE INDEX team_match_bout_id_uindex ON public.team_match_bout USING bt -- --- Name: tournament_person event_person_person_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_person event_person_person_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_person +ALTER TABLE ONLY public.competition_person ADD CONSTRAINT event_person_person_id_fk FOREIGN KEY (person_id) REFERENCES public.person(id) ON DELETE CASCADE; -- --- Name: tournament_person event_person_wrestling_event_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_person event_person_wrestling_event_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_person - ADD CONSTRAINT event_person_wrestling_event_id_fk FOREIGN KEY (tournament_id) REFERENCES public.wrestling_event(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.competition_person + ADD CONSTRAINT event_person_wrestling_event_id_fk FOREIGN KEY (competition_id) REFERENCES public.wrestling_event(id) ON DELETE CASCADE; -- @@ -1849,27 +1849,27 @@ ALTER TABLE ONLY public.team_match -- --- Name: tournament tournament_bout_config_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition competition_bout_config_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament - ADD CONSTRAINT tournament_bout_config_id_fk FOREIGN KEY (bout_config_id) REFERENCES public.bout_config(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.competition + ADD CONSTRAINT competition_bout_config_id_fk FOREIGN KEY (bout_config_id) REFERENCES public.bout_config(id) ON DELETE CASCADE; -- --- Name: tournament_bout tournament_bout_bout_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_bout competition_bout_bout_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_bout - ADD CONSTRAINT tournament_bout_bout_id_fk FOREIGN KEY (bout_id) REFERENCES public.bout(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_bout_id_fk FOREIGN KEY (bout_id) REFERENCES public.bout(id) ON DELETE CASCADE; -- --- Name: tournament_bout tournament_bout_tournament_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_bout competition_bout_competition_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.tournament_bout - ADD CONSTRAINT tournament_bout_tournament_id_fk FOREIGN KEY (tournament_id) REFERENCES public.tournament(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_competition_id_fk FOREIGN KEY (competition_id) REFERENCES public.competition(id) ON DELETE CASCADE; -- diff --git a/wrestling_scoreboard_server/lib/controllers/tournament_controller.dart b/wrestling_scoreboard_server/lib/controllers/competition_controller.dart similarity index 62% rename from wrestling_scoreboard_server/lib/controllers/tournament_controller.dart rename to wrestling_scoreboard_server/lib/controllers/competition_controller.dart index c84b38d4..d8e5cc20 100644 --- a/wrestling_scoreboard_server/lib/controllers/tournament_controller.dart +++ b/wrestling_scoreboard_server/lib/controllers/competition_controller.dart @@ -5,22 +5,22 @@ import 'package:shelf/shelf.dart'; import 'entity_controller.dart'; import 'bout_controller.dart'; -class TournamentController extends EntityController { - static final TournamentController _singleton = TournamentController._internal(); +class CompetitionController extends EntityController { + static final CompetitionController _singleton = CompetitionController._internal(); - factory TournamentController() { + factory CompetitionController() { return _singleton; } - TournamentController._internal() : super(tableName: 'tournament'); + CompetitionController._internal() : super(tableName: 'competition'); Future requestBouts(Request request, String id) async { return EntityController.handleRequestManyOfControllerFromQuery(BoutController(), isRaw: isRaw(request), sqlQuery: ''' SELECT f.* FROM bout as f - JOIN tournament_bout AS tof ON tof.bout_id = f.id - WHERE tof.tournament_id = $id;'''); + JOIN competition_bout AS tof ON tof.bout_id = f.id + WHERE tof.competition_id = $id;'''); } @override diff --git a/wrestling_scoreboard_server/lib/controllers/competition_fight_controller.dart b/wrestling_scoreboard_server/lib/controllers/competition_fight_controller.dart new file mode 100644 index 00000000..8bfb1a45 --- /dev/null +++ b/wrestling_scoreboard_server/lib/controllers/competition_fight_controller.dart @@ -0,0 +1,13 @@ +import 'package:wrestling_scoreboard_common/common.dart'; + +import 'entity_controller.dart'; + +class CompetitionBoutController extends EntityController { + static final CompetitionBoutController _singleton = CompetitionBoutController._internal(); + + factory CompetitionBoutController() { + return _singleton; + } + + CompetitionBoutController._internal() : super(tableName: 'competition_bout'); +} diff --git a/wrestling_scoreboard_server/lib/controllers/entity_controller.dart b/wrestling_scoreboard_server/lib/controllers/entity_controller.dart index fe0cea24..04a52e86 100644 --- a/wrestling_scoreboard_server/lib/controllers/entity_controller.dart +++ b/wrestling_scoreboard_server/lib/controllers/entity_controller.dart @@ -18,7 +18,7 @@ import 'package:wrestling_scoreboard_server/controllers/person_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/team_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/team_match_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/team_match_bout_controller.dart'; -import 'package:wrestling_scoreboard_server/controllers/tournament_controller.dart'; +import 'package:wrestling_scoreboard_server/controllers/competition_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/websocket_handler.dart'; import 'package:wrestling_scoreboard_server/controllers/weight_class_controller.dart'; import 'package:wrestling_scoreboard_server/services/postgres_db.dart'; @@ -350,8 +350,8 @@ abstract class EntityController { return TeamMatchController() as EntityController; case TeamMatchBout: return TeamMatchBoutController() as EntityController; - case Tournament: - return TournamentController() as EntityController; + case Competition: + return CompetitionController() as EntityController; case WeightClass: return WeightClassController() as EntityController; default: diff --git a/wrestling_scoreboard_server/lib/controllers/tournament_fight_controller.dart b/wrestling_scoreboard_server/lib/controllers/tournament_fight_controller.dart deleted file mode 100644 index a4964acd..00000000 --- a/wrestling_scoreboard_server/lib/controllers/tournament_fight_controller.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:wrestling_scoreboard_common/common.dart'; - -import 'entity_controller.dart'; - -class TournamentBoutController extends EntityController { - static final TournamentBoutController _singleton = TournamentBoutController._internal(); - - factory TournamentBoutController() { - return _singleton; - } - - TournamentBoutController._internal() : super(tableName: 'tournament_bout'); -} diff --git a/wrestling_scoreboard_server/lib/routes/api_route.dart b/wrestling_scoreboard_server/lib/routes/api_route.dart index 8713b5ef..d48c853b 100644 --- a/wrestling_scoreboard_server/lib/routes/api_route.dart +++ b/wrestling_scoreboard_server/lib/routes/api_route.dart @@ -16,8 +16,8 @@ import '../controllers/person_controller.dart'; import '../controllers/team_controller.dart'; import '../controllers/team_match_controller.dart'; import '../controllers/team_match_bout_controller.dart'; -import '../controllers/tournament_controller.dart'; -import '../controllers/tournament_bout_controller.dart'; +import '../controllers/competition_controller.dart'; +import '../controllers/competition_bout_controller.dart'; import '../controllers/weight_class_controller.dart'; import '../middleware/content_type.dart'; @@ -116,16 +116,16 @@ class ApiRoute { router.get('/team_match_bouts', teamMatchBoutController.requestMany); router.get('/team_match_bout/', teamMatchBoutController.requestSingle); - final tournamentController = TournamentController(); - router.post('/tournament', tournamentController.postSingle); - router.get('/tournaments', tournamentController.requestMany); - router.get('/tournament/', tournamentController.requestSingle); - router.get('/tournament//bouts', tournamentController.requestBouts); + final competitionController = CompetitionController(); + router.post('/competition', competitionController.postSingle); + router.get('/competitions', competitionController.requestMany); + router.get('/competition/', competitionController.requestSingle); + router.get('/competition//bouts', competitionController.requestBouts); - final tournamentBoutController = TournamentBoutController(); - router.post('/tournament_bout', tournamentBoutController.postSingle); - router.get('/tournament_bouts', tournamentBoutController.requestMany); - router.get('/tournament_bout/', tournamentBoutController.requestSingle); + final competitionBoutController = CompetitionBoutController(); + router.post('/competition_bout', competitionBoutController.postSingle); + router.get('/competition_bouts', competitionBoutController.requestMany); + router.get('/competition_bout/', competitionBoutController.requestSingle); final weightClassController = WeightClassController(); router.post('/weight_class', weightClassController.postSingle); diff --git a/wrestling_scoreboard_server/public/index.html b/wrestling_scoreboard_server/public/index.html index ca189299..1e97c7fd 100644 --- a/wrestling_scoreboard_server/public/index.html +++ b/wrestling_scoreboard_server/public/index.html @@ -59,8 +59,8 @@

Wrestling Scoreboard Server

  • Teams
  • TeamMatchs
  • TeamMatchBouts
  • -
  • Tournaments
  • -
  • TournamentBouts
  • +
  • Competitions
  • +
  • CompetitionBouts
  • WeightClasses
  • Websocket Endpoint