GIF89a
import mongoose from 'mongoose';
import { roleContaints } from '../validators/constaints.js'
import { validateName } from '../validators/validators.js';
// user.schema.js
const UserSchema = new mongoose.Schema({
authId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Auth",
},
categories: [{
type: mongoose.Schema.Types.ObjectId,
ref: "Category"
}],
fullName: {
type: String,
// required: [true, 'Full name is required'],
trim: true,
minlength: [3, "Name must be at least 3 characters"],
maxlength: [50, "Name cannot exceed 50 characters"],
validator: validateName,
},
avatar: String,
role: {
type: String,
enum: [roleContaints.user, roleContaints.admin, roleContaints.artist, roleContaints.creator, roleContaints.musician, roleContaints.studio, roleContaints.lyrics, roleContaints.both],
default: roleContaints.user,
},
isVarifiedAsArtist: {
type: Boolean,
default: false
},
aadhaarFront: {
type: String
},
aadhaarBack: {
type: String
},
shortVideo: {
type: String
},
services: {
type: String
},
dob: {
type: Date
},
experties: [{
type: String
}],
profession: {
type: [String]
},
about: {
type: String
},
socialLinks: {
instagram: String,
facebook: String,
youtube: String,
website: String,
linkedin: String,
twitter: String
},
termsAndConditions: {
type: Boolean,
default: false
},
location: {
type: String
},
studio: [
{
public_id: String,
url: String
}
],
status: {
type: String,
enum: ['active', 'inactive'],
default: 'active',
}
}, { timestamps: true });
const User = mongoose.model('User', UserSchema);
export default User;