mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-10 03:24:24 +01:00
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.
This commit is contained in:
parent
728d19e361
commit
76e070048c
15 changed files with 107 additions and 117 deletions
|
|
@ -6,7 +6,7 @@ import { createRoleMethods, type RoleMethods } from './role';
|
|||
/**
|
||||
* Creates all database methods for all collections
|
||||
*/
|
||||
export function createAllMethods(mongoose: typeof import('mongoose')) {
|
||||
export function createMethods(mongoose: typeof import('mongoose')) {
|
||||
return {
|
||||
...createUserMethods(mongoose),
|
||||
...createSessionMethods(mongoose),
|
||||
|
|
@ -16,9 +16,3 @@ export function createAllMethods(mongoose: typeof import('mongoose')) {
|
|||
}
|
||||
|
||||
export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods;
|
||||
|
||||
// Also export individual factory functions for granular usage if needed
|
||||
export { createUserMethods, type UserMethods } from './user';
|
||||
export { createSessionMethods, type SessionMethods } from './session';
|
||||
export { createTokenMethods, type TokenMethods } from './token';
|
||||
export { createRoleMethods, type RoleMethods } from './role';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue