addition of new class, in the model including the manager interfaces (with the abstract methods that go with it) and correction of errors ✅
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
cac321d92a
commit
83bbb3d6f7
@ -1,13 +1,13 @@
|
|||||||
class Achievement {
|
class Achievement {
|
||||||
|
|
||||||
String _name;
|
String _name;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
Achievement(this._name);
|
Achievement(this._name);
|
||||||
|
|
||||||
|
// Getters and setters
|
||||||
String get name => _name;
|
String get name => _name;
|
||||||
|
|
||||||
set name(String value) {
|
set name(String value) {
|
||||||
_name = value;
|
_name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
import 'Player.dart';
|
||||||
|
import 'Round.dart';
|
||||||
|
|
||||||
|
class GameDetail {
|
||||||
|
Uuid _id;
|
||||||
|
DateTime _time;
|
||||||
|
Uuid _winner;
|
||||||
|
int _nbPoints;
|
||||||
|
bool _isFinished;
|
||||||
|
Round _currentRound;
|
||||||
|
Player _host;
|
||||||
|
List<Round> _rounds = [];
|
||||||
|
List<Player> _players = [];
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
GameDetail(
|
||||||
|
this._id,
|
||||||
|
this._time,
|
||||||
|
this._winner,
|
||||||
|
this._nbPoints,
|
||||||
|
this._isFinished,
|
||||||
|
this._currentRound,
|
||||||
|
this._host,
|
||||||
|
this._rounds,
|
||||||
|
this._players);
|
||||||
|
|
||||||
|
// Getters and setters
|
||||||
|
Uuid get id => _id;
|
||||||
|
|
||||||
|
set id(Uuid value) {
|
||||||
|
_id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime get time => _time;
|
||||||
|
|
||||||
|
set time(DateTime value) {
|
||||||
|
_time = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uuid get winner => _winner;
|
||||||
|
|
||||||
|
set winner(Uuid value) {
|
||||||
|
_winner = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get nbPoints => _nbPoints;
|
||||||
|
|
||||||
|
set nbPoints(int value) {
|
||||||
|
_nbPoints = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isFinished => _isFinished;
|
||||||
|
|
||||||
|
set isFinished(bool value) {
|
||||||
|
_isFinished = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Round get currentRound => _currentRound;
|
||||||
|
|
||||||
|
set currentRound(Round value) {
|
||||||
|
_currentRound = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player get host => _host;
|
||||||
|
|
||||||
|
set host(Player value) {
|
||||||
|
_host = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Round> get rounds => _rounds;
|
||||||
|
|
||||||
|
set rounds(List<Round> value) {
|
||||||
|
_rounds = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Player> get players => _players;
|
||||||
|
|
||||||
|
set players(List<Player> value) {
|
||||||
|
_players = value;
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:uuid/uuid_util.dart';
|
import 'package:uuid/uuid_util.dart';
|
||||||
import 'Achievement.dart';
|
|
||||||
|
|
||||||
class User {
|
|
||||||
|
|
||||||
User(Uuid id, String image, String name): super(id, image, name);
|
|
||||||
|
|
||||||
|
class Guest extends Player {
|
||||||
|
// Constructor
|
||||||
|
Guest(Uuid id, String image, String name) : super(id, image, name);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
abstract class IAuthManager {
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
bool verifiedUser();
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
import 'package:uuid/uuid_util.dart';
|
||||||
|
import 'GameDetail.dart';
|
||||||
|
import 'Player.dart';
|
||||||
|
|
||||||
|
abstract class IGameManager {
|
||||||
|
// Methods
|
||||||
|
GameDetail getGameById(Uuid id);
|
||||||
|
List<GameDetail> getGamesByPlayerId(Uuid id);
|
||||||
|
List<GameDetail> getGamesByPlayer(Player user);
|
||||||
|
List<GameDetail> getGamesByPlayers(List<Player> users);
|
||||||
|
}
|
@ -1,30 +1,18 @@
|
|||||||
import 'package:bowl_in/model/Game.dart';
|
|
||||||
|
|
||||||
import 'User.dart';
|
import 'User.dart';
|
||||||
|
import 'Game.dart';
|
||||||
|
|
||||||
abstract class IManager {
|
abstract class IManager {
|
||||||
User _userCurrent;
|
late User _userCurrent;
|
||||||
|
|
||||||
User get userCurrent => _userCurrent;
|
|
||||||
|
|
||||||
set userCurrent(User value) {
|
|
||||||
_userCurrent = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
late Game _gameCurrent;
|
late Game _gameCurrent;
|
||||||
List<Game> _games;
|
IUserManager _userMgr;
|
||||||
|
IGameManager _gameMgr;
|
||||||
Game get gameCurrent => _gameCurrent;
|
|
||||||
|
|
||||||
set gameCurrent(Game value) {
|
|
||||||
_gameCurrent = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Game> get games => _games;
|
// Constructor
|
||||||
|
IManager(this._userCurrent, this._gameCurrent);
|
||||||
|
|
||||||
set games(List<Game> value) {
|
// Getters and setters
|
||||||
_games = value;
|
User get userCurrent => _userCurrent;
|
||||||
}
|
Game get gameCurrent => _gameCurrent;
|
||||||
|
IUserManager get userMgr => _userMgr;
|
||||||
IManager(this._userCurrent, this._gameCurrent, this._games);
|
IGameManager get gameMgr => _gameMgr;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
import 'package:uuid/uuid_util.dart';
|
||||||
|
import 'User.dart';
|
||||||
|
|
||||||
|
abstract class IUserManager {
|
||||||
|
IAuthManager _authMgr;
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
IAuthManager get authMgr => _authMgr;
|
||||||
|
List<User> getUsersByName(String name);
|
||||||
|
User getUserById(Uuid id);
|
||||||
|
}
|
@ -1,11 +1,36 @@
|
|||||||
|
import 'Player.dart';
|
||||||
|
|
||||||
class Round {
|
class Round {
|
||||||
int _nbPoints;
|
int _firstThrow;
|
||||||
|
int _secondThrow;
|
||||||
|
int _points;
|
||||||
|
Player _player;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Round(this._firstThrow, this._secondThrow, this._points, this._player);
|
||||||
|
|
||||||
|
// Getters and setters
|
||||||
|
int get firstThrow => _firstThrow;
|
||||||
|
|
||||||
|
set firstThrow(int value) {
|
||||||
|
_firstThrow = value;
|
||||||
|
}
|
||||||
|
|
||||||
int get nbPoints => _nbPoints;
|
int get secondThrow => _secondThrow;
|
||||||
|
|
||||||
set nbPoints(int value) {
|
set secondThrow(int value) {
|
||||||
_nbPoints = value;
|
_secondThrow = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Round(this._nbPoints);
|
int get points => _points;
|
||||||
|
|
||||||
|
set points(int value) {
|
||||||
|
_points = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player get player => _player;
|
||||||
|
|
||||||
|
set player(Player value) {
|
||||||
|
_player = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue