change entity names
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||
import { DeliveryMethodEnum } from '../../delivery/interface/delivery';
|
||||
import { PaymentMethodEnum } from '../../payments/interface/payment';
|
||||
import { OrderCouponDetail } from '../../orders/interface/order.interface';
|
||||
import { DeliveryMethodEnum } from '../../../delivery/interface/delivery';
|
||||
import { PaymentMethodEnum } from '../../../payments/interface/payment';
|
||||
import { OrderCouponDetail } from '../../../orders/interface/order.interface';
|
||||
import { Cart } from '../interfaces/cart.interface';
|
||||
import { BulkAddItemsToCartDto } from '../dto/bulk-add-items.dto';
|
||||
import { ApplyCouponDto } from '../dto/apply-coupon.dto';
|
||||
import { SetAllCartParmsDto } from '../dto/set-all-cart-params.dto';
|
||||
import { CouponService } from '../../coupons/providers/coupon.service';
|
||||
import { CouponService } from '../../../coupons/providers/coupon.service';
|
||||
import { CartRepository } from '../repositories/cart.repository';
|
||||
import { CartValidationService } from './cart-validation.service';
|
||||
import { CartCalculationService } from './cart-calculation.service';
|
||||
@@ -80,7 +80,7 @@ export class CartService {
|
||||
const address = await this.validationService.getUserAddressOrFail(addressId);
|
||||
this.validationService.validateAddressOwnership(address, userId);
|
||||
|
||||
// ensure address is within restaurant service area
|
||||
// ensure address is within shop service area
|
||||
await this.validationService.assertAddressInsideServiceArea(
|
||||
restaurantId,
|
||||
address.latitude,
|
||||
@@ -125,7 +125,7 @@ export class CartService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create cart for user and restaurant
|
||||
* Get or create cart for user and shop
|
||||
*/
|
||||
async getOrCreateCart(userId: string, restaurantId: string): Promise<Cart> {
|
||||
const existingCart = await this.cartRepository.findByUserAndRestaurant(userId, restaurantId);
|
||||
@@ -133,15 +133,15 @@ export class CartService {
|
||||
return existingCart;
|
||||
}
|
||||
|
||||
// Find restaurant
|
||||
const restaurant = await this.validationService.getRestaurantOrFail(restaurantId);
|
||||
// Find shop
|
||||
const shop = await this.validationService.getRestaurantOrFail(restaurantId);
|
||||
|
||||
// Create new cart
|
||||
const now = this.nowIso();
|
||||
const cart: Cart = {
|
||||
userId,
|
||||
restaurantId,
|
||||
restaurantName: restaurant.name,
|
||||
restaurantName: shop.name,
|
||||
items: [],
|
||||
deliveryFee: 0,
|
||||
subTotal: 0,
|
||||
@@ -160,7 +160,7 @@ export class CartService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find cart by user and restaurant
|
||||
* Find cart by user and shop
|
||||
*/
|
||||
async findOneOrFail(userId: string, restaurantId: string): Promise<Cart> {
|
||||
const cart = await this.cartRepository.findByUserAndRestaurant(userId, restaurantId);
|
||||
@@ -218,7 +218,7 @@ export class CartService {
|
||||
|
||||
const orderAmount = cart.subTotal - cart.itemsDiscount;
|
||||
const user = await this.validationService.getUserOrFail(userId);
|
||||
// check if coupon is valid and belong to the restaurant
|
||||
// check if coupon is valid and belong to the shop
|
||||
const { valid, coupon, message } = await this.couponService.validateCoupon(
|
||||
applyCouponDto.code,
|
||||
restaurantId,
|
||||
@@ -239,7 +239,7 @@ export class CartService {
|
||||
await this.validationService.assertCouponMatchesCartIfRestricted(
|
||||
cart,
|
||||
coupon.foodCategories,
|
||||
coupon.foods,
|
||||
coupon.products,
|
||||
);
|
||||
|
||||
const couponDetail: OrderCouponDetail = {
|
||||
@@ -291,7 +291,7 @@ export class CartService {
|
||||
// Verify address belongs to the user
|
||||
this.validationService.validateAddressOwnership(address, userId);
|
||||
|
||||
// ensure address is within restaurant service area
|
||||
// ensure address is within shop service area
|
||||
await this.validationService.assertAddressInsideServiceArea(
|
||||
restaurantId,
|
||||
address.latitude,
|
||||
|
||||
Reference in New Issue
Block a user