fix : User history fix for returning most recently executed 50 user history REST/GraphQL items (HBE-165) (#27)
* chore: updated fetchUserHistory operation to return recently executed 50 entries * chore: updated history to use PaginationArgs for operation * chore: updated GraphQL resolver name
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Parent, ResolveField, Resolver } from '@nestjs/graphql';
|
||||
import { Args, Parent, ResolveField, Resolver } from '@nestjs/graphql';
|
||||
import { User } from '../user/user.model';
|
||||
import { UserHistoryService } from './user-history.service';
|
||||
import { ReqType, UserHistory } from './user-history.model';
|
||||
import { PaginationArgs } from '../types/input-types.args';
|
||||
|
||||
@Resolver(() => User)
|
||||
export class UserHistoryUserResolver {
|
||||
@@ -9,18 +10,26 @@ export class UserHistoryUserResolver {
|
||||
@ResolveField(() => [UserHistory], {
|
||||
description: 'Returns a users REST history',
|
||||
})
|
||||
async RESTHistory(@Parent() user: User): Promise<UserHistory[]> {
|
||||
async RESTHistory(
|
||||
@Parent() user: User,
|
||||
@Args() args: PaginationArgs,
|
||||
): Promise<UserHistory[]> {
|
||||
return await this.userHistoryService.fetchUserHistory(
|
||||
user.uid,
|
||||
args.take,
|
||||
ReqType.REST,
|
||||
);
|
||||
}
|
||||
@ResolveField(() => [UserHistory], {
|
||||
description: 'Returns a users GraphQL history',
|
||||
})
|
||||
async GraphQLHistory(@Parent() user: User): Promise<UserHistory[]> {
|
||||
async GQLHistory(
|
||||
@Parent() user: User,
|
||||
@Args() args: PaginationArgs,
|
||||
): Promise<UserHistory[]> {
|
||||
return await this.userHistoryService.fetchUserHistory(
|
||||
user.uid,
|
||||
args.take,
|
||||
ReqType.GQL,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user