refactor: Update support_contact field initialization in agent model
- Removed handling for empty support_contact object in createAgent function. - Changed default value of support_contact in agent schema to undefined.
This commit is contained in:
@@ -39,14 +39,6 @@ const createAgent = async (agentData) => {
|
||||
category: agentData.category || 'general',
|
||||
};
|
||||
|
||||
// Handle empty support_contact object
|
||||
if (agentData.support_contact && Object.keys(agentData.support_contact).length === 0) {
|
||||
initialAgentData.support_contact = {
|
||||
name: '',
|
||||
email: '',
|
||||
};
|
||||
}
|
||||
|
||||
return (await Agent.create(initialAgentData)).toObject();
|
||||
};
|
||||
|
||||
|
||||
@@ -100,10 +100,7 @@ const agentSchema = new Schema<IAgent>(
|
||||
},
|
||||
support_contact: {
|
||||
type: Schema.Types.Mixed,
|
||||
default: {
|
||||
name: '',
|
||||
email: '',
|
||||
},
|
||||
default: undefined,
|
||||
},
|
||||
is_promoted: {
|
||||
type: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user