Advertisement
xapu

Untitled

Apr 1st, 2018
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. const mongoose = require('mongoose')
  2.  
  3. const paymentBluePrintSchema = new mongoose.Schema({
  4. name: {
  5. type: String
  6. },
  7. price: {
  8. type: mongoose.SchemaTypes.Number,
  9. required: true
  10. },
  11. payedBy: {
  12. type: mongoose.SchemaTypes.ObjectId
  13. }
  14. })
  15.  
  16. const accountSchema = new mongoose.Schema({
  17. payer: {
  18. type: mongoose.Schema.Types.ObjectId
  19. },
  20. reciever: {
  21. type: mongoose.Schema.Types.ObjectId
  22. },
  23. balance: {
  24. type: mongoose.SchemaTypes.Number,
  25. default: 0
  26. },
  27. limit: {
  28. type: mongoose.SchemaTypes.Number
  29. },
  30. account: {
  31. type: mongoose.SchemaTypes.ObjectId,
  32. default: mongoose.Types.ObjectId()
  33. },
  34. items: {
  35. type: [paymentBluePrintSchema]
  36. },
  37. isActive: {
  38. type: mongoose.SchemaTypes.Boolean
  39. }
  40. })
  41.  
  42. module.exports = mongoose.model('Account', userSchema)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement