@nestjs/graphql#Int TypeScript Examples
The following examples show how to use
@nestjs/graphql#Int.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: whisp.resolver.ts From whispr with MIT License | 6 votes |
@Query(() => [Whisp], { nullable: true })
async whisps(
@Args('filter', { type: () => GraphQLJSONObject, nullable: true })
filter?: Record<string, unknown>,
@Args('sort', { type: () => GraphQLJSONObject, nullable: true })
sort?: Record<string, unknown>,
@Args('limit', { type: () => Int, nullable: true }) limit?: number,
): Promise<IWhisp[]> {
return this.whispService.findAll(filter, sort, limit);
}
Example #2
Source File: IntFilter.ts From amplication with Apache License 2.0 | 6 votes |
@ApiProperty({
required: false,
type: Number,
})
@IsOptional()
@Field(() => Int, {
nullable: true,
})
@Type(() => Number)
equals?: number;
Example #3
Source File: games.resolver.ts From game-store-monorepo-app with MIT License | 6 votes |
@Query(() => RawgGameResponse, {
name: 'allGames',
})
async getAllGames(
@Args('page', { nullable: true, type: () => Int }) page?: number,
@Args('pageSize', { nullable: true, type: () => Int }) pageSize?: number,
@Args('dates', { nullable: true }) dates?: string,
@Args('ordering', { nullable: true }) ordering?: string,
@Args('tags', { nullable: true }) tags?: string,
@Args('genres', { nullable: true }) genres?: string,
@Args('publishers', { nullable: true }) publishers?: string,
@Args('search', { nullable: true }) search?: string,
): Promise<RawgGameResponse> {
const params = {
key: this.apiKey,
page,
page_size: pageSize || 10,
search,
genres,
tags,
publishers,
dates,
ordering,
};
this.logger.debug('getAllGames called with params', params);
const res = await this.httpService
.get<RawgGameResponse>(`${this.host}/games?${stringifyQueryObject(params)}`)
.toPromise();
const rawgResponse = plainToClass(RawgGameResponse, res.data);
return rawgResponse;
}
Example #4
Source File: form.list.query.ts From api with GNU Affero General Public License v3.0 | 6 votes |
@Query(() => FormPagerModel)
@Roles('user')
async listForms(
@User() user: UserEntity,
@Args('start', {type: () => Int, defaultValue: 0, nullable: true}) start: number,
@Args('limit', {type: () => Int, defaultValue: 50, nullable: true}) limit: number,
@Context('cache') cache: ContextCache,
): Promise<FormPagerModel> {
const [forms, total] = await this.formService.find(
start,
limit,
{},
user.roles.includes('superuser') ? null : user,
)
forms.forEach(form => cache.add(cache.getCacheKey(FormEntity.name, form.id), form))
return new FormPagerModel(
forms.map(form => new FormModel(this.idService.encode(form.id), form)),
total,
limit,
start,
)
}
Example #5
Source File: scalar.utils.spec.ts From nestjs-relay with MIT License | 6 votes |
describe('Scalar Utils', () => {
describe('returnsInt', () => {
it('should return the Int type', () => {
expect(returnsInt()).toEqual(Int);
});
});
});
Example #6
Source File: create-cat.input.ts From nestjs-mercurius with MIT License | 5 votes |
@Field(() => Int, { defaultValue: 9 })
lives: number;
Example #7
Source File: whisp.entity.ts From whispr with MIT License | 5 votes |
@Field(() => Int, { nullable: true })
severity?: number;
Example #8
Source File: AppCreateWithEntitiesInput.ts From amplication with Apache License 2.0 | 5 votes |
@Field(() => [Int], {
nullable: true
})
relationsToEntityIndex?: number[] | null;
Example #9
Source File: esrb-rating.entity.ts From game-store-monorepo-app with MIT License | 5 votes |
@Field((type) => Int)
id: number;