summaryrefslogtreecommitdiff
path: root/models/account.js
blob: d6f43b4d79e7c89e2c047b4190fb814b2e28d545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const mongoose = require("mongoose");

const AccountSchema = new mongoose.Schema({
    name: String,
    email: String,
    author: {
        id: {
            type: mongoose.Schema.Types.ObjectId,
            ref: "User",
        },
        username: String,
    },
    posts: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: "blogPost",
        },
    ],
});

module.exports = new mongoose.model("Account", AccountSchema);