diff options
| author | Darius Kazemi <darius.kazemi@gmail.com> | 2019-12-15 13:07:50 -0800 | 
|---|---|---|
| committer | Darius Kazemi <darius.kazemi@gmail.com> | 2019-12-15 13:07:50 -0800 | 
| commit | f1e62ef6fa94c3cfb6afadd0dc865f5c502a6a60 (patch) | |
| tree | 11cd3ace4b401c01cc5d779b938e6285bdb05f8d /models | |
| parent | b8d8d5fcd29f3c5492491e3482319e0efc838030 (diff) | |
Big refactor and new features
Diffstat (limited to 'models')
| -rwxr-xr-x | models/Event.js | 52 | 
1 files changed, 49 insertions, 3 deletions
diff --git a/models/Event.js b/models/Event.js index d68621a..9ab455f 100755 --- a/models/Event.js +++ b/models/Event.js @@ -12,18 +12,33 @@ const Attendees = new mongoose.Schema({  	email: {  		type: String,  		trim: true -	} +	}, +  id: { +		type: String, +		trim: true +  }  })  const Followers = new mongoose.Schema({ +  // this is the id of the original follow *request*, which we use to validate Undo events    followId: {  		type: String,  		trim: true    }, -	account: { +  // this is the actual remote user profile id +	actorId: {  		type: String,  		trim: true -	} +	}, +  // this is the stringified JSON of the entire user profile +	actorJson: { +		type: String, +		trim: true +	}, +  name: { +		type: String, +		trim: true +  },  }, {_id: false})  const ReplySchema = new mongoose.Schema({ @@ -50,6 +65,20 @@ const ReplySchema = new mongoose.Schema({  	}  }) +const ActivityPubMessages = new mongoose.Schema({ +	id: { +		type: String, +		required: true, +		unique: true, +		sparse: true +	}, +	content: { +		type: String, +		trim: true, +		required: true +	} +}) +  const CommentSchema = new mongoose.Schema({  	id: {  		type: String, @@ -72,6 +101,22 @@ const CommentSchema = new mongoose.Schema({  		trim: true,  		required: true  	}, +  activityJson: { +		type: String, +		trim: true +  }, +  actorJson: { +		type: String, +		trim: true +  }, +  activityId: { +		type: String, +		trim: true +  }, +  actorId: { +		type: String, +		trim: true +  },  	replies: [ReplySchema]  }) @@ -184,6 +229,7 @@ const EventSchema = new mongoose.Schema({      trim: true    },  	followers: [Followers], +  activityPubMessages: [ActivityPubMessages]  });  module.exports = mongoose.model('Event', EventSchema);  | 
