user address
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user