feat: change fetchAllUsersV2 to fetchAllUsers
This commit is contained in:
committed by
Andrew Bastin
parent
abaddd94a5
commit
9ceef43c74
@@ -45,28 +45,17 @@ export class AdminService {
|
|||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch all the users in the infra.
|
|
||||||
* @param cursorID Users uid
|
|
||||||
* @param take number of users to fetch
|
|
||||||
* @returns an Either of array of user or error
|
|
||||||
*/
|
|
||||||
async fetchUsers(cursorID: string, take: number) {
|
|
||||||
const allUsers = await this.userService.fetchAllUsers(cursorID, take);
|
|
||||||
return allUsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all the users in the infra.
|
* Fetch all the users in the infra.
|
||||||
* @param searchString search on users displayName or email
|
* @param searchString search on users displayName or email
|
||||||
* @param paginationOption pagination options
|
* @param paginationOption pagination options
|
||||||
* @returns an Either of array of user or error
|
* @returns an Either of array of user or error
|
||||||
*/
|
*/
|
||||||
async fetchUsersV2(
|
async fetchUsers(
|
||||||
searchString: string,
|
searchString: string,
|
||||||
paginationOption: OffsetPaginationArgs,
|
paginationOption: OffsetPaginationArgs,
|
||||||
) {
|
) {
|
||||||
const allUsers = await this.userService.fetchAllUsersV2(
|
const allUsers = await this.userService.fetchAllUsers(
|
||||||
searchString,
|
searchString,
|
||||||
paginationOption,
|
paginationOption,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -79,19 +79,9 @@ export class InfraResolver {
|
|||||||
|
|
||||||
@ResolveField(() => [User], {
|
@ResolveField(() => [User], {
|
||||||
description: 'Returns a list of all the users in infra',
|
description: 'Returns a list of all the users in infra',
|
||||||
deprecationReason: 'Use allUsersV2 instead',
|
|
||||||
})
|
})
|
||||||
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
||||||
async allUsers(@Args() args: PaginationArgs): Promise<AuthUser[]> {
|
async allUsers(
|
||||||
const users = await this.adminService.fetchUsers(args.cursor, args.take);
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResolveField(() => [User], {
|
|
||||||
description: 'Returns a list of all the users in infra',
|
|
||||||
})
|
|
||||||
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
|
||||||
async allUsersV2(
|
|
||||||
@Args({
|
@Args({
|
||||||
name: 'searchString',
|
name: 'searchString',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
@@ -100,7 +90,7 @@ export class InfraResolver {
|
|||||||
searchString: string,
|
searchString: string,
|
||||||
@Args() paginationOption: OffsetPaginationArgs,
|
@Args() paginationOption: OffsetPaginationArgs,
|
||||||
): Promise<AuthUser[]> {
|
): Promise<AuthUser[]> {
|
||||||
const users = await this.adminService.fetchUsersV2(
|
const users = await this.adminService.fetchUsers(
|
||||||
searchString,
|
searchString,
|
||||||
paginationOption,
|
paginationOption,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -282,28 +282,13 @@ export class UserService {
|
|||||||
return E.right(jsonSession.right);
|
return E.right(jsonSession.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch all the users in the `User` table based on cursor
|
|
||||||
* @param cursorID string of userUID or null
|
|
||||||
* @param take number of users to query
|
|
||||||
* @returns an array of `User` object
|
|
||||||
*/
|
|
||||||
async fetchAllUsers(cursorID: string, take: number) {
|
|
||||||
const fetchedUsers = await this.prisma.user.findMany({
|
|
||||||
skip: cursorID ? 1 : 0,
|
|
||||||
take: take,
|
|
||||||
cursor: cursorID ? { uid: cursorID } : undefined,
|
|
||||||
});
|
|
||||||
return fetchedUsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all the users in the `User` table based on cursor
|
* Fetch all the users in the `User` table based on cursor
|
||||||
* @param searchString search on user's displayName or email
|
* @param searchString search on user's displayName or email
|
||||||
* @param paginationOption pagination options
|
* @param paginationOption pagination options
|
||||||
* @returns an array of `User` object
|
* @returns an array of `User` object
|
||||||
*/
|
*/
|
||||||
async fetchAllUsersV2(
|
async fetchAllUsers(
|
||||||
searchString: string,
|
searchString: string,
|
||||||
paginationOption: OffsetPaginationArgs,
|
paginationOption: OffsetPaginationArgs,
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user