-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: server select to load infinite data (#322)
* wip: inifinite loading select * fix: select - add limit 10 for VolunteerSelect and remove the hardcoded value in listing/volunteer ctrl * fix: select - allow listing/events to limit, set limit to 10 in EventSelect * fix: select - add page and limit to listing/admins, set limit to 10 * fix: select - add pagination to location/city --------- Co-authored-by: luciatugui <[email protected]>
- Loading branch information
1 parent
71feee8
commit 906881b
Showing
24 changed files
with
386 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { IsOptional, IsString, MinLength } from 'class-validator'; | ||
import { IsOptional, IsPositive, IsString } from 'class-validator'; | ||
import { BasePaginationFilterDto } from 'src/infrastructure/base/base-pagination-filter.dto'; | ||
|
||
export class GetCityDto { | ||
export class GetCityDto extends BasePaginationFilterDto { | ||
@IsString() | ||
@IsOptional() | ||
@MinLength(3) | ||
search: string; | ||
search?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
city: string; | ||
|
||
@IsString() | ||
@IsPositive() | ||
@IsOptional() | ||
county: string; | ||
countyId?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
backend/src/common/interfaces/repository-with-pagination.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
backend/src/modules/location/interfaces/location-repository.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { Pagination } from 'src/infrastructure/base/repository-with-pagination.class'; | ||
import { FindLocationOptions, ICityModel } from '../model/city.model'; | ||
import { ICountyModel } from '../model/county.model'; | ||
|
||
export interface ILocationRepository { | ||
findCounties(): Promise<ICountyModel[]>; | ||
findCities(options: FindLocationOptions): Promise<ICityModel[]>; | ||
findCities(options: FindLocationOptions): Promise<Pagination<ICityModel>>; | ||
findCitiesByCountyId(countyId: number): Promise<ICityModel[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { IUseCaseService } from 'src/common/interfaces/use-case-service.interface'; | ||
import { Pagination } from 'src/infrastructure/base/repository-with-pagination.class'; | ||
import { | ||
FindLocationOptions, | ||
ICityModel, | ||
} from 'src/modules/location/model/city.model'; | ||
import { LocationFacade } from 'src/modules/location/services/location.facade'; | ||
|
||
@Injectable() | ||
export class GetCitiesUseCase implements IUseCaseService<ICityModel[]> { | ||
export class GetCitiesUseCase | ||
implements IUseCaseService<Pagination<ICityModel>> | ||
{ | ||
constructor(private readonly locationFacade: LocationFacade) {} | ||
|
||
public async execute(options: FindLocationOptions): Promise<ICityModel[]> { | ||
public async execute( | ||
options: FindLocationOptions, | ||
): Promise<Pagination<ICityModel>> { | ||
return this.locationFacade.findCities(options); | ||
} | ||
} |
Oops, something went wrong.