Skip to content

Instantly share code, notes, and snippets.

@thanhtungdp
Created January 2, 2020 18:44
Show Gist options
  • Save thanhtungdp/63e3a07f481d1402ee8f2eeb6484e4c8 to your computer and use it in GitHub Desktop.
Save thanhtungdp/63e3a07f481d1402ee8f2eeb6484e4c8 to your computer and use it in GitHub Desktop.
import mongoose from "mongoose";
var { Schema } = mongoose;
var PaymentOrderSchema = new Schema({
debitAccount: String,// driver id
creditAccountId: String, // guess id
balanceType: Number,
tripId: {
type: String,
unique: true,
required: true,
},
status: {
type: Number,
default: 1, // 1: PENDING, 2 : DRAFT , 3: APPROVE
},
amount: {
type: Number,
default: 0,
},
detailPayment: {
type: String,
},
appMode: String, // production or development
historyRollBack: [
{
createdTime: { type: Number },
statusUpdated: { type: Number },
}
],
currency: {
type: Number,
default: 1, // VNG
},
createdTime: Number,
updatedTime: Number,
});
PaymentOrderSchema.virtual('id').get(function () {
return this._id;
});
PaymentOrderSchema.set('toJSON', { virtuals: true });
export default mongoose.model('payment_orders', PaymentOrderSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment