Edit:
continuous-integration/drone/push Build is failing Details

Changement des méthodes de la persistance en méthodes async
temp
Thomas Chazot 2 years ago
parent ba7b7a5852
commit b7aa8d1974

@ -7,19 +7,19 @@ export default interface ILoaderConversation{
* loadAllConversation methode that load every Conversation in the data management system
* return an array of Conversation
*/
loadAllConversation(): Conversation[];
loadAllConversation(): Promise<Conversation[]>;
/**
* loadByID methode that load an array of Conversation from the data management system by its id
* id the id we want to search
* return a Conversation if found, if not null
*/
loadByID(id:string): Conversation | null;
loadByID(id:string): Promise<Conversation | null>;
/**
* loadByUser methode that load an array of Conversation from the data management system using a user
* u the user we want the conversations of
* return an array of Conversation
*/
loadByUser(u:User): Conversation[];
loadByUser(u:User): Promise<Conversation[]>;
}

@ -7,17 +7,17 @@ export default interface ISaverConversation{
* c the Conversation we want to save
*/
saveConversation(c:Conversation): void;
saveConversation(c:Conversation): Promise<void>;
/**
* deleteConversation methode that delete a Conversation in the data management system
* c the Conversation we want to delete
*/
deleteConversation(c:Conversation):void;
deleteConversation(c:Conversation): Promise<void>;
/**
* updateConversation methode that update a Conversation in the data management system
* c the Conversation we want to update
*/
updateConversation(c:Conversation): void;
updateConversation(c:Conversation): Promise<void>;
}

@ -6,12 +6,12 @@ export default interface ILoaderMatch{
* loadAllMatch methode that load every Match from the data management system
* return an array of Match
*/
loadAllMatch(): Match[];
loadAllMatch(): Promise<Match[]>;
/**
* loadByID methode that load a match from the data management system by its id
* id the id we want to search
* return a Match if found, if not null
*/
loadByID(id:string): Match | null;
loadByID(id:string): Promise<Match | null>;
}

@ -7,17 +7,17 @@ export default interface ISaverMatch{
* m the Match we want to save
*/
saveMatch(m:Match): void;
saveMatch(m:Match): Promise<void>;
/**
* deleteMatch methode that delete a Match in the data management system
* m the Match we want to delete
*/
deleteMatch(m:Match):void;
deleteMatch(m:Match): Promise<void>;
/**
* updateMatch methode that update a Match in the data management system
* m the Match we want to update
*/
updateMatch(m:Match): void;
updateMatch(m:Match): Promise<void>;
}

@ -7,19 +7,19 @@ export default interface ILoaderMessage{
* loadAllMessage methode that load every Message from the data management system
* return an array of Message
*/
loadAllMessage(): Message[];
loadAllMessage(): Promise<Message[]>;
/**
* loadByID methode that load a Message from the data management system by its id
* id the id we want to search
* return a Message if found, if not null
*/
loadByID(id:string): Message | null;
loadByID(id:string): Promise<Message | null>;
/**
* loadByUser methode that load an array of Message from the data management system using a Conversation
* c the Conversation we want the Messages of
* return an array of Message
*/
loadByConversation(c:Conversation): Message[];
loadByConversation(c:Conversation): Promise<Message[]>;
}

@ -7,6 +7,6 @@ export default interface ISaverMessage{
* m the Message we want to save
*/
saveMessage(m:Message): void;
saveMessage(m:Message): Promise<void>;
}

@ -8,21 +8,21 @@ export default interface ILoaderUser{
* loadAllUser methode that load every user from the data management system
* return an array of User
*/
loadAllUser(): User[];
loadAllUser(): Promise<User[]>;
/**
* loadByID methode that load a user from the data management system by his id
* id the id we want to search
* return a User if found, if not null
*/
loadByID(id:string): User | null;
loadByID(id:string): Promise<User | null>;
/**
* loadByUsername methode that load a user from the data management system by his username
* username the username we want to search
* return a User if found, if not null
*/
loadByUsername(username:string): User | null;
loadByUsername(username:string): Promise<User | null>;
/**
* loadByUsernamePassword methode that load a user from the data management system by his username and his password
@ -30,17 +30,17 @@ export default interface ILoaderUser{
* password the password we want to search
* return a User if found, if not null
*/
loadByUsernamePassword(username:string, password:string): User | null;
loadByUsernamePassword(username:string, password:string): Promise<User | null>;
/**
* loadUserByMatch methode that load every user in a game
* return an array of User
*/
loadUserByMatch(m:Match): User[];
loadUserByMatch(m:Match): Promise<User[]>;
/**
* laodUserByConversation methode that load every user in a Conversation
* return an array of User
*/
laodUserByConversation(c:Conversation): User[];
loadUserByConversation(c:Conversation): Promise<User[]>;
}

@ -7,17 +7,17 @@ export default interface ISaverUser{
* u the user we want to save
*/
saveUser(u:User): void;
saveUser(u:User): Promise<void>;
/**
* deleteUser methode that delete a User in the data management system
* u the user we want to delete
*/
deleteUser(u:User):void;
deleteUser(u:User):Promise<void>;
/**
* updateUser methode that update a User in the data management system
* u the user we want to update
*/
updateUser(u:User): void;
updateUser(u:User): Promise<void>;
}

@ -4,13 +4,13 @@ import ISaverUser from "./ISaverUser";
export default class FakeSaverUser implements ISaverUser{
saveUser(u: User): void {
async saveUser(u: User): Promise<void> {
return;
}
deleteUser(u: User): void {
async deleteUser(u: User): Promise<void> {
return;
}
updateUser(u: User): void {
async updateUser(u: User): Promise<void> {
return;
}
}

@ -5,22 +5,22 @@ import ILoaderUser from "./ILoaderUser";
export default class LoaderUserApi implements ILoaderUser{
loadAllUser(): User[] {
async loadAllUser(): Promise<User[]> {
throw new Error("Method not implemented.");
}
loadByID(id: string): User | null {
async loadByID(id: string): Promise<User | null> {
throw new Error("Method not implemented.");
}
loadByUsername(username: string): User | null {
async loadByUsername(username: string): Promise<User | null> {
throw new Error("Method not implemented.");
}
loadByUsernamePassword(username: string, password: string): User | null {
async loadByUsernamePassword(username: string, password: string): Promise<User | null> {
throw new Error("Method not implemented.");
}
loadUserByMatch(m: Match): User[] {
async loadUserByMatch(m: Match): Promise<User[]> {
throw new Error("Method not implemented.");
}
laodUserByConversation(c: Conversation): User[] {
async loadUserByConversation(c: Conversation): Promise<User[]> {
throw new Error("Method not implemented.");
}

@ -4,13 +4,13 @@ import ISaverUser from "./ISaverUser";
export default class SaverUserApi implements ISaverUser{
saveUser(u: User): void {
async saveUser(u: User): Promise<void> {
throw new Error("Method not implemented.");
}
deleteUser(u: User): void {
async deleteUser(u: User): Promise<void> {
throw new Error("Method not implemented.");
}
updateUser(u: User): void {
async updateUser(u: User): Promise<void> {
throw new Error("Method not implemented.");
}

@ -13,10 +13,10 @@ export default class StubUser implements ILoaderUser{
new User("17", "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)]),
];
loadAllUser(): User[] {
async loadAllUser(): Promise<User[]> {
return this.tabUS;
}
loadByID(id: string): User | null {
async loadByID(id: string): Promise<User | null> {
for(let u of this.tabUS){
if (u.getId()==id){
return u;
@ -24,7 +24,7 @@ export default class StubUser implements ILoaderUser{
}
return null;
}
loadByUsername(username: string): User | null {
async loadByUsername(username: string): Promise<User | null> {
for(let u of this.tabUS){
if (u.getUsername()==username){
return u;
@ -32,7 +32,7 @@ export default class StubUser implements ILoaderUser{
}
return null;
}
loadByUsernamePassword(username: string, password: string): User | null {
async loadByUsernamePassword(username: string, password: string): Promise<User | null> {
for(let u of this.tabUS){
if (u.getUsername()==username && u.getPassword()==password){
return u;
@ -41,14 +41,14 @@ export default class StubUser implements ILoaderUser{
return null;
}
loadUserByMatch(m: Match): User[] {
async loadUserByMatch(m: Match): Promise<User[]> {
let tabUser:User[]=[];
m.getTabUsers().forEach(u => {
tabUser.push(u);
});
return tabUser;
}
laodUserByConversation(c: Conversation): User[] {
async loadUserByConversation(c: Conversation): Promise<User[]> {
let tabUser:User[]=[];
c.getTabUser().forEach(u => {
tabUser.push(u);

Loading…
Cancel
Save