123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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,
- },
- 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,
- },
- color: {
- type: String,
- default: null,
- },
- token: {
- type: String,
- default: null,
- },
- code: {
- type: String,
- default: null,
- },
- online: {
- type: String,
- default: null,
- },
- },
- { timestamps: true }
- );
- const User = model('user', userSchema);
- module.exports = User;
|