Skip to content

feat(user-management): integrated create user and get user api to the user management - #121

Open
panckeyk wants to merge 2 commits into
mainfrom
feat/create-user-get-user
Open

panckeyk wants to merge 2 commits into
mainfrom
feat/create-user-get-user

Conversation

@panckeyk

Copy link
Copy Markdown
Contributor

Ticket

Description

Integrates POST /api/users/ (create user) and GET /api/users/ (list users) endpoints into the user management frontend, replacing mock data with real API calls.

What's New

API Integration:

  • api/create-user.ts - React Query mutation for user creation with form validation
  • api/get-users.ts - React Query hook for paginated user list with keepPreviousData

Components:

  • add-user-form.tsx - New form component with React Hook Form + Zod validation
  • user-list.tsx - Container component managing API data, pagination, search, and filters
  • Updated add-user-dialog.tsx to use new form with proper mutation handling
  • Updated filters.tsx with controlled state + onApply callback pattern
  • Updated columns.tsx to use API types and backend field names
  • Updated role-badge.tsx to accept API role enum values

Route:

  • Added Zod search schema validation with defaults (page=1, pageSize=25, show=active, role=all, deleted=exclude)
  • Integrated UsersList component with DataTable shared components

Types:

  • Added User, UserQuery, UserPage, UserCreateInput, UserCreateResult to api.ts
  • Added Role type export from schema

Implementation Details

Follows established patterns from machines feature:

  • React Query with query invalidation on mutations
  • Shared DataTable components (DataTable, DataTableToolbar, DataTablePagination)
  • Route-based search params with TanStack Router
  • Filter component with local state + onApply callback
  • API types derived from OpenAPI schema
  • Backend field names (snake_case): first_name, last_name, is_active, date_joined, last_login

Breaking Changes

None - replaces mock implementation with API integration.

Dependencies

  • Requires backend UserOut schema with role field
  • Requires POST /api/users/ and GET /api/users/ endpoints

Files Changed

  • Added: api/create-user.ts, api/get-users.ts, add-user-form.tsx, user-list.tsx
  • Modified: add-user-dialog.tsx, columns.tsx, filters.tsx, role-badge.tsx, user-actions.tsx, constants.ts, index.tsx route
  • Removed: toolbar.tsx (replaced by shared DataTableToolbar)
  • Updated: types in api.ts, regenerated schema.d.ts

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Chore
  • Refactor
  • Documentation

Image Change

Copilot AI balanced review requested due to automatic review settings November 27, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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