This commit is contained in:
Mr Swift
2024-07-01 14:51:53 +03:30
parent b5abee05e0
commit ba691c65a9
2 changed files with 6 additions and 2 deletions
@@ -283,8 +283,12 @@ module.exports.add_representation = [
data.representation_code = representation_code
const representation = new Representation(data)
await representation.save()
const user = await User.findById(user_id)
if(!user){
res404(res,"آین کاربر در دیتای ما وجود ندارد")
}else{
await representation.save()
}
user.askedForRepresentation = true
user.representation_code = representation_code
await user.save()
+1 -1
View File
@@ -11,7 +11,7 @@ FilesSchema.virtual('url').get(file)
const RepresentationSchema = mongoose.Schema({
// user info
user_id: { type: mongoose.ObjectId, ref: 'User' },
user_id: { type: String, ref: 'User' },
representation_code: String,
agent_code: String,
editAccess: { type: Boolean, default: false },