diff --git a/R-Dash/assets/images/people.jpg b/R-Dash/assets/images/people.jpg new file mode 100644 index 0000000..87ea47a Binary files /dev/null and b/R-Dash/assets/images/people.jpg differ diff --git a/R-Dash/assets/images/user.jpg b/R-Dash/assets/images/user.jpg new file mode 100644 index 0000000..0b4c66f Binary files /dev/null and b/R-Dash/assets/images/user.jpg differ diff --git a/R-Dash/core/Geocalisation.ts b/R-Dash/core/Geocalisation.ts index 9b03d76..bab809a 100644 --- a/R-Dash/core/Geocalisation.ts +++ b/R-Dash/core/Geocalisation.ts @@ -1,18 +1,12 @@ export class Geocalisation { - readonly id: number; private gpsLat: number; private gpsLong: number; - constructor(id: number, gpsLat: number, gpsLong: number) { - this.id = id; + constructor(gpsLat: number, gpsLong: number) { this.gpsLat = gpsLat; this.gpsLong = gpsLong; } - getId() { - return this.id; - } - getGpsLat() { return this.gpsLat; } diff --git a/R-Dash/core/Iloader.ts b/R-Dash/core/Iloader.ts index e69de29..3e4be8f 100644 --- a/R-Dash/core/Iloader.ts +++ b/R-Dash/core/Iloader.ts @@ -0,0 +1,7 @@ +import { Session } from "./Session"; + + +export interface ILoader{ + Load() : Session + LoadFromFile(file : File) : Session +} \ No newline at end of file diff --git a/R-Dash/core/Lap.ts b/R-Dash/core/Lap.ts index 0c9707b..c262912 100644 --- a/R-Dash/core/Lap.ts +++ b/R-Dash/core/Lap.ts @@ -1,24 +1,27 @@ import { Point } from "./Point"; export class Lap { - readonly id: number; + private number : number; private points: Point[]; private time: number; - constructor(id: number, points: Point[], time: number) { - this.id = id; + constructor(number: number,points: Point[], time: number) { + this.number = number; this.points = points; this.time = time; } - getId() { - return this.id; + getNumber(){ + return this.number; + } + setNumber(){ + return this.number; } getPoints() { return this.points; } - + setPoints(points: Point[]) { this.points = points; } @@ -26,7 +29,6 @@ export class Lap { getTime() { return this.time; } - setTime(time: number) { this.time = time; } diff --git a/R-Dash/core/LoadDB.ts b/R-Dash/core/LoadDB.ts new file mode 100644 index 0000000..9e8f720 --- /dev/null +++ b/R-Dash/core/LoadDB.ts @@ -0,0 +1,12 @@ +import { ILoader } from "./ILoader"; +import { Session } from "./Session"; + +export class LoadDB implements ILoader{ + LoadFromFile(file: File): Session { + throw new Error("file argument is not accepted !."); // GARDER EN NON IMPLEMENTED ! + } + Load(): Session { + throw new Error("Method not implemented."); // APPEL API + } + +} \ No newline at end of file diff --git a/R-Dash/core/LoadXLS.ts b/R-Dash/core/LoadXLS.ts index e69de29..03320e9 100644 --- a/R-Dash/core/LoadXLS.ts +++ b/R-Dash/core/LoadXLS.ts @@ -0,0 +1,13 @@ +import { ILoader } from "./ILoader"; +import { Session } from "./Session"; + + +export class LoadXLS implements ILoader{ + LoadFromFile(file: File): Session { + throw new Error("Method not implemented."); // APPEL API RETOUR JSON + } + Load(): Session { + throw new Error("Cannot load without a file."); // GARDER EN NON IMPLEMENTED ! + } + +} \ No newline at end of file diff --git a/R-Dash/core/Member.ts b/R-Dash/core/Member.ts index 0fc63b9..d592d18 100644 --- a/R-Dash/core/Member.ts +++ b/R-Dash/core/Member.ts @@ -3,7 +3,7 @@ import { Team } from "./Team"; import { User } from "./User"; export class Member extends User { - constructor(id: number, pseudo: string, password: string, email: string, sessions: Session[], team: Team) { - super(id, pseudo, password, email, sessions, team); + constructor(username: string, password: string, email: string, sessions: Session[],image : HTMLImageElement= require('../assets/images/user.jpg')) { + super(username, password, email, sessions, image); } } \ No newline at end of file diff --git a/R-Dash/core/Owner.ts b/R-Dash/core/Owner.ts index 709f145..a391c69 100644 --- a/R-Dash/core/Owner.ts +++ b/R-Dash/core/Owner.ts @@ -3,7 +3,11 @@ import { Team } from "./Team"; import { User } from "./User"; export class Owner extends User { - constructor(id: number, pseudo: string, password: string, email: string, sessions: Session[], team: Team) { - super(id, pseudo, password, email, sessions, team); + constructor( username: string, password: string, email: string, sessions: Session[],image : HTMLImageElement= require('../assets/images/user.jpg')) { + super(username, password, email, sessions,image); + } + + IsOwner(): boolean{ + return true; } } \ No newline at end of file diff --git a/R-Dash/core/Point.ts b/R-Dash/core/Point.ts index ea23194..85bfde5 100644 --- a/R-Dash/core/Point.ts +++ b/R-Dash/core/Point.ts @@ -1,7 +1,6 @@ import { Geocalisation } from "./Geocalisation"; export class Point { - readonly id: number; private geo: Geocalisation; private timer: number; private distance: number; @@ -13,8 +12,7 @@ export class Point { private gLat: number; private vCar: number; - constructor(id: number, geo: Geocalisation, timer: number, distance: number, nGear: number, pBrakeF: number, aSteer: number, rPedal: number, gLong: number, gLat: number, vCar: number) { - this.id = id; + constructor( geo: Geocalisation, timer: number, distance: number, nGear: number, pBrakeF: number, aSteer: number, rPedal: number, gLong: number, gLat: number, vCar: number) { this.geo = geo; this.timer = timer; this.distance = distance; @@ -26,11 +24,6 @@ export class Point { this.gLat = gLat; this.vCar = vCar; } - - getId() { - return this.id; - } - getGeo() { return this.geo; } diff --git a/R-Dash/core/Session.ts b/R-Dash/core/Session.ts index da2ae8b..80e1c40 100644 --- a/R-Dash/core/Session.ts +++ b/R-Dash/core/Session.ts @@ -1,20 +1,23 @@ import { Lap } from "./Lap"; export class Session { - readonly id: number; private name: string; + private type: SessionType; private laps: Lap[]; - constructor(id: number, name: string, laps: Lap[]) { - this.id = id; + constructor( name: string, laps: Lap[], type: SessionType = SessionType.Unknown) { + this.type = type this.name = name; this.laps = laps; } - - getId() { - return this.id; + getType() { + return this.type; } + setType(type: SessionType) { + this.type = type; + } + getName() { return this.name; } diff --git a/R-Dash/core/StandardSessionBuilder.ts b/R-Dash/core/StandardSessionBuilder.ts index 794b573..0d58d06 100644 --- a/R-Dash/core/StandardSessionBuilder.ts +++ b/R-Dash/core/StandardSessionBuilder.ts @@ -3,11 +3,11 @@ import { SessionBuilder } from "./SessionBuilder"; export class StandartSessionBuilder extends SessionBuilder { BuildSession() { - PointBuilder(); + //PointBuilder(); } PointBuilder() { - new Point(); + //new Point(); } } \ No newline at end of file diff --git a/R-Dash/core/Team.ts b/R-Dash/core/Team.ts index 99ee9d8..fe9811a 100644 --- a/R-Dash/core/Team.ts +++ b/R-Dash/core/Team.ts @@ -1,25 +1,19 @@ import { User } from "./User"; +import { WaitingMember } from "./WaitingMember"; export class Team { - readonly id: number; private name: string; private owner: User; - private members: User[]; - private logo: File; - private waitList: User[]; + private users: User[]; + private logo: HTMLImageElement; - constructor(id: number, name: string, owner: User,members: User[] = null, logo: File = null, waitList: User[] = null) { - this.id = id; + constructor(name: string, owner: User,users: User[] = [], logo: HTMLImageElement = require('../assets/images/people.jpg')) { this.name = name; this.owner = owner; - this.members = members; + this.users = users; this.logo = logo; - this.waitList = waitList; } - getId() { - return this.id; - } getName() { return this.name; @@ -37,27 +31,37 @@ export class Team { this.owner = owner; } - getMembers() { - return this.members; + getusers() { + return this.users; } - setMembers(members: User[]) { - this.members = members; + setusers(users: User[]) { + this.users = users; } getLogo() { return this.logo; } - setLogo(logo: File) { + setLogo(logo: HTMLImageElement) { this.logo = logo; } getWaitList() { - return this.waitList; + var waitList : User[] = []; + this.users.forEach(user => { + if(user as WaitingMember){ + waitList.concat(user); + } + }); + return waitList; } - setWaitList(waitList: User[]) { - this.waitList = waitList; + addToWaitList(user: User) : boolean{ + if(!this.users.includes(user)){ + this.users.concat(user); + return true; + } + return false; } } \ No newline at end of file diff --git a/R-Dash/core/Track.ts b/R-Dash/core/Track.ts index 6b9d48f..f3555bf 100644 --- a/R-Dash/core/Track.ts +++ b/R-Dash/core/Track.ts @@ -1,16 +1,10 @@ export class Track { - readonly id: number; private name: string; - constructor(id: number, name: string) { - this.id = id; + constructor(name: string) { this.name = name; } - getId() { - return this.id; - } - getName() { return this.name; } diff --git a/R-Dash/core/User.ts b/R-Dash/core/User.ts index b6d5588..4146200 100644 --- a/R-Dash/core/User.ts +++ b/R-Dash/core/User.ts @@ -2,31 +2,35 @@ import { Session } from "./Session"; import { Team } from "./Team"; export abstract class User { - readonly id: number; - private pseudo: string; + private username: string; private password: string; private email: string; private sessions: Session[]; - private team: Team; + private image : HTMLImageElement; - constructor(id: number, pseudo: string, password: string, email: string, sessions: Session[] = null, team: Team = null) { - this.pseudo = pseudo; + constructor(username: string, password: string, email: string, sessions: Session[] = [], image : HTMLImageElement) { + this.username = username; this.password = password; this.email = email; this.sessions = sessions; - this.team = team; + this.image = image; + + } + + getImage(){ + return this.image; } - getId() { - return this.id; + setImage(image: HTMLImageElement){ + this.image = image; } - getPseudo() { - return this.pseudo; + getUsername() { + return this.username; } - setPseudo(pseudo: string) { - this.pseudo = pseudo; + setUsername(username: string) { + this.username = username; } getPassword() { @@ -53,12 +57,4 @@ export abstract class User { this.sessions = sessions; } - getTeam() { - return this.team; - } - - setTeam(team: Team) { - this.team = team; - } - } \ No newline at end of file diff --git a/R-Dash/core/WaitingMember.ts b/R-Dash/core/WaitingMember.ts index 5398a30..e7fbbdc 100644 --- a/R-Dash/core/WaitingMember.ts +++ b/R-Dash/core/WaitingMember.ts @@ -3,7 +3,7 @@ import { Team } from "./Team"; import { User } from "./User"; export class WaitingMember extends User { - constructor(id: number, pseudo: string, password: string, email: string, sessions: Session[], team: Team) { - super(id, pseudo, password, email, sessions, team); + constructor( pseudo: string, password: string, email: string, sessions: Session[],image : HTMLImageElement= require('../assets/images/user.jpg')) { + super(pseudo, password, email, sessions, image); } } \ No newline at end of file diff --git a/R-Dash/stub/stub.tsx b/R-Dash/stub/stub.tsx new file mode 100644 index 0000000..1a1dab9 --- /dev/null +++ b/R-Dash/stub/stub.tsx @@ -0,0 +1,24 @@ +import { Member } from "../core/Member"; +import { Owner } from "../core/Owner"; +import { Team } from "../core/Team"; +import { User } from "../core/User"; +import { WaitingMember } from "../core/WaitingMember"; + +const owner1 = new Owner("eric","PASSWORD123","eric@gmail.com",[]); +const owner2 = new Owner("castor","PASSWORD123","castor@gmail.com",[]); + +export const USERS1 : User[] = [ + new Member("jean","PASSWORD123","jean@gmail.com",[]), + new WaitingMember("anas","PASSWORD123","anas@gmail.com",[]), +] +export const USERS2 : User[] = [ + new Member("stickman","PASSWORD123","stickman@gmail.com",[]), + new Member("crapaud","PASSWORD123","crapaud@gmail.com",[]), + new WaitingMember("mcdo","PASSWORD123","mcdo@gmail.com",[]), + new WaitingMember("bucheron","PASSWORD123","bucheron@gmail.com",[]), +] + +export const TEAMS : Team[] = [ + new Team("La team 1",owner1, USERS1), + new Team("Bat INFO",owner2,USERS2) +] \ No newline at end of file