carAddress
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsNotEmpty, IsString, IsNumber, IsLatitude, IsLongitude } from 'class-validator';
|
import { IsNotEmpty, IsString } from 'class-validator';
|
||||||
|
|
||||||
export class SetCarDeliveryDto {
|
export class SetCarDeliveryDto {
|
||||||
@ApiProperty({ description: 'Car model', example: 'Toyota Camry' })
|
@ApiProperty({ description: 'Car model', example: 'Toyota Camry' })
|
||||||
@@ -16,26 +16,4 @@ export class SetCarDeliveryDto {
|
|||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
plateNumber!: string;
|
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 {
|
export interface CartItem {
|
||||||
foodId: string;
|
foodId: string;
|
||||||
@@ -29,27 +29,8 @@ export interface Cart {
|
|||||||
totalDiscount: number;
|
totalDiscount: number;
|
||||||
total: number;
|
total: number;
|
||||||
|
|
||||||
carAddress?: {
|
carAddress?: OrderCarAddress | null;
|
||||||
carModel: string;
|
userAddress?: OrderUserAddress | null;
|
||||||
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;
|
|
||||||
|
|
||||||
totalItems: number;
|
totalItems: number;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
|
|||||||
@@ -336,9 +336,11 @@ export class CartService {
|
|||||||
|
|
||||||
cart.userAddress = {
|
cart.userAddress = {
|
||||||
address: address.address,
|
address: address.address,
|
||||||
|
latitude: address.latitude,
|
||||||
|
longitude: address.longitude,
|
||||||
city: address.city,
|
city: address.city,
|
||||||
province: address.province || '',
|
province: address.province || '',
|
||||||
postalCode: address.postalCode || '',
|
postalCode: address.postalCode || undefined,
|
||||||
fullName: address.user.firstName + ' ' + address.user.lastName || '',
|
fullName: address.user.firstName + ' ' + address.user.lastName || '',
|
||||||
phone: address.user.phone,
|
phone: address.user.phone,
|
||||||
};
|
};
|
||||||
@@ -503,10 +505,6 @@ export class CartService {
|
|||||||
carModel: setCarDeliveryDto.carModel,
|
carModel: setCarDeliveryDto.carModel,
|
||||||
carColor: setCarDeliveryDto.carColor,
|
carColor: setCarDeliveryDto.carColor,
|
||||||
plateNumber: setCarDeliveryDto.plateNumber,
|
plateNumber: setCarDeliveryDto.plateNumber,
|
||||||
address: setCarDeliveryDto.address,
|
|
||||||
latitude: setCarDeliveryDto.latitude,
|
|
||||||
longitude: setCarDeliveryDto.longitude,
|
|
||||||
fullName: setCarDeliveryDto.fullName,
|
|
||||||
phone: user.phone,
|
phone: user.phone,
|
||||||
};
|
};
|
||||||
cart.updatedAt = new Date().toISOString();
|
cart.updatedAt = new Date().toISOString();
|
||||||
|
|||||||
@@ -15,10 +15,6 @@ export interface OrderCarAddress {
|
|||||||
carModel: string;
|
carModel: string;
|
||||||
carColor: string;
|
carColor: string;
|
||||||
plateNumber: string;
|
plateNumber: string;
|
||||||
address?: string;
|
|
||||||
latitude?: number;
|
|
||||||
longitude?: number;
|
|
||||||
fullName: string;
|
|
||||||
phone: string;
|
phone: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user