Skip to content

Commit

Permalink
remove media
Browse files Browse the repository at this point in the history
closes #3
  • Loading branch information
mariopesch committed Feb 21, 2022
1 parent c014c9b commit 4d16942
Showing 1 changed file with 34 additions and 53 deletions.
87 changes: 34 additions & 53 deletions models/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,60 @@
// jshint node: true
"use strict";

const mongoose = require('mongoose');

const MediaSchema = new mongoose.Schema({
youtube: {
type: String
},
picture: {
path: {
type: String
},
size: {
type: Number
},
contentType: {
type: String
},
originalName: {
type: String
}
}
});
const mongoose = require("mongoose");

const StepSchema = new mongoose.Schema({
type: {
type: String,
enum: ['instruction','task'],
required: true
enum: ["instruction", "task"],
required: true,
},
headline: {
type: String,
required: true
required: true,
},
text: {
type: String,
required: true
required: true,
},
requirements: {
type: [mongoose.Schema.Types.ObjectId],
ref: 'Tutorial',
default: undefined
ref: "Tutorial",
default: undefined,
},
hardware: {
type: [String],
default: undefined
},
media: {
type: MediaSchema
default: undefined,
},
xml: {
type: String
}
});

const TutorialSchema = new mongoose.Schema({
creator: {
type: String,
ref: 'User',
required: true
},
title: {
type: String,
required: true
},
badge: {
type: mongoose.Schema.Types.ObjectId
},
steps: [{
type: StepSchema,
required: true
}]
},{
timestamps: true
});

const TutorialSchema = new mongoose.Schema(
{
creator: {
type: String,
ref: "User",
required: true,
},
title: {
type: String,
required: true,
},
badge: {
type: mongoose.Schema.Types.ObjectId,
},
steps: [
{
type: StepSchema,
required: true,
},
],
},
{
timestamps: true,
}
);

module.exports = mongoose.model('Tutorial', TutorialSchema);
module.exports = mongoose.model("Tutorial", TutorialSchema);

0 comments on commit 4d16942

Please sign in to comment.