From 075e62581e4161a00755c0551fcde977aad3aa89 Mon Sep 17 00:00:00 2001 From: gaba Date: Wed, 8 Feb 2017 09:03:21 -0800 Subject: [PATCH] Tags should be an array --- models/comment.js | 14 +++++--------- services/comments.js | 8 +++++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/models/comment.js b/models/comment.js index a2733f551..42b7425b9 100644 --- a/models/comment.js +++ b/models/comment.js @@ -9,11 +9,6 @@ const STATUSES = [ null ]; -const TAGS = [ - 'STAFF', - null -]; - /** * The Mongo schema for a Comment Status. * @type {Schema} @@ -54,10 +49,11 @@ const CommentSchema = new Schema({ author_id: String, status_history: [StatusSchema], status: {type: String, default: null}, - tag: { - type: String, - enum: TAGS, - }, + tags: [{ + name: String, + assigned_by: String, + created_at: Date + }], parent_id: String }, { timestamps: { diff --git a/services/comments.js b/services/comments.js index 9055afcfa..bca56a2db 100644 --- a/services/comments.js +++ b/services/comments.js @@ -36,7 +36,13 @@ module.exports = class CommentsService { created_at: new Date() }] : [], status, - tag: UsersService.isStaff(author_id) ? 'STAFF' : null, + tags: [ + { + name: UsersService.isStaff(author_id) ? 'STAFF' : null, + assigned_by: null, + created_at: new Date() + } + ], author_id });