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,
|
||||
latitude: address.latitude,
|
||||
longitude: address.longitude,
|
||||
city: address.city,
|
||||
province: address.province || '',
|
||||
postalCode: address.postalCode || undefined,
|
||||
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
||||
phone: address.user.phone,
|
||||
@@ -319,8 +317,6 @@ export class CartService {
|
||||
address: address.address,
|
||||
latitude: address.latitude,
|
||||
longitude: address.longitude,
|
||||
city: address.city,
|
||||
province: address.province || '',
|
||||
postalCode: address.postalCode || undefined,
|
||||
fullName: `${address.user.firstName || ''} ${address.user.lastName || ''}`.trim(),
|
||||
phone: address.user.phone,
|
||||
|
||||
@@ -4,8 +4,6 @@ export interface OrderUserAddress {
|
||||
address?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
city: string;
|
||||
province: string;
|
||||
postalCode?: string;
|
||||
fullName: string;
|
||||
phone: string;
|
||||
|
||||
@@ -473,8 +473,6 @@ console.log(cart);
|
||||
return {
|
||||
fullName: [user.firstName, user.lastName].filter(Boolean).join(' '),
|
||||
phone: address.phone || user.phone,
|
||||
city: address.city,
|
||||
province: address.province || '',
|
||||
address: address.address,
|
||||
postalCode: address.postalCode ?? undefined,
|
||||
latitude: address.latitude,
|
||||
|
||||
@@ -13,15 +13,6 @@ export class CreateUserAddressDto {
|
||||
@IsString()
|
||||
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' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -15,16 +15,6 @@ export class UpdateUserAddressDto {
|
||||
@IsString()
|
||||
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' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -14,12 +14,6 @@ export class UserAddress extends BaseEntity {
|
||||
@Property()
|
||||
address!: string;
|
||||
|
||||
@Property()
|
||||
city!: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
province?: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
postalCode?: string | null = null;
|
||||
|
||||
|
||||
@@ -310,8 +310,6 @@ export class UserService {
|
||||
user,
|
||||
title: dto.title,
|
||||
address: dto.address,
|
||||
city: dto.city,
|
||||
province: dto.province,
|
||||
postalCode: dto.postalCode,
|
||||
latitude: dto.latitude,
|
||||
longitude: dto.longitude,
|
||||
|
||||
@@ -2,8 +2,6 @@ export interface UserAddressData {
|
||||
userPhone: string;
|
||||
title: string;
|
||||
address: string;
|
||||
city: string;
|
||||
province?: string;
|
||||
postalCode?: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
@@ -16,8 +14,6 @@ export const userAddressesData: UserAddressData[] = [
|
||||
userPhone: '09362532122',
|
||||
title: 'خانه',
|
||||
address: 'خیابان ولیعصر، پلاک 123',
|
||||
city: 'تهران',
|
||||
province: 'تهران',
|
||||
postalCode: '1234567890',
|
||||
latitude: 35.6892,
|
||||
longitude: 51.389,
|
||||
@@ -28,8 +24,6 @@ export const userAddressesData: UserAddressData[] = [
|
||||
userPhone: '09185290775',
|
||||
title: 'خانه',
|
||||
address: 'خیابان انقلاب، پلاک 456',
|
||||
city: 'تهران',
|
||||
province: 'تهران',
|
||||
postalCode: '1234567891',
|
||||
latitude: 35.69,
|
||||
longitude: 51.39,
|
||||
@@ -40,8 +34,6 @@ export const userAddressesData: UserAddressData[] = [
|
||||
userPhone: '09129283395',
|
||||
title: 'خانه',
|
||||
address: 'خیابان آزادی، پلاک 789',
|
||||
city: 'تهران',
|
||||
province: 'تهران',
|
||||
postalCode: '1234567892',
|
||||
latitude: 35.691,
|
||||
longitude: 51.391,
|
||||
@@ -52,8 +44,6 @@ export const userAddressesData: UserAddressData[] = [
|
||||
userPhone: '09184317567',
|
||||
title: 'خانه',
|
||||
address: 'خیابان جمهوری، پلاک 321',
|
||||
city: 'تهران',
|
||||
province: 'تهران',
|
||||
postalCode: '1234567893',
|
||||
latitude: 35.692,
|
||||
longitude: 51.392,
|
||||
|
||||
@@ -60,8 +60,6 @@ export class UsersSeeder {
|
||||
user,
|
||||
title: addressData.title,
|
||||
address: addressData.address,
|
||||
city: addressData.city,
|
||||
province: addressData.province,
|
||||
postalCode: addressData.postalCode,
|
||||
latitude: addressData.latitude,
|
||||
longitude: addressData.longitude,
|
||||
|
||||
Reference in New Issue
Block a user