mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
✨ 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:
parent
0e00f357a6
commit
ac608ded46
9 changed files with 108 additions and 20 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue