Skip to content

Instantly share code, notes, and snippets.

@thanhtungdp
Created January 2, 2020 18:20
Show Gist options
  • Save thanhtungdp/fef631dfe6d90f66f34944c8d8e69829 to your computer and use it in GitHub Desktop.
Save thanhtungdp/fef631dfe6d90f66f34944c8d8e69829 to your computer and use it in GitHub Desktop.
billingLog.js
import mongoose from "mongoose";
var { Schema } = mongoose;
var BillingLogSchema = new Schema({
sourceId: String,
destId: String,
debitMoney: {
type: Number,
default: 0
},
creditMoney: {
type: Number,
default: 0
},
paymentOrderId: {
type: Schema.Types.ObjectId,
ref: 'PaymentOrder'
},
note: {
type: String
},
amount: {
type: Number,
default: 0 // xem lai
},
status: {
default: 1,
type: Number
},
balanceType: Number, // 1: TIEN MAT , 2: TIEN THUONG, 3: KHUYEN MAI
billingInfo: {},
infoParams: {},
appMode: String,
platform: String,
createdTime: Number,
updatedTime: Number,
});
BillingLogSchema.virtual('id').get(function () {
return this._id;
});
BillingLogSchema.set('toJSON', { virtuals: true });
export default mongoose.model('billing_logs', BillingLogSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment