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

Get the list of custom emojies

This commit is contained in:
2020-04-03 16:43:38 +02:00
parent 131735a5f0
commit 6559c3b910
5 changed files with 54 additions and 1 deletions

View File

@ -522,6 +522,8 @@ export class AccountHelper {
// Delete user background image
await BackgroundImageHelper.Delete(userID);
// TODO : Delete custom user emojies
// Delete connections to all services
await this.DeleteAllUserLoginTokens(userID);

View File

@ -28,4 +28,32 @@ export class CustomEmojisHelper {
)
}
/**
* Get the list of emojies of a given user
*
* @param userID Target user ID
*/
public static async GetListUser(userID: number) : Promise<CustomEmoji[]> {
return (await DatabaseHelper.Query({
table: EMOJIS_TABLE,
where: {
user_id: userID
}
})).map((e) => this.DbToCustomEmoji(e));
}
/**
* Turn a database entry into a custom emoji
*
* @param row Database entry
*/
private static DbToCustomEmoji(row: any) : CustomEmoji {
return new CustomEmoji({
id: row.id,
userID: row.user_id,
shorcut: row.shorcut,
path: row.path
})
}
}