update user entity
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
import { Entity, Property, OneToMany, Collection, Cascade } from '@mikro-orm/core';
|
import { Entity, Property, OneToMany, Collection, Cascade } from '@mikro-orm/core';
|
||||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||||
import { UserAddress } from './user-address.entity';
|
import { UserAddress } from './user-address.entity';
|
||||||
|
import { Order } from 'src/modules/orders/entities/order.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'users' })
|
@Entity({ tableName: 'users' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
@OneToMany(() => Order, order => order.user)
|
||||||
|
orders = new Collection<Order>(this);
|
||||||
|
|
||||||
@Property()
|
@Property()
|
||||||
firstName!: string;
|
firstName!: string;
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,13 @@ export class UserService {
|
|||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
|
|
||||||
// 2. Build the 'where' filter query
|
// 2. Build the 'where' filter query
|
||||||
const where: FilterQuery<User> = {};
|
const where: FilterQuery<User> = {
|
||||||
|
orders: {
|
||||||
|
restaurant: {
|
||||||
|
id: restId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// 4. Add 'search' logic (case-insensitive)
|
// 4. Add 'search' logic (case-insensitive)
|
||||||
if (search) {
|
if (search) {
|
||||||
|
|||||||
Reference in New Issue
Block a user