✔Modifications du model de l'appli et ajout d'un stub 📚, avancement.

Backend/model
mohamed 2 years ago
parent 9433a61ed7
commit 9f0b7c720f

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -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;
}

@ -0,0 +1,7 @@
import { Session } from "./Session";
export interface ILoader{
Load() : Session
LoadFromFile(file : File) : Session
}

@ -1,18 +1,21 @@
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() {
@ -26,7 +29,6 @@ export class Lap {
getTime() {
return this.time;
}
setTime(time: number) {
this.time = time;
}

@ -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
}
}

@ -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 !
}
}

@ -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);
}
}

@ -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;
}
}

@ -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;
}

@ -1,18 +1,21 @@
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;
}
getType() {
return this.type;
}
getId() {
return this.id;
setType(type: SessionType) {
this.type = type;
}
getName() {

@ -3,11 +3,11 @@ import { SessionBuilder } from "./SessionBuilder";
export class StandartSessionBuilder extends SessionBuilder {
BuildSession() {
PointBuilder();
//PointBuilder();
}
PointBuilder() {
new Point();
//new Point();
}
}

@ -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;
}
}

@ -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;
}

@ -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;
}
}

@ -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);
}
}

@ -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)
]
Loading…
Cancel
Save