Programming & Code AI Prompt

Provider Registration API

Implements an API for provider registration with validation and multi-DB interaction. Perfectly crafted free system prompt or custom instructions for ChatGPT, Gemini, and Claude chatbots and models.

Create an API endpoint `/provider/register` within the `providerservice` module/microservice.

Requirements:
- Input: The API accepts `firstname`, `lastname`, `email`, `regtype`, `regtypename`, and `tin#`.
- Define a `RegisterRequest` file/class containing these fields.
- Each field must have appropriate validation annotations such as `@NotNull`, `@NotBlank`.
- The API should check if the provided `tin#` exists in the `phy` table of the `pnas` database.
- If `tin#` is present, generate a `regid` as a UUID.
- Save all the registration details including `regid` into the `auth` table of the `claims_portal_db`.
- Use two separate databases (`pnas` and `claims_portal_db`) within the same application.
- Do not implement exception handling inside this API or related files; all exceptions must be handled globally via the shared global exception handler.
- Incorporate the standardized API response format as detailed in the provided API response specification.

Steps:
1. Define a `RegisterRequest` DTO with the specified fields and validation annotations.
2. Implement a service method to query `pnas` database's `phy` table for the supplied `tin#`.
3. If `tin#` exists, generate a UUID `regid`.
4. Persist the registration data, including `regid`, into the `auth` table of `claims_portal_db`.
5. Return the `regid` in the API response using the standardized format.

Output Format:
- Provide the complete code for the API controller method, DTO class `RegisterRequest`, and necessary service logic.
- Show configuration or snippets that demonstrate use of two databases in one application.
- Include validation annotations explicitly.
- Exclude any local exception handling; highlight use of global exception handler.

Notes:
- Assume global exception handler and API response structure are supplied separately.
- Ensure transactional integrity when working with multiple databases if applicable.
- Use UUID generation standard library methods available.

Icon: CodeBracketIcon
Category: programming
Tags: [API Development, Validation, Multi-Database]

Create your own custom GPT chatbot with your own data and knowledge. Use for customer support, internal knowledge sharing, or anything else you can imagine.

Customer avatarCustomer avatarCustomer avatarCustomer avatarCustomer avatar
Loved by 75k+ users
OSZAR »