diff --git a/database/database.py b/database/database.py index d0ba707c0c843ff343471dcb9081f7a539a3d3a3..635677a7107c782c42216a16d01926b6d70828b6 100644 --- a/database/database.py +++ b/database/database.py @@ -21,7 +21,9 @@ class User(mongo.Document): class Reply(mongo.EmbeddedDocument): replier_id = mongo.StringField(max_length=20, required =True) + replier_name = mongo.StringField(required=True) reply_text = mongo.StringField(required=True) + date = mongo.DateTimeField(default= datetime.utcnow) class Comment(mongo.Document): commenter_id = mongo.StringField(max_length=20, required=True) diff --git a/modules/comment.py b/modules/comment.py index f5fe31b924ed68815acb56af19f23b2c90770fd4..47871bf7e3f562ec41242d02d403df71c900972f 100644 --- a/modules/comment.py +++ b/modules/comment.py @@ -62,7 +62,7 @@ def add_reply(user): "status":401, "message":"Unauthorized reply" }) - comment.update(reply=db.Reply(replier_id = user.id, reply_text=reply_text)) + comment.update(reply=db.Reply(replier_id = user.id, replier_name= user.name, reply_text=reply_text)) return jsonify({ "status":200, "message":"Reply added successfully"