Skip to content

Commit

Permalink
feat: Create OutputAudio model
Browse files Browse the repository at this point in the history
see: #10
  • Loading branch information
sujinleeme committed Jun 30, 2018
1 parent 68c2068 commit 529ebeb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions server/models/OutputAudio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const mongoose = require('mongoose')

let OutputAudioSchema = new mongoose.Schema(
{
text: String,
title: String,
author: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}
}
)

OutputAudioSchema.methods.addAuthor = (author_id) => {
this.author = author_id
return this.save()
}

OutputAudioSchema.methods.getUserInputAudio = (_id) => {
OutputAudioSchema.find({'author': _id}).then((audio) => {
"use strict"
return audio
})
}

module.exports = mongoose.model('OutputAudio', OutputAudioSchema)


0 comments on commit 529ebeb

Please sign in to comment.