Created the media model / schema

This commit is contained in:
Mathias Wagner 2022-06-26 17:03:37 +02:00
parent 84fb61d9bd
commit 3dcdbc2027
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

22
models/Media.js Normal file
View File

@ -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);