stub-api
Alban GUILHOT 3 years ago
commit f773768851

@ -0,0 +1,23 @@
import { Message } from "./core/message"
import { Conversation } from "./core/conversation"
import tabSkinApp from './constSkin'
import { User } from "./core/user";
let UserActu:User=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, tabSkinApp[0], tabSkinApp, undefined);
let UserTest:User=new User("48", "Wesh Wesh", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, tabSkinApp[0], tabSkinApp, undefined);
let tabMessageTest:Message[]=[
new Message("Salut", UserActu, new Date(2022,12,12)),
new Message("Wesh", UserTest, new Date(2022,12,13)),
new Message("Ca va", UserActu, new Date(2022,12,14)),
new Message("Ouais et toi?", UserTest, new Date(2022,12,15)),
]
let tabUS:User[]=[UserActu, UserTest];
let conv = new Conversation(tabUS, tabMessageTest, "le super nom");
export default conv;

@ -41,7 +41,7 @@ export class Conversation{
getLastMessage(){ getLastMessage(){
this.sortMessageDesc(); this.sortMessageDesc();
return this.TabMessage[0]; return this.TabMessage[0].getMessageContent();
} }
sortMessageDesc(){ sortMessageDesc(){

@ -11,10 +11,10 @@ export class User{
private TotalCoins: number; private TotalCoins: number;
private CurrentSkin: Skin; private CurrentSkin: Skin;
private TabSkin: Skin[]; private TabSkin: Skin[];
private TabConv: Conversation[]; private TabConv?: Conversation[];
constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number, constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
currentSkin: Skin, tabSkin: Skin[], tabConv: Conversation[] ){ currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
this.Id=id; this.Id=id;
this.Username=username; this.Username=username;
this.Nationality=nationality; this.Nationality=nationality;
@ -24,7 +24,9 @@ export class User{
this.TotalCoins=totalCoins; this.TotalCoins=totalCoins;
this.CurrentSkin=currentSkin; this.CurrentSkin=currentSkin;
this.TabSkin=[...tabSkin]; this.TabSkin=[...tabSkin];
this.TabConv=[...tabConv]; tabConv?.forEach(conv => {
this.TabConv?.push(conv);
});
} }
getUsername(){ getUsername(){
@ -103,7 +105,9 @@ export class User{
return this.TabConv; return this.TabConv;
} }
setTabConv(tabConv: Conversation[]){ setTabConv(tabConv?: Conversation[]){
this.TabConv=[...tabConv]; tabConv?.forEach(conv => {
this.TabConv?.push(conv);
});
} }
} }
Loading…
Cancel
Save