user address

This commit is contained in:
2025-11-23 00:35:20 +03:30
parent c8b0ee3c56
commit d9dde39a20
8 changed files with 215 additions and 51 deletions
@@ -0,0 +1,36 @@
import { Entity, Property, ManyToOne } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { User } from './user.entity';
@Entity({ tableName: 'user_addresses' })
export class UserAddress extends BaseEntity {
@ManyToOne(() => User)
user!: User;
@Property()
title!: string; // e.g., "Home", "Work", "Office"
@Property()
address!: string;
@Property()
city!: string;
@Property({ nullable: true })
province?: string;
@Property({ nullable: true })
postalCode?: string | null = null;
@Property({ type: 'float' })
latitude!: number;
@Property({ type: 'float' })
longitude!: number;
@Property({ nullable: true })
phone?: string; // Contact phone for this address
@Property({ default: false })
isDefault: boolean = false; // Whether this is the default address
}