fix
This commit is contained in:
@@ -283,8 +283,12 @@ module.exports.add_representation = [
|
|||||||
data.representation_code = representation_code
|
data.representation_code = representation_code
|
||||||
|
|
||||||
const representation = new Representation(data)
|
const representation = new Representation(data)
|
||||||
await representation.save()
|
|
||||||
const user = await User.findById(user_id)
|
const user = await User.findById(user_id)
|
||||||
|
if(!user){
|
||||||
|
res404(res,"آین کاربر در دیتای ما وجود ندارد")
|
||||||
|
}else{
|
||||||
|
await representation.save()
|
||||||
|
}
|
||||||
user.askedForRepresentation = true
|
user.askedForRepresentation = true
|
||||||
user.representation_code = representation_code
|
user.representation_code = representation_code
|
||||||
await user.save()
|
await user.save()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ FilesSchema.virtual('url').get(file)
|
|||||||
|
|
||||||
const RepresentationSchema = mongoose.Schema({
|
const RepresentationSchema = mongoose.Schema({
|
||||||
// user info
|
// user info
|
||||||
user_id: { type: mongoose.ObjectId, ref: 'User' },
|
user_id: { type: String, ref: 'User' },
|
||||||
representation_code: String,
|
representation_code: String,
|
||||||
agent_code: String,
|
agent_code: String,
|
||||||
editAccess: { type: Boolean, default: false },
|
editAccess: { type: Boolean, default: false },
|
||||||
|
|||||||
Reference in New Issue
Block a user