mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-18 08:28:10 +01:00
🔄 refactor: Principal Type Handling in Search Principals to use Array
This commit is contained in:
parent
dcd96c29c5
commit
803ade8601
9 changed files with 68 additions and 151 deletions
|
|
@ -315,15 +315,15 @@ export const memory = (key: string) => `${memories()}/${encodeURIComponent(key)}
|
|||
export const memoryPreferences = () => `${memories()}/preferences`;
|
||||
|
||||
export const searchPrincipals = (params: q.PrincipalSearchParams) => {
|
||||
const { q: query, limit, type } = params;
|
||||
const { q: query, limit, types } = params;
|
||||
let url = `/api/permissions/search-principals?q=${encodeURIComponent(query)}`;
|
||||
|
||||
if (limit !== undefined) {
|
||||
url += `&limit=${limit}`;
|
||||
}
|
||||
|
||||
if (type !== undefined) {
|
||||
url += `&type=${type}`;
|
||||
if (types && types.length > 0) {
|
||||
url += `&types=${types.join(',')}`;
|
||||
}
|
||||
|
||||
return url;
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ export type MemoriesResponse = {
|
|||
export type PrincipalSearchParams = {
|
||||
q: string;
|
||||
limit?: number;
|
||||
type?: p.PrincipalType.USER | p.PrincipalType.GROUP | p.PrincipalType.ROLE;
|
||||
types?: Array<p.PrincipalType.USER | p.PrincipalType.GROUP | p.PrincipalType.ROLE>;
|
||||
};
|
||||
|
||||
export type PrincipalSearchResponse = {
|
||||
query: string;
|
||||
limit: number;
|
||||
type?: p.PrincipalType.USER | p.PrincipalType.GROUP | p.PrincipalType.ROLE;
|
||||
types?: Array<p.PrincipalType.USER | p.PrincipalType.GROUP | p.PrincipalType.ROLE>;
|
||||
results: p.TPrincipalSearchResult[];
|
||||
count: number;
|
||||
sources: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue