From c78fd0fc8372a5a32f8139878f0cb5ba21a15c4e Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Fri, 15 Aug 2025 04:58:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=90=20feat:=20Group=20schema=20support?= =?UTF-8?q?,=20refine=20user=20schema=20security,=20and=20improve=20types?= =?UTF-8?q?=20(#9070)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add groupSchema and update userSchema to hide sensitive fields * chore: Bump version of @librechat/data-schemas to 0.0.16 --- package-lock.json | 2 +- packages/data-schemas/package.json | 2 +- packages/data-schemas/src/schema/index.ts | 1 + packages/data-schemas/src/schema/user.ts | 2 ++ packages/data-schemas/src/types/group.ts | 14 ++++++-------- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c4b14c99..9bf8acf6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51874,7 +51874,7 @@ }, "packages/data-schemas": { "name": "@librechat/data-schemas", - "version": "0.0.15", + "version": "0.0.16", "license": "MIT", "devDependencies": { "@rollup/plugin-alias": "^5.1.0", diff --git a/packages/data-schemas/package.json b/packages/data-schemas/package.json index 71c5ccc63..91068d2e6 100644 --- a/packages/data-schemas/package.json +++ b/packages/data-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@librechat/data-schemas", - "version": "0.0.15", + "version": "0.0.16", "description": "Mongoose schemas and models for LibreChat", "type": "module", "main": "dist/index.cjs", diff --git a/packages/data-schemas/src/schema/index.ts b/packages/data-schemas/src/schema/index.ts index a7de162e0..2d94db530 100644 --- a/packages/data-schemas/src/schema/index.ts +++ b/packages/data-schemas/src/schema/index.ts @@ -23,3 +23,4 @@ export { default as toolCallSchema } from './toolCall'; export { default as transactionSchema } from './transaction'; export { default as userSchema } from './user'; export { default as memorySchema } from './memory'; +export { default as groupSchema } from './group'; diff --git a/packages/data-schemas/src/schema/user.ts b/packages/data-schemas/src/schema/user.ts index 3a0f14054..d46d4f9c8 100644 --- a/packages/data-schemas/src/schema/user.ts +++ b/packages/data-schemas/src/schema/user.ts @@ -51,6 +51,7 @@ const userSchema = new Schema( trim: true, minlength: 8, maxlength: 128, + select: false, }, avatar: { type: String, @@ -114,6 +115,7 @@ const userSchema = new Schema( }, totpSecret: { type: String, + select: false, }, backupCodes: { type: [BackupCodeSchema], diff --git a/packages/data-schemas/src/types/group.ts b/packages/data-schemas/src/types/group.ts index 22d68a6aa..4a46b417e 100644 --- a/packages/data-schemas/src/types/group.ts +++ b/packages/data-schemas/src/types/group.ts @@ -1,6 +1,6 @@ -import type { Document, Types } from 'mongoose'; +import { Document } from 'mongoose'; -export type Group = { +export interface IGroup extends Document { /** The name of the group */ name: string; /** Optional description of the group */ @@ -15,9 +15,7 @@ export type Group = { source: 'local' | 'entra'; /** External ID (e.g., Entra ID) - required for non-local sources */ idOnTheSource?: string; -}; - -export type IGroup = Group & - Document & { - _id: Types.ObjectId; - }; + /** Timestamps */ + createdAt?: Date; + updatedAt?: Date; +}