From 84fb61d9bdbcbd7ce3cf7d26cb4a80279618cfd9 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 26 Jun 2022 17:03:24 +0200 Subject: [PATCH] Created the addon model / schema --- models/Addon.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 models/Addon.js diff --git a/models/Addon.js b/models/Addon.js new file mode 100644 index 0000000..6ac602c --- /dev/null +++ b/models/Addon.js @@ -0,0 +1,46 @@ +const mongoose = require('mongoose'); + +const AddonSchema = new mongoose.Schema({ + name: { // The name of the addon + type: String, + minLength: 3, + maxLength: 25, + required: true + }, + info: { // A short description about the addon + type: String, + minLength: 10, + maxLength: 50, + default: "Just another addon" + }, + description: { // A long description about the addon + type: String, + minLength: 100, + maxLength: 1000, + default: "This is the long sample description about an addon here on CrazyAddons. Please wait until the developer changes it." + }, + type: { // The type of the addon + type: String, + required: true + }, + links: Object, // The addon links + languages: { // All languages supported by the addon + type: [String], + default: ["English"] + }, + created: { // The date when the addon has been added + type: Date, + default: Date.now + }, + downloads: { // The amount of downloads of the addon + type: Number, + default: 0 + }, + user_id: { // The id of the author + type: mongoose.mongo.ObjectId, + required: true + }, + price: Number // The price needed to pay for the addon +}); + +module.exports = mongoose.model('addons', AddonSchema); \ No newline at end of file