Skip to content

Commit

Permalink
BE #5: Change in article, fragment and revision model
Browse files Browse the repository at this point in the history
  • Loading branch information
Atiqul Alam Rocky committed Jun 12, 2020
1 parent 5e77d66 commit dde0af1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var articleSchema = new Schema(
type: String,
require: true,
},
body: [String],
body: [{type: Schema.Types.ObjectId, ref: 'Fragment'}],
author: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
Expand Down
2 changes: 1 addition & 1 deletion models/fragment.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const fragmentSchema = new Schema({
},
],
//for type figure/image
metadata: { type: Schema.Types.ObjectId, ref: 'Image' },
image: { type: Schema.Types.ObjectId, ref: 'Image' },
//for type 7 iframe
iframe: { type: Schema.Types.ObjectId, ref: 'ExternalLink' },
//for embed any link
Expand Down
6 changes: 4 additions & 2 deletions models/revision.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ const revisionSchema = new Schema({
currentRevision: {type: Number, required: true},
revisions:[{
revision: {type: Number},
frags:[{type: Schema.Types.ObjectId, ref: 'Fragment'}],
action: {type: String, enum:['add', 'delete'], default: 'add'}
frags:[{
operationType:{type:String},
fragment: {type: Schema.Types.ObjectId, ref: 'Fragment'}
}]
}]
});

Expand Down

0 comments on commit dde0af1

Please sign in to comment.