NY1105 / e-commerce

0 stars 0 forks source link

[BUG] getCartById does not return cart with respective cartId provided #9

Closed whongam closed 10 months ago

whongam commented 10 months ago

Summary

Validation seems missing for password during user registration Passwords are suppose to have 8+ length, 1+ Special, 1+ Uppercase, 1+ Lowercase

Severity

Major

Reporter

@NY1105

Assignee

@NY1105 @whongam

Product

e-commerce

Component

Backend API -> User

Version

Release 2

Environment

Visual Studio Code

Version: 1.85.0 (Universal) Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c Date: 2023-12-06T18:18:04.614Z (4 days ago) Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: macOS Darwin arm64 22.6.0

Thunder Client (Equivalent to Postman)

v2.16.2

Description

Prerequisites: 1.0 Make sure the database is empty and initiated 1.1 In CLI, run mvn spring-boot:run to start the server In API caller, request

GET localhost:8080/cart?cartId=1

Current result:

WhatsApp Image 2023-12-11 at 22 13 25

Expected result

'{cartId=1, products=null}'

NY1105 commented 10 months ago

Problem

Syntax error

@GetMapping("/cart")
public Cart getCartById(@RequestParam(required = false) Long cartId) throws CartNotFoundException {
    return cart_service.findById(cartId);
}

Solution

    @GetMapping("/cart")
    public Cart getCartById(@RequestParam(required = false) long cartId) throws CartNotFoundException {
        return cart_service.findById(cartId);
    }

Conclusion

Fixed, Tested, Closing