Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gear/joh 56 johnjud backend filter find all pet #18

Merged
merged 24 commits into from
Jan 13, 2024

Conversation

macgeargear
Copy link
Contributor

@macgeargear macgeargear commented Jan 13, 2024

Change made

  •  Bug fixes
  •  New features
  •  Breaking changes

Describe what you have done

  • add filter logic and pagination for findAll pet request

New Features

  • filter & paginate for pet request

Fix

Others

  • i assume that birthDate from frontend is ISOString
  • query page=3 and pageSize=8 should return pet 17-24 (i use name for count)
Screenshot 2024-01-13 at 09 51 23
  • filtering logic should work
Screenshot 2024-01-13 at 00 42 47 Screenshot 2024-01-13 at 00 34 33 Screenshot 2024-01-13 at 00 34 17 Screenshot 2024-01-13 at 11 22 03

Copy link

linear bot commented Jan 13, 2024

src/app/repository/pet/pet.repository.go Outdated Show resolved Hide resolved
src/app/utils/pet/pet.utils.go Outdated Show resolved Hide resolved
@bookpanda
Copy link
Contributor

bookpanda commented Jan 13, 2024

{
    pets: [
        {
          name: "John",
          species: "Human",
          birthdate: "1990-01-01",
	    ......
        },
        {
          name: "John",
          species: "Human",
          birthdate: "1990-01-01",
	    ......
        },
	  ......
    ],
    metadata: {
      page: 1, 			// current page
      total_pages: 10,		// total pages
      page_size: 10, 		// items per page
      total: 100, 		// total FILTERED items
    },
};

The response should also show metadata, you can add it in proto. a
There are 10 pages, each with 10 pets, so total = 100

@macgeargear
Copy link
Contributor Author

{
    pets: [
        {
          name: "John",
          species: "Human",
          birthdate: "1990-01-01",
	    ......
        },
        {
          name: "John",
          species: "Human",
          birthdate: "1990-01-01",
	    ......
        },
	  ......
    ],
    metadata: {
      page: 1, 			// current page
      total_pages: 10,		// total pages
      page_size: 10, 		// items per page
      total: 100, 		// total FILTERED items
    },
};

The response should also show metadata, you can add it in proto. a There are 10 pages, each with 10 pets, so total = 100

Screenshot 2024-01-13 at 15 04 48

@bookpanda
Copy link
Contributor

Why are there 5 pages of size 8 when there's 41 items? (8*5=40 max)

@macgeargear macgeargear merged commit 8570958 into dev Jan 13, 2024
2 checks passed
@macgeargear macgeargear deleted the gear/joh-56-johnjud-backend-filter-find-all-pet branch January 13, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants