Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- **Database**: Added a unique **and non-nullable** constraint on `phoneNumber` column of the `Customer` table (Prisma schema & migration).
- **API**: Implemented application-level handling for duplicate phone numbers – requests that attempt to create a customer with an existing `phoneNumber` now return **HTTP 409 Conflict** (error code `DuplicatePhoneNumberError`).
Copy link
Author

Choose a reason for hiding this comment

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

Minor but important: the error class is named DuplicatePhoneNumberError server-side, but the client receives the standardized error code DUPLICATE_PHONE_NUMBER. Aligning the wording here (or adding the literal string) makes it easier for frontend consumers scanning the changelog to know what to guard for.

- **Validation**: `CustomerCreateInput` now validates that `phoneNumber` is non-empty and matches the expected numeric pattern.
- **Testing**: Added unit and integration tests covering duplicate phone number scenarios.

### Changed
- Updated Swagger / DTO documentation to indicate that `phoneNumber` must be unique.

### Fixed
- Prevented accidental creation of multiple customers with the same `phoneNumber`.

---

## [0.1.0] – 2025-09-11
### Added
- Initial public release generated by Amplication, containing server (NestJS GraphQL API) and admin UI (React-Admin).
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ Inside `apps/hotel-management-service-admin`:

The Prisma schema is located under `apps/hotel-management-service-server/prisma/schema.prisma`.

> **Note**: Starting from the next release the `phoneNumber` field on the **Customer** model is now **required and unique** (non-nullable). Attempting to insert two customers with the same phone number – or omitting a phone number – will result in an HTTP 409 Conflict or 400 validation error respectively.
>
> Before you deploy this change to an existing database **you must clean up existing duplicates** (if any). A helper script is provided:
>
> ```bash
> cd apps/hotel-management-service-server
> npm run cleanup:duplicates # removes duplicates, keeping the earliest record per phone number
Copy link
Author

Choose a reason for hiding this comment

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

Consider adding --preview-feature in the command (if required by your Prisma version) or specifying the Node environment (e.g. NODE_ENV=script) so that the script connects to the correct database. Without clear guidance, teams might accidentally run this against production before verifying in staging.

Copy link
Contributor

Choose a reason for hiding this comment

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

@overcut i accept that , please add a commit with this change on this PR

Copy link
Author

Choose a reason for hiding this comment

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

Working on "Interactive Mention Response"

Progress: 🟩⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0%

⏳ Initializing...


👉 View live progress & logs

I'll update this comment with progress and post final results when complete.

> ```
>
> Run the script once, verify the output, then proceed with the Prisma migration.

* Create & apply a new migration:

```bash
Expand Down
Loading