bugfix: Enhance Agent and AgentCategory schemas with new fields for category, support contact, and promotion status

This commit is contained in:
“Praneeth 2025-06-11 22:55:07 +05:30 committed by Danny Avila
parent f55cdc9b7f
commit 348ee5821e
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
5 changed files with 57 additions and 100 deletions

View file

@ -92,6 +92,35 @@ const agentSchema = new Schema<IAgent>(
type: [Schema.Types.Mixed],
default: [],
},
category: {
type: String,
trim: true,
index: true,
default: 'general',
},
support_contact: {
type: {
name: {
type: String,
minlength: [3, 'Support contact name must be at least 3 characters.'],
trim: true,
},
email: {
type: String,
match: [
/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/,
'Please enter a valid email address.',
],
trim: true,
},
},
default: {},
},
is_promoted: {
type: Boolean,
default: false,
index: true,
},
},
{
timestamps: true,

View file

@ -36,4 +36,10 @@ export interface IAgent extends Omit<Document, 'model'> {
versions?: Omit<IAgent, 'versions'>[];
category: string;
support_contact?: ISupportContact;
category: string;
support_contact?: {
name?: string;
email?: string;
};
is_promoted?: boolean;
}