diff options
| author | Darius Kazemi <darius.kazemi@gmail.com> | 2020-01-06 22:42:43 -0800 | 
|---|---|---|
| committer | Darius Kazemi <darius.kazemi@gmail.com> | 2020-01-06 22:42:43 -0800 | 
| commit | 8138b5757bed1beb9c21f1e32a3fc9920e989f49 (patch) | |
| tree | 729c9c358a06853418be5b00458ee9b0f36ffa49 /models | |
| parent | c5835cbdbcfe3abda637e298a89b36ebb058c22a (diff) | |
| parent | 783a5fbc270452148a6bcc92cb37469e6da349d7 (diff) | |
Merge branch 'master' of github.com:dariusk/gathio into newmaster
Diffstat (limited to 'models')
| -rwxr-xr-x | models/Event.js | 78 | 
1 files changed, 76 insertions, 2 deletions
diff --git a/models/Event.js b/models/Event.js index c67869e..07f0b70 100755 --- a/models/Event.js +++ b/models/Event.js @@ -16,9 +16,35 @@ const Attendees = new mongoose.Schema({  	removalPassword: {  		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 +  }, +  // 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({  	id: {  		type: String, @@ -43,6 +69,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, @@ -65,6 +105,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]  }) @@ -163,7 +219,25 @@ const EventSchema = new mongoose.Schema({  	maxAttendees: {  		type: Number  	}, -	comments: [CommentSchema] +	comments: [CommentSchema], +  activityPubActor: { +    type: String, +    trim: true +  }, +  activityPubEvent: { +    type: String, +    trim: true +  }, +  publicKey: { +    type: String, +    trim: true +  }, +  privateKey: { +    type: String, +    trim: true +  }, +	followers: [Followers], +  activityPubMessages: [ActivityPubMessages]  });  module.exports = mongoose.model('Event', EventSchema);  | 
