feat: Add cursor pagination utilities and refine user/group/role types in @librechat/data-schemas (#9218)

* feat: Add pagination interfaces and update user and group types for better data handling

* fix: Update data-schemas version to 0.0.19
This commit is contained in:
Marco Beretta 2025-08-23 06:18:31 +02:00 committed by GitHub
parent 0e00f357a6
commit ac608ded46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 108 additions and 20 deletions

View file

@ -1,5 +1,5 @@
import mongoose, { FilterQuery } from 'mongoose';
import type { IUser, BalanceConfig, UserCreateData, UserUpdateResult } from '~/types';
import type { IUser, BalanceConfig, CreateUserRequest, UserDeleteResult } from '~/types';
import { signPayload } from '~/crypto';
/** Factory function that takes mongoose instance and returns the methods */
@ -31,7 +31,7 @@ export function createUserMethods(mongoose: typeof import('mongoose')) {
* Creates a new user, optionally with a TTL of 1 week.
*/
async function createUser(
data: UserCreateData,
data: CreateUserRequest,
balanceConfig?: BalanceConfig,
disableTTL: boolean = true,
returnUser: boolean = false,
@ -123,7 +123,7 @@ export function createUserMethods(mongoose: typeof import('mongoose')) {
/**
* Delete a user by their unique ID.
*/
async function deleteUserById(userId: string): Promise<UserUpdateResult> {
async function deleteUserById(userId: string): Promise<UserDeleteResult> {
try {
const User = mongoose.models.User;
const result = await User.deleteOne({ _id: userId });