This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
|||||||
|
import { Migration } from '@mikro-orm/migrations';
|
||||||
|
|
||||||
|
export class Migration20260623120000_remove_city_province_from_user_addresses extends Migration {
|
||||||
|
|
||||||
|
override async up(): Promise<void> {
|
||||||
|
this.addSql(`alter table "user_addresses" drop column if exists "city";`);
|
||||||
|
this.addSql(`alter table "user_addresses" drop column if exists "province";`);
|
||||||
|
}
|
||||||
|
|
||||||
|
override async down(): Promise<void> {
|
||||||
|
this.addSql(`alter table "user_addresses" add column "city" varchar(255) not null default '';`);
|
||||||
|
this.addSql(`alter table "user_addresses" add column "province" varchar(255) null;`);
|
||||||
|
this.addSql(`alter table "user_addresses" alter column "city" drop default;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -91,8 +91,6 @@ export class CartService {
|
|||||||
address: address.address,
|
address: address.address,
|
||||||
latitude: address.latitude,
|
latitude: address.latitude,
|
||||||
longitude: address.longitude,
|
longitude: address.longitude,
|
||||||
city: address.city,
|
|
||||||
province: address.province || '',
|
|
||||||
postalCode: address.postalCode || undefined,
|
postalCode: address.postalCode || undefined,
|
||||||
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
||||||
phone: address.user.phone,
|
phone: address.user.phone,
|
||||||
@@ -319,8 +317,6 @@ export class CartService {
|
|||||||
address: address.address,
|
address: address.address,
|
||||||
latitude: address.latitude,
|
latitude: address.latitude,
|
||||||
longitude: address.longitude,
|
longitude: address.longitude,
|
||||||
city: address.city,
|
|
||||||
province: address.province || '',
|
|
||||||
postalCode: address.postalCode || undefined,
|
postalCode: address.postalCode || undefined,
|
||||||
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
||||||
phone: address.user.phone,
|
phone: address.user.phone,
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ export interface OrderUserAddress {
|
|||||||
address?: string;
|
address?: string;
|
||||||
latitude?: number;
|
latitude?: number;
|
||||||
longitude?: number;
|
longitude?: number;
|
||||||
city: string;
|
|
||||||
province: string;
|
|
||||||
postalCode?: string;
|
postalCode?: string;
|
||||||
fullName: string;
|
fullName: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
|
|||||||
@@ -473,8 +473,6 @@ console.log(cart);
|
|||||||
return {
|
return {
|
||||||
fullName: [user.firstName, user.lastName].filter(Boolean).join(' '),
|
fullName: [user.firstName, user.lastName].filter(Boolean).join(' '),
|
||||||
phone: address.phone || user.phone,
|
phone: address.phone || user.phone,
|
||||||
city: address.city,
|
|
||||||
province: address.province || '',
|
|
||||||
address: address.address,
|
address: address.address,
|
||||||
postalCode: address.postalCode ?? undefined,
|
postalCode: address.postalCode ?? undefined,
|
||||||
latitude: address.latitude,
|
latitude: address.latitude,
|
||||||
|
|||||||
@@ -13,15 +13,6 @@ export class CreateUserAddressDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
address!: string;
|
address!: string;
|
||||||
|
|
||||||
@ApiProperty({ description: 'City name', example: 'Tehran' })
|
|
||||||
@IsString()
|
|
||||||
city!: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'Province', example: 'Tehran Province' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
province?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'Postal/ZIP code', example: '12345-6789' })
|
@ApiPropertyOptional({ description: 'Postal/ZIP code', example: '12345-6789' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|||||||
@@ -15,16 +15,6 @@ export class UpdateUserAddressDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
address?: string;
|
address?: string;
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'City name', example: 'Tehran' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
city?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'Province', example: 'Tehran Province' })
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
province?: string;
|
|
||||||
|
|
||||||
@ApiPropertyOptional({ description: 'Postal/ZIP code', example: '12345-6789' })
|
@ApiPropertyOptional({ description: 'Postal/ZIP code', example: '12345-6789' })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ export class UserAddress extends BaseEntity {
|
|||||||
@Property()
|
@Property()
|
||||||
address!: string;
|
address!: string;
|
||||||
|
|
||||||
@Property()
|
|
||||||
city!: string;
|
|
||||||
|
|
||||||
@Property({ nullable: true })
|
|
||||||
province?: string;
|
|
||||||
|
|
||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
postalCode?: string | null = null;
|
postalCode?: string | null = null;
|
||||||
|
|
||||||
|
|||||||
@@ -310,8 +310,6 @@ export class UserService {
|
|||||||
user,
|
user,
|
||||||
title: dto.title,
|
title: dto.title,
|
||||||
address: dto.address,
|
address: dto.address,
|
||||||
city: dto.city,
|
|
||||||
province: dto.province,
|
|
||||||
postalCode: dto.postalCode,
|
postalCode: dto.postalCode,
|
||||||
latitude: dto.latitude,
|
latitude: dto.latitude,
|
||||||
longitude: dto.longitude,
|
longitude: dto.longitude,
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ export interface UserAddressData {
|
|||||||
userPhone: string;
|
userPhone: string;
|
||||||
title: string;
|
title: string;
|
||||||
address: string;
|
address: string;
|
||||||
city: string;
|
|
||||||
province?: string;
|
|
||||||
postalCode?: string;
|
postalCode?: string;
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
@@ -16,8 +14,6 @@ export const userAddressesData: UserAddressData[] = [
|
|||||||
userPhone: '09362532122',
|
userPhone: '09362532122',
|
||||||
title: 'خانه',
|
title: 'خانه',
|
||||||
address: 'خیابان ولیعصر، پلاک 123',
|
address: 'خیابان ولیعصر، پلاک 123',
|
||||||
city: 'تهران',
|
|
||||||
province: 'تهران',
|
|
||||||
postalCode: '1234567890',
|
postalCode: '1234567890',
|
||||||
latitude: 35.6892,
|
latitude: 35.6892,
|
||||||
longitude: 51.389,
|
longitude: 51.389,
|
||||||
@@ -28,8 +24,6 @@ export const userAddressesData: UserAddressData[] = [
|
|||||||
userPhone: '09185290775',
|
userPhone: '09185290775',
|
||||||
title: 'خانه',
|
title: 'خانه',
|
||||||
address: 'خیابان انقلاب، پلاک 456',
|
address: 'خیابان انقلاب، پلاک 456',
|
||||||
city: 'تهران',
|
|
||||||
province: 'تهران',
|
|
||||||
postalCode: '1234567891',
|
postalCode: '1234567891',
|
||||||
latitude: 35.69,
|
latitude: 35.69,
|
||||||
longitude: 51.39,
|
longitude: 51.39,
|
||||||
@@ -40,8 +34,6 @@ export const userAddressesData: UserAddressData[] = [
|
|||||||
userPhone: '09129283395',
|
userPhone: '09129283395',
|
||||||
title: 'خانه',
|
title: 'خانه',
|
||||||
address: 'خیابان آزادی، پلاک 789',
|
address: 'خیابان آزادی، پلاک 789',
|
||||||
city: 'تهران',
|
|
||||||
province: 'تهران',
|
|
||||||
postalCode: '1234567892',
|
postalCode: '1234567892',
|
||||||
latitude: 35.691,
|
latitude: 35.691,
|
||||||
longitude: 51.391,
|
longitude: 51.391,
|
||||||
@@ -52,8 +44,6 @@ export const userAddressesData: UserAddressData[] = [
|
|||||||
userPhone: '09184317567',
|
userPhone: '09184317567',
|
||||||
title: 'خانه',
|
title: 'خانه',
|
||||||
address: 'خیابان جمهوری، پلاک 321',
|
address: 'خیابان جمهوری، پلاک 321',
|
||||||
city: 'تهران',
|
|
||||||
province: 'تهران',
|
|
||||||
postalCode: '1234567893',
|
postalCode: '1234567893',
|
||||||
latitude: 35.692,
|
latitude: 35.692,
|
||||||
longitude: 51.392,
|
longitude: 51.392,
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ export class UsersSeeder {
|
|||||||
user,
|
user,
|
||||||
title: addressData.title,
|
title: addressData.title,
|
||||||
address: addressData.address,
|
address: addressData.address,
|
||||||
city: addressData.city,
|
|
||||||
province: addressData.province,
|
|
||||||
postalCode: addressData.postalCode,
|
postalCode: addressData.postalCode,
|
||||||
latitude: addressData.latitude,
|
latitude: addressData.latitude,
|
||||||
longitude: addressData.longitude,
|
longitude: addressData.longitude,
|
||||||
|
|||||||
Reference in New Issue
Block a user