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

feat: create endpoint to get users #81

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

Luana-ns
Copy link
Contributor

@Luana-ns Luana-ns commented Oct 18, 2023

Description

This PR fully implements the GET Users route, it includes:

  • Endpoint for GET /users
  • New fetchUsers DAO method
  • Create a shared pagination helper with basic validations that can be imported and merged with other Zod objects.
  • Defined a basic return interface for paginated calls, FE will need: data, total count and pagination info, WDYT?

TODO

I plan to finish this on my weekend

  • I want to add tests
  • Zod errors in the API params are not being automatically handled by nextjs API. Checking best way of doing that

Demo

@ogatalars @Luana-ns please also review this PR, comment doubts and suggestions.

@Luana-ns Luana-ns linked an issue Oct 18, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Oct 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2024 10:23pm

@Luana-ns Luana-ns added the enhancement New feature or request label Oct 18, 2023
@Luana-ns Luana-ns added this to the Admin milestone Oct 18, 2023
Copy link
Contributor

@guilherme-bbsa guilherme-bbsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

god job

@marco-souza
Copy link
Contributor

FYI, I think @Luana-ns have some changes to be pushed here to make this work mode "native" to nextjs

src/app/api/users/user.dao.ts Outdated Show resolved Hide resolved
src/dao/user.dao.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@marco-souza marco-souza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be careful with the things we're changing, as they are also used on the App UI, not only on the admin.

Also, let's study a little more about:

  • next.js
  • zod
  • how raise works

I left a few links for reference

src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/dao/user.dao.ts Outdated Show resolved Hide resolved
src/dao/user.dao.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Outdated Show resolved Hide resolved
src/dao/user.dao.ts Outdated Show resolved Hide resolved
@frattezi
Copy link

frattezi commented Mar 6, 2024

Hey @marco-souza we solved most issues here, just need to enhance some final points, let you know when this is ready

src/dao/user.dao.ts Show resolved Hide resolved
src/dao/user.dao.ts Show resolved Hide resolved
src/dao/user.dao.ts Outdated Show resolved Hide resolved
src/app/api/users/route.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create endpoint to get all Users
6 participants