mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-24 05:28:36 -06:00
Update pagination limit to ensure a minimum value of 1 and a maximum value of 100
This commit is contained in:
@@ -16,7 +16,7 @@ func (s *Service) PaginateBackups(
|
||||
ctx context.Context, params PaginateBackupsParams,
|
||||
) (paginateutil.PaginateResponse, []dbgen.Backup, error) {
|
||||
page := max(params.Page, 1)
|
||||
limit := max(params.Limit, 100)
|
||||
limit := min(max(params.Limit, 1), 100)
|
||||
|
||||
count, err := s.dbgen.BackupsServicePaginateBackupsCount(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func (s *Service) PaginateDatabases(
|
||||
ctx context.Context, params PaginateDatabasesParams,
|
||||
) (paginateutil.PaginateResponse, []dbgen.DatabasesServicePaginateDatabasesRow, error) {
|
||||
page := max(params.Page, 1)
|
||||
limit := max(params.Limit, 100)
|
||||
limit := min(max(params.Limit, 1), 100)
|
||||
|
||||
count, err := s.dbgen.DatabasesServicePaginateDatabasesCount(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func (s *Service) PaginateDestinations(
|
||||
ctx context.Context, params PaginateDestinationsParams,
|
||||
) (paginateutil.PaginateResponse, []dbgen.DestinationsServicePaginateDestinationsRow, error) {
|
||||
page := max(params.Page, 1)
|
||||
limit := max(params.Limit, 100)
|
||||
limit := min(max(params.Limit, 1), 100)
|
||||
|
||||
count, err := s.dbgen.DestinationsServicePaginateDestinationsCount(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func (s *Service) PaginateExecutions(
|
||||
ctx context.Context, params PaginateExecutionsParams,
|
||||
) (paginateutil.PaginateResponse, []dbgen.Execution, error) {
|
||||
page := max(params.Page, 1)
|
||||
limit := max(params.Limit, 100)
|
||||
limit := min(max(params.Limit, 1), 100)
|
||||
|
||||
count, err := s.dbgen.ExecutionsServicePaginateExecutionsCount(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user