update entity id
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Entity, Property, ManyToOne, Index, Enum, PrimaryKey } from '@mikro-orm/core';
|
||||
import { Entity, Property, ManyToOne, Index, Enum, PrimaryKey, OptionalProps } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { User } from './user.entity';
|
||||
import { CreditTransactionType } from '../interface/user';
|
||||
@@ -6,8 +6,7 @@ import { CreditTransactionType } from '../interface/user';
|
||||
@Entity({ tableName: 'credit_transactions' })
|
||||
@Index({ properties: ['user'] })
|
||||
export class CreditTransaction extends BaseEntity {
|
||||
@PrimaryKey({ type: 'bigint', autoincrement: true })
|
||||
id: bigint
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||
|
||||
@ManyToOne(() => User)
|
||||
user!: User;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Entity, Index, Property, OneToMany, Collection, Cascade, PrimaryKey } from '@mikro-orm/core';
|
||||
import { Entity, Index, Property, OneToMany, Collection, Cascade, PrimaryKey, OptionalProps } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Order } from 'src/modules/order/entities/order.entity';
|
||||
import { normalizePhone } from '../../util/phone.util';
|
||||
@@ -6,11 +6,11 @@ import { ulid } from 'ulid';
|
||||
|
||||
@Entity({ tableName: 'users' })
|
||||
export class User extends BaseEntity {
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||
|
||||
@OneToMany(() => Order, order => order.user)
|
||||
orders = new Collection<Order>(this);
|
||||
|
||||
@PrimaryKey({ type: 'string', columnType: 'char(26)' })
|
||||
id: string = ulid();
|
||||
|
||||
@Property({ nullable: true })
|
||||
firstName?: string;
|
||||
|
||||
Reference in New Issue
Block a user