From 3dcdbc2027a76ab7d7158f7b0ee510a2eadd0ffe Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 26 Jun 2022 17:03:37 +0200 Subject: [PATCH] Created the media model / schema --- models/Media.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 models/Media.js diff --git a/models/Media.js b/models/Media.js new file mode 100644 index 0000000..9aa7214 --- /dev/null +++ b/models/Media.js @@ -0,0 +1,22 @@ +const mongoose = require('mongoose'); + +const MediaSchema = new mongoose.Schema({ + file_id: { // The id of the file + type: mongoose.mongo.ObjectId, + required: true + }, + type: { // The type of the file + type: String, + enum: ["file", "avatar", "icon"] + }, + name: { // The name of the file + type: String, + default: "unnamed" + }, + user_id: { // The id of the user that created the file + type: mongoose.mongo.ObjectId, + required: true + } +}); + +module.exports = mongoose.model('media', MediaSchema); \ No newline at end of file