summaryrefslogtreecommitdiff
path: root/server/lib/schemas/Subscription.js
blob: 7f2579b6bd45076e68e9197f10274518a5aab1f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* jshint node: true */

var mongoose = require('mongoose'),
	_ = require('lodash'),
	crypto = require('crypto'),
	config = require('../../../config.json'),
	util = require('../util');

var SubscriptionSchema = new mongoose.Schema({
	user_id: { type: mongoose.Schema.ObjectId, index: true },
	
  monthly_total: { type: Number },
  yearly_total: { type: Number },
	
	plans: [{
    tier: { type: String },
    monthly: { type: Boolean },
    projects: [{ type: mongoose.Schema.ObjectId }],
	}],
	
	created_at: { type: Date, default: Date.now },
	updated_at: { type: Date, default: Date.now },
})

module.exports = exports = mongoose.model('subscription', SubscriptionSchema);
exports.schema = SubscriptionSchema;