carAddress
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty, IsString, IsNumber, IsLatitude, IsLongitude } from 'class-validator';
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
|
||||
export class SetCarDeliveryDto {
|
||||
@ApiProperty({ description: 'Car model', example: 'Toyota Camry' })
|
||||
@@ -16,26 +16,4 @@ export class SetCarDeliveryDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
plateNumber!: string;
|
||||
|
||||
@ApiProperty({ description: 'Delivery address', example: '123 Main Street, City' })
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
address!: string;
|
||||
|
||||
@ApiProperty({ description: 'Latitude coordinate', example: 35.6892 })
|
||||
@IsNotEmpty()
|
||||
@IsNumber()
|
||||
@IsLatitude()
|
||||
latitude!: number;
|
||||
|
||||
@ApiProperty({ description: 'Longitude coordinate', example: 51.389 })
|
||||
@IsNotEmpty()
|
||||
@IsNumber()
|
||||
@IsLongitude()
|
||||
longitude!: number;
|
||||
|
||||
@ApiProperty({ description: 'Full name of the recipient', example: 'John Doe' })
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
fullName!: string;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OrderCouponDetail } from 'src/modules/orders/interface/order-status';
|
||||
import type { OrderCouponDetail, OrderUserAddress, OrderCarAddress } from 'src/modules/orders/interface/order-status';
|
||||
|
||||
export interface CartItem {
|
||||
foodId: string;
|
||||
@@ -29,27 +29,8 @@ export interface Cart {
|
||||
totalDiscount: number;
|
||||
total: number;
|
||||
|
||||
carAddress?: {
|
||||
carModel: string;
|
||||
carColor: string;
|
||||
plateNumber: string;
|
||||
address?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
fullName: string;
|
||||
phone: string;
|
||||
} | null;
|
||||
|
||||
userAddress?: {
|
||||
address?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
city: string;
|
||||
province: string;
|
||||
postalCode: string;
|
||||
fullName: string;
|
||||
phone: string;
|
||||
} | null;
|
||||
carAddress?: OrderCarAddress | null;
|
||||
userAddress?: OrderUserAddress | null;
|
||||
|
||||
totalItems: number;
|
||||
createdAt: string;
|
||||
|
||||
@@ -30,7 +30,7 @@ export class CartService {
|
||||
private readonly em: EntityManager,
|
||||
private readonly cacheService: CacheService,
|
||||
private readonly couponService: CouponService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Get or create cart for user and restaurant
|
||||
@@ -336,9 +336,11 @@ export class CartService {
|
||||
|
||||
cart.userAddress = {
|
||||
address: address.address,
|
||||
latitude: address.latitude,
|
||||
longitude: address.longitude,
|
||||
city: address.city,
|
||||
province: address.province || '',
|
||||
postalCode: address.postalCode || '',
|
||||
postalCode: address.postalCode || undefined,
|
||||
fullName: address.user.firstName + ' ' + address.user.lastName || '',
|
||||
phone: address.user.phone,
|
||||
};
|
||||
@@ -503,10 +505,6 @@ export class CartService {
|
||||
carModel: setCarDeliveryDto.carModel,
|
||||
carColor: setCarDeliveryDto.carColor,
|
||||
plateNumber: setCarDeliveryDto.plateNumber,
|
||||
address: setCarDeliveryDto.address,
|
||||
latitude: setCarDeliveryDto.latitude,
|
||||
longitude: setCarDeliveryDto.longitude,
|
||||
fullName: setCarDeliveryDto.fullName,
|
||||
phone: user.phone,
|
||||
};
|
||||
cart.updatedAt = new Date().toISOString();
|
||||
|
||||
@@ -15,10 +15,6 @@ export interface OrderCarAddress {
|
||||
carModel: string;
|
||||
carColor: string;
|
||||
plateNumber: string;
|
||||
address?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
fullName: string;
|
||||
phone: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user