Feature: First version of the REST API done

This commit is contained in:
2015-08-14 08:04:31 +00:00
commit e6fc0be0ed
28 changed files with 3170 additions and 0 deletions

20
app/models/entry.js Normal file
View File

@@ -0,0 +1,20 @@
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.Types.ObjectId;
var DEBIT = 'D',
BILL = 'B';
var EntrySchema = new Schema({
account_id: {type: ObjectId, ref: 'Category', required: true},
category: {type: ObjectId, ref: 'Account', required: false},
sub_category: {type: ObjectId, required: false},
label: {type: String, required:false},
type: {type: String, required: true},
amount: {type: Number, required: true},
date: {type: Date, required: true},
created_at: {type: Date, default: Date.now}
});
var Entry = mongoose.model('Entry', EntrySchema);
module.exports = Entry;