mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Export all user comments
This commit is contained in:
@ -8,6 +8,7 @@ import { NewAccount } from "../entities/NewAccount";
|
||||
import { GeneralSettings, UserPageStatus, LangSettings, SecuritySettings } from "../entities/User";
|
||||
import { AccountExport } from "../entities/AccountExport";
|
||||
import { PostsHelper } from "./PostsHelper";
|
||||
import { CommentsHelper } from "./CommentsHelper";
|
||||
|
||||
/**
|
||||
* Account helper
|
||||
@ -389,7 +390,10 @@ export class AccountHelper {
|
||||
userInfo: await UserHelper.GetUserInfo(userID),
|
||||
|
||||
// Export the list of posts
|
||||
postsList: await PostsHelper.ExportAllPostsUser(userID)
|
||||
postsList: await PostsHelper.ExportAllPostsUser(userID),
|
||||
|
||||
// Export the list of comments
|
||||
comments: await CommentsHelper.ExportAllUser(userID)
|
||||
})
|
||||
|
||||
|
||||
|
@ -158,6 +158,20 @@ export class CommentsHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the comments sent by a specified user
|
||||
*
|
||||
* @param userID Target user ID
|
||||
*/
|
||||
public static async ExportAllUser(userID: number) : Promise<Comment[]> {
|
||||
return (await DatabaseHelper.Query({
|
||||
table: COMMENTS_TABLE,
|
||||
where: {
|
||||
ID_personne: userID
|
||||
}
|
||||
})).map((row) => this.DbToComment(row));
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a database entry into a Comment object
|
||||
*
|
||||
|
Reference in New Issue
Block a user