1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 16:45:16 +00:00

Can create conversations

This commit is contained in:
2019-11-30 10:11:51 +01:00
parent b6739473a2
commit 3db123cd1e
7 changed files with 134 additions and 6 deletions

View File

@ -4,13 +4,16 @@
* @author Pierre HUBERT
*/
export interface Conversation {
id: number,
export interface BaseConversation {
ownerID: number,
name: string,
following: boolean,
members: Array<number>
}
export interface Conversation extends BaseConversation {
id: number,
lastActive: number,
timeCreate: number,
following: boolean,
sawLastMessage: boolean,
members: Array<number>
}

View File

@ -113,6 +113,20 @@ export class RequestHandler {
return list;
}
/**
* Get a boolean included in the request
*
* @param name The name of the POST field
*/
public postBool(name: string) : boolean {
const param = this.getPostParam(name);
if(param == undefined)
this.error(400, "Missing boolean '" + name + "' in the request!");
return param === "true" || param === true;
}
/**
* Validate API tokens