LibreChat/packages/data-schemas/src/methods/index.ts
Danny Avila 76e070048c
refactor(data-schemas): update model and method creation for improved modularity
- Refactored model creation functions to enhance clarity and consistency across the data-schemas.
- Introduced createModels and createMethods functions to streamline the instantiation of Mongoose models and methods.
- Updated test-role.js to utilize the new createModels and createMethods for better organization.
2025-05-30 12:20:01 -04:00

18 lines
641 B
TypeScript

import { createUserMethods, type UserMethods } from './user';
import { createSessionMethods, type SessionMethods } from './session';
import { createTokenMethods, type TokenMethods } from './token';
import { createRoleMethods, type RoleMethods } from './role';
/**
* Creates all database methods for all collections
*/
export function createMethods(mongoose: typeof import('mongoose')) {
return {
...createUserMethods(mongoose),
...createSessionMethods(mongoose),
...createTokenMethods(mongoose),
...createRoleMethods(mongoose),
};
}
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods;