Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
Backend done
Browse files Browse the repository at this point in the history
  • Loading branch information
Migarve55 committed Apr 22, 2019
1 parent 9f22345 commit dedd125
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/models/chat-message.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export class ChatMessage {
this.timeSent = date || new Date();
}

webId: string;

userName?: string;
message?: string;
timeSent?: Date;

}
11 changes: 9 additions & 2 deletions src/app/services/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ export class ChatService {
const text = this.rdf.getValueFromSchema('text', url);
const date = Date.parse(this.rdf.getValueFromSchema('dateSent', url));
const name = await this.rdf.getFriendData(sender, 'fn');
return new ChatMessage(name, text, date);
let msg : ChatMessage = new ChatMessage(name, text, date);
msg.webId = message.value;
return msg;
}

// Message methods
Expand Down Expand Up @@ -285,7 +287,12 @@ export class ChatService {
}

removeMsg(msg : ChatMessage) {
console.log("Deleting " + msg);
console.log("Deleting " + msg.webId);
const url = msg.webId;
fileClient.deleteFile(url).then(success => {
console.log("Deleted");
this.loadMessages();
}, err => console.log(err) );
}

/**
Expand Down

0 comments on commit dedd125

Please sign in to comment.