UNPKG

flexbiz-server

Version:

Flexible Server

4 lines (3 loc) 1.02 kB
'use strict';const asstransactionSchema=new Schema({id_app:{type:String,required:!0,maxlength:1024},creator:{type:String,required:!0},event:{type:String,required:!0},memo:String,data:{},date_created:{type:Date,default:Date.now}}); (global.configs||{}).createIndexes&&(asstransactionSchema.index({id_app:1}),asstransactionSchema.index({event:1}),asstransactionSchema.index({creator:1}),asstransactionSchema.index({"data.from_address":1}),asstransactionSchema.index({"data.to_address":1}),asstransactionSchema.index({"data.token":1}),asstransactionSchema.index({"data.id_product":1}),asstransactionSchema.index({"data.id_period":1}),asstransactionSchema.index({date_created:-1})); const model=mongoose.models.asstransaction||mongoose.model("asstransaction",asstransactionSchema);model.createTransaction=async({id_app:$id_app$$,creator:$creator$$,event:$event$$,data:$data$$,memo:$memo$$=""})=>(await model.create({id_app:$id_app$$,creator:$creator$$,event:$event$$,data:$data$$,memo:$memo$$})).toObject();module.exports=model;