mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Created first comment
This commit is contained in:
@ -2,6 +2,7 @@ import { Comment } from "../entities/Comment";
|
||||
import { DatabaseHelper } from "./DatabaseHelper";
|
||||
import { unlinkSync, existsSync } from "fs";
|
||||
import { LikesHelper, LikesType } from "./LikesHelper";
|
||||
import { mysql_date, time } from "../utils/DateUtils";
|
||||
|
||||
/**
|
||||
* Comments helper
|
||||
@ -13,6 +14,22 @@ const COMMENTS_TABLE = "commentaires";
|
||||
|
||||
export class CommentsHelper {
|
||||
|
||||
/**
|
||||
* Create a new comment
|
||||
*
|
||||
* @param comment Information about the comment to create
|
||||
*/
|
||||
public static async Create(comment: Comment) : Promise<number> {
|
||||
return await DatabaseHelper.InsertRow(COMMENTS_TABLE, {
|
||||
ID_texte: comment.postID,
|
||||
ID_personne: comment.userID,
|
||||
date_envoi: mysql_date(),
|
||||
time_insert: time(),
|
||||
commentaire: comment.content,
|
||||
image_commentaire: comment.hasImage ? comment.imagePath : ""
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the comments of a POST
|
||||
*
|
||||
|
Reference in New Issue
Block a user