listusers with loginname

This commit is contained in:
peintnermax
2024-09-11 09:27:04 +02:00
parent 9cba5755c3
commit 08a4cbff24
3 changed files with 19 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ export type SendLoginnameCommand = {
export async function sendLoginname(command: SendLoginnameCommand) { export async function sendLoginname(command: SendLoginnameCommand) {
const users = await listUsers({ const users = await listUsers({
userName: command.loginName, loginName: command.loginName,
organizationId: command.organization, organizationId: command.organization,
}); });

View File

@@ -9,7 +9,7 @@ type ResetPasswordCommand = {
export async function resetPassword(command: ResetPasswordCommand) { export async function resetPassword(command: ResetPasswordCommand) {
const users = await listUsers({ const users = await listUsers({
userName: command.loginName, loginName: command.loginName,
organizationId: command.organization, organizationId: command.organization,
}); });

View File

@@ -258,23 +258,39 @@ export async function getUserByID(userId: string) {
} }
export async function listUsers({ export async function listUsers({
loginName,
userName, userName,
email, email,
organizationId, organizationId,
}: { }: {
loginName?: string;
userName?: string; userName?: string;
email?: string; email?: string;
organizationId?: string; organizationId?: string;
}) { }) {
const queries: SearchQuery[] = []; const queries: SearchQuery[] = [];
if (loginName) {
queries.push(
create(SearchQuerySchema, {
query: {
case: "loginNameQuery",
value: {
loginName: loginName,
method: TextQueryMethod.EQUALS,
},
},
}),
);
}
if (userName) { if (userName) {
queries.push( queries.push(
create(SearchQuerySchema, { create(SearchQuerySchema, {
query: { query: {
case: "userNameQuery", case: "userNameQuery",
value: { value: {
userName, userName: userName,
method: TextQueryMethod.EQUALS, method: TextQueryMethod.EQUALS,
}, },
}, },