123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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,
- },
- silentMode: {
- type: Boolean,
- default: false,
- },
- },
- { timestamps: true }
- );
- const User = model('user', userSchema);
- module.exports = User;
|