Skip to content

Yana P. - #3

Open
YanaP1312 wants to merge 4 commits into
HackYourAssignment:mainfrom
YanaP1312:main
Open

YanaP1312 wants to merge 4 commits into
HackYourAssignment:mainfrom
YanaP1312:main

Conversation

@YanaP1312

Copy link
Copy Markdown

Implements all tasks from the assignment:

  • Task 1 — Connected the API to a PostgreSQL database via environment variables.
  • Task 2 — Added details (jsonb) field to the product response. Implemented findByColor supporting both single color and color arrays. Implemented setSize using jsonb_set.
  • Task 3 — Added Backblaze B2 image upload support. Created FileService with upload and delete operations. Implemented setProductImage and deleteProductImage in ProductService, saving and clearing the image URL in the database.

return productService.getAllProducts();
}

@GetMapping("/search")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@YanaP1312 , @GetMapping ("/search") got replaced by @GetMapping (params = "color").
Why does endpoint got changed here ? Does exisiting searchProducts API working ? If there is frontend intergation then it will broke it.

public List<Product> getAllProducts() {
return jdbcClient
.sql("SELECT id, title, price, category, image_url FROM products")
.sql("SELECT * FROM products ORDER BY id")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Its not a best practice to use * in select query even though im movement all colums getting fetched

public Product findById(int id) {
return jdbcClient
.sql("SELECT id, title, price, category, image_url FROM products WHERE id = :id")
.sql("SELECT * FROM products WHERE id = :id")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Its not a best practice to use * in select query even though im movement all colums getting fetched

@Gayatri61 Gayatri61 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.

Please check productController and ProductRepository file comments.

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.

3 participants