Files
Chayan DasandGitHub 4e529cbad1 fix: user table to load on scroll (#29593)
* fix: load more users on table scroll

Signed-off-by: Chayan Das <[email protected]>

* refactor: move user listing logic to UserRepository

Add a dedicated listUsers method with search and cursor pagination support.

Add repository tests covering filtering and pagination.

Ensure user listing metadata remains consistent with the returned results.

Signed-off-by: Chayan Das <[email protected]>

---------

Signed-off-by: Chayan Das <[email protected]>
2026-06-18 18:09:12 +00:00

33 lines
722 B
TypeScript

import { getUserRepository } from "@calcom/features/di/containers/UserRepository";
import type { TrpcSessionUser } from "../../../types";
import type { TListMembersSchema } from "./listPaginated.schema";
type GetOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TListMembersSchema;
};
const listPaginatedHandler = async ({ input }: GetOptions) => {
const userRepository = getUserRepository();
const { cursor, limit, searchTerm } = input;
const { users, total, nextCursor } = await userRepository.listUsers({
searchTerm,
limit,
cursor
})
return {
rows: users,
nextCursor,
meta: {
totalRowCount: total
}
};
};
export default listPaginatedHandler;