Class

CartRepository

CartRepository()

Constructor

# new CartRepository()

CartRepository - Manages carts data.

View Source src/carts/CartRepository.js, line 6

Methods

# async getCartByUserId(userId) → {Object}

Get a cart by user ID.

Parameters:
Name Type Description
userId Number

The user ID.

View Source src/carts/CartRepository.js, line 42

  • If an error occurs.
Error
  • The cart object.
Object

# async getCartWithItems(cartId) → {Object}

Get a cart by ID and fetch related data.

Parameters:
Name Type Description
cartId Number

The cart ID.

View Source src/carts/CartRepository.js, line 32

  • If an error occurs.
Error
  • The cart object.
Object

CartRepository(DB, CartItemRepository, ModelsRegistry, CouponCodeService)

Constructor

# new CartRepository(DB, CartItemRepository, ModelsRegistry, CouponCodeService)

Parameters:
Name Type Description
DB Object
CartItemRepository CartItemRepository
ModelsRegistry ModelsRegistry
CouponCodeService CouponCodeService

View Source src/carts/CartRepository.js, line 18

Methods

# async getCartByUserId(userId) → {Object}

Get a cart by user ID.

Parameters:
Name Type Description
userId Number

The user ID.

View Source src/carts/CartRepository.js, line 42

  • If an error occurs.
Error
  • The cart object.
Object

# async getCartWithItems(cartId) → {Object}

Get a cart by ID and fetch related data.

Parameters:
Name Type Description
cartId Number

The cart ID.

View Source src/carts/CartRepository.js, line 32

  • If an error occurs.
Error
  • The cart object.
Object