File size: 330 Bytes
f0743f4 | 1 2 3 4 5 6 7 8 9 10 | import agentSchema from '~/schema/agent';
import type { IAgent } from '~/types';
/**
* Creates or returns the Agent model using the provided mongoose instance and schema
*/
export function createAgentModel(mongoose: typeof import('mongoose')) {
return mongoose.models.Agent || mongoose.model<IAgent>('Agent', agentSchema);
}
|