Skip to content

Instantly share code, notes, and snippets.

@johnbahamon
Created July 6, 2023 14:04
Show Gist options
  • Save johnbahamon/afff93e66a7b2c205fa85582359a2e55 to your computer and use it in GitHub Desktop.
Save johnbahamon/afff93e66a7b2c205fa85582359a2e55 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const transactionSchema = new mongoose.Schema({
coaId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Coa',
required: true,
},
amount: {
type: Number,
required: true,
},
description: {
type: String,
required: true,
},
nature: {
type: String,
enum: ['Debit', 'Credit'],
required: true,
},
date: {
type: Date,
default: Date.now,
},
});
const Transaction = mongoose.model('Transaction', transactionSchema);
module.exports = Transaction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment