Skip to content

Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces#29

Merged
andres15alvarez merged 10 commits into
devfrom
refactor/ADM/sdk-types-users-branches
May 1, 2025
Merged

Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces#29
andres15alvarez merged 10 commits into
devfrom
refactor/ADM/sdk-types-users-branches

Conversation

@gus211
Copy link
Copy Markdown
Contributor

@gus211 gus211 commented Apr 26, 2025

Summary

This PR updates the Users, Branches, Products, and Promos pages to:

  • Use enums and types directly from @pharmatech/sdk to improve type safety.
  • Remove duplicated types like BranchResponse and ApiUserResponse.
  • Clean and simplify form handling, payload building, and validation processes.
  • Maintain all existing UI and functionality without visual or behavioral changes.

Changes

Branches:

  • List, Create, View (Delete), and Edit pages updated to use BranchStatus enum.
  • Status mappings and filtering made type-safe.

Users:

  • List, Create, View (Delete), and Edit pages updated to use UserRole and UserGender from the SDK.
  • Role and gender mappings improved using enums.

Products:

  • List page updated to use GenericProductResponse and CategoryResponse from SDK.

Promos

  • No need for refactor.

Improvements

  • Centralized type usage from SDK across the platform.
  • Cleaner code, fewer potential bugs, and easier maintenance.
  • Stronger type-checking and payload validation.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 26, 2025

Deploy Preview for pharmatechadmin ready!

Name Link
🔨 Latest commit 18e273f
🔍 Latest deploy log https://app.netlify.com/sites/pharmatechadmin/deploys/680d5bfbf229af00075d3b3a
😎 Deploy Preview https://deploy-preview-29--pharmatechadmin.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gus211 gus211 self-assigned this Apr 26, 2025
@gus211 gus211 added the refactor Improve code without changing behavior label Apr 26, 2025
@gus211 gus211 changed the title WIP refactor(branches, user): migrate CRUD to SDK types and remove local interfaces Refactor(branches, user): migrate CRUD to SDK types and remove local interfaces Apr 26, 2025
@gus211 gus211 marked this pull request as ready for review April 26, 2025 05:34
@gus211 gus211 changed the title Refactor(branches, user): migrate CRUD to SDK types and remove local interfaces Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces Apr 26, 2025
@gus211 gus211 marked this pull request as draft April 26, 2025 16:15
@gus211 gus211 changed the title Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces WIP Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces Apr 26, 2025
@gus211 gus211 marked this pull request as ready for review April 26, 2025 22:55
@gus211 gus211 changed the title WIP Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces Refactor(branches, user, generic products and promos): migrate CRUD to SDK types and remove local interfaces Apr 26, 2025
@FranciscoMCR
Copy link
Copy Markdown
Contributor

lgtm, great work

@andres15alvarez andres15alvarez merged commit dead04e into dev May 1, 2025
5 checks passed
@andres15alvarez andres15alvarez deleted the refactor/ADM/sdk-types-users-branches branch May 1, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Improve code without changing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants