Created the media model / schema
This commit is contained in:
parent
84fb61d9bd
commit
3dcdbc2027
22
models/Media.js
Normal file
22
models/Media.js
Normal 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);
|
Loading…
x
Reference in New Issue
Block a user