mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-09-19 05:38:48 +00:00
Can edit comment content
This commit is contained in:
@@ -30,6 +30,24 @@ export class CommentsHelper {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the content of a comment
|
||||
*
|
||||
* @param commentID Target comment
|
||||
* @param newContent New content
|
||||
*/
|
||||
public static async Edit(commentID: number, newContent: string) {
|
||||
await DatabaseHelper.UpdateRows({
|
||||
table: COMMENTS_TABLE,
|
||||
where: {
|
||||
ID: commentID
|
||||
},
|
||||
set: {
|
||||
commentaire: newContent
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the comments of a POST
|
||||
*
|
||||
@@ -61,6 +79,21 @@ export class CommentsHelper {
|
||||
}) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out whether a comment belongs to a user or not
|
||||
*
|
||||
* @param commentID Target comment ID
|
||||
*/
|
||||
public static async IsOwner(userID: number, commentID: number) : Promise<boolean> {
|
||||
return await DatabaseHelper.Count({
|
||||
table: COMMENTS_TABLE,
|
||||
where: {
|
||||
ID: commentID,
|
||||
ID_personne: userID
|
||||
}
|
||||
}) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a single comment
|
||||
*
|
||||
|
Reference in New Issue
Block a user