1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- const mongoose = require('mongoose');
- const { Schema, model } = mongoose;
- mongoose.Types.ObjectId.isValid();
- const userSchema = new Schema(
- {
- name: {
- type: String,
- default: null,
- },
- lastName: {
- type: String,
- default: null,
- },
- originalName: {
- type: String,
- default: null,
- },
- originalLastName: {
- type: String,
- default: null,
- },
- number: {
- type: String,
- required: [true, 'Number required'],
- unique: true,
- min: 8,
- max: 14,
- },
- country: {
- type: String,
- required: [true, 'Country required'],
- min: 1,
- max: 40,
- },
- avatarUrl: {
- type: String,
- default: null,
- },
- avatarsArr: {
- type: Array,
- default: [],
- },
- color: {
- type: String,
- default: null,
- },
- token: {
- type: String,
- default: null,
- },
- code: {
- type: String,
- default: null,
- },
- online: {
- type: String,
- default: null,
- },
- sort: {
- type: Boolean,
- default: false,
- },
- nightMode: {
- type: Boolean,
- default: false,
- },
- },
- { timestamps: true }
- );
- const User = model('user', userSchema);
- module.exports = User;
|