Skip to content

Commit 960a15c

Browse files
committed
add subdoc
1 parent 5b5e48a commit 960a15c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

server/models/Recipient.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const mongoose = require('mongoose');
2+
const { Schema } = mongoose;
3+
4+
const recipientSchema = new Schema({
5+
email: String,
6+
responded: { type: Boolean, default: false }
7+
});
8+
9+
module.exports = recipientSchema;

server/models/Survey.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const mongoose = require('mongoose');
22
const { Schema } = mongoose;
3+
const RecipientSchema = require('./Recipient');
34

45
const surveySchema = new Schema({
56
title: String,
67
body: String,
78
subject: String,
8-
recipients: [String],
9+
recipients: [RecipientSchema],
910
yes: { type: Number, default: 0 },
1011
no: { type: Number, default: 0 }
1112
});

0 commit comments

Comments
 (0)