Skip to content
Permalink
de9fcf13f2
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
32 lines (31 sloc) 962 Bytes
import mongoose from 'mongoose';
const {Schema} = mongoose;
export default mongoose.model(
'borrow',
new Schema(
{
book_id: {type: String, default: ''},
book_user_id: {type: String, default: ''},
book_username: {type: String, default: ''},
book_address: {type: String, default: ''},
book_name: {type: String, default: ''},
book_price: {type: Number, default: 0},
request_user_id: {type: String, default: ''},
request_username: {type: String, default: ''},
request_address: {type: String, default: ''},
message: {type: Array, default: []},
state: {type: Number, default: 1, commit: '1:normal,2:confirm,3:refuse,4: return'},
},
{
timestamps: {createdAt: 'create_time', updatedAt: 'update_time'},
toJSON: {
virtuals: true,
transform(doc, ret) {
delete ret.__v;
delete ret._id;
return ret;
},
},
},
),
);