Before:
Product entity and product table has these attributes
id
name
description
price
quantity
active
average_rating
reviews_count
brand_name
seller_name
After:
You need to add new product attributes:
Add new attributes to this create sql: 19.07.2023.part1.create-product-table.sql
Add new attributes and their values (generate using GPTchat) to this inserts sql: 19.07.2023.part2.insert-product-data.sql
Update ProductInfo entity class.
Update ProductInfoDto in swagger contract: product-openapi.yaml.
Update ProductInfoDtoConverter methods.
Update unit tests if it is applicable.
Update unit tests if it is applicable.
Test your changes by running backend project locally and send http requests using Postman.
New product attributes:
Country of Origin.
String (in the code) and Varchar128 (in db) type NOT NULL,
("origin_country" in the database, "originCountry" in the code.
Product weight.
Double (in the code) and DECIMAL (in db) type NOT NULL CHECK (weight > 0),
("weight" in the database, "weight" in the code.
Product length.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (size_length > 0),
("size_length" in the database, "lengthSize" in the code.
Product width.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (size_width > 0),
("size_width" in the database, "widthSize" in the code.
Product height.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (size_height > 0),
("size_height" in the database, "heightSize" in the code.
Sold products in past month.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (sold_products_count > 0),
("sold_products_count" in the database, "soldProductsCount" in the code.
Product discount.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (discount > 0),
("discount" in the database, "discount" in the code.
Date Added.
LocalDateTime (in the code) and TIMESTAMPTZ (in db) type NOT NULL CHECK (check that not in the future),
("date_added" in the database, "dateAdded" in the code.
Popularity Score.
INTEGER (in the code) and INT (in db) type NOT NULL CHECK (popularity_score > 0),
("popularity_score" in the database, "popularityScore" in the code.
Before: Product entity and product table has these attributes
After: You need to add new product attributes:
New product attributes:
Country of Origin. String (in the code) and Varchar128 (in db) type NOT NULL, ("origin_country" in the database, "originCountry" in the code.
Product weight. Double (in the code) and DECIMAL (in db) type NOT NULL CHECK (weight > 0), ("weight" in the database, "weight" in the code.
Product length. INTEGER (in the code) and INT (in db) type NOT NULL CHECK (size_length > 0), ("size_length" in the database, "lengthSize" in the code.
Product height. INTEGER (in the code) and INT (in db) type NOT NULL CHECK (size_height > 0), ("size_height" in the database, "heightSize" in the code.
Sold products in past month. INTEGER (in the code) and INT (in db) type NOT NULL CHECK (sold_products_count > 0), ("sold_products_count" in the database, "soldProductsCount" in the code.
Product discount. INTEGER (in the code) and INT (in db) type NOT NULL CHECK (discount > 0), ("discount" in the database, "discount" in the code.
Date Added. LocalDateTime (in the code) and TIMESTAMPTZ (in db) type NOT NULL CHECK (check that not in the future), ("date_added" in the database, "dateAdded" in the code.