{"size": 1924, "ext": "js", "max_stars_repo_path": "node_modules/my-util/models.js", "max_stars_repo_name": "ThinkAM/petbook", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/my-util/models.js", "max_issues_repo_name": "ThinkAM/petbook", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/my-util/models.js", "max_forks_repo_name": "ThinkAM/petbook", "max_forks_repo_forks_event_min_datetime": "2020-05-24T03:56:46.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-24T03:56:46.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 25.3157894737, "max_line_length": 76, "alphanum_fraction": 0.6949064449}
/*
 * various mongoose models used in connection with the db
 * */
const mongoose = require("mongoose");

/* petbook.Users model */
const user_schema = mongoose.Schema({
    firstName: String,
    lastName: String,
    email: String,
    password: String,
    type: String,
    gender: String,
    birthday: String,
    friends: [String],
    avatar: String,
    isGuest: Boolean
});
const user_model = mongoose.model("user", user_schema, "Users");

/* petbook.Photos model */
const photo_schema = mongoose.Schema({
    path: String,
    owner: String,
    mimetype: String,
    description: String,
    size: Number
});
const photo_model = mongoose.model("photo", photo_schema, "Photos");

/*
 * petbook.Posts model
 *
 * for now also store avatar id in here (this can be obtained from uid)
 * since it's not that bad to duplicate ids anyway
 * this makes it easier to show user avatar near each post (saves one
 * db query)
 * */
const post_schema = mongoose.Schema({
    uid: String,
    isText: Boolean,
    text: String,
    timestamp: String,
    photo: String,
    comments: [String]
});
/* TODO first arg? */
const post_model = mongoose.model("post", post_schema, "Posts");

/* petbook.FriendRequests model */
const friend_req_schema = mongoose.Schema({
    from: String,
    to: String,
    seen: Boolean,
    status: String
});
const friend_req_model = mongoose.model("friend_req",
					friend_req_schema, "FriendRequests");

/* petbook.FriendRequests model */
const message_schema = mongoose.Schema({
    from: String,
    to: String,
    seen: Boolean,
    timestamp: String,
    message: String
});
const message_model = mongoose.model("message", message_schema, "Messages");

/* exports */
module.exports.user_model = user_model;
module.exports.photo_model = photo_model;
module.exports.post_model = post_model;
module.exports.friend_req_model = friend_req_model;
module.exports.message_model = message_model;
