|
|
@ -4,6 +4,7 @@ import { Order } from './entities/order.entity'; |
|
|
|
import { ORDER_REPOSITORY } from 'src/core/constants'; |
|
|
|
import { ORDER_REPOSITORY } from 'src/core/constants'; |
|
|
|
import { OrderStatuses } from './entities/order-status.entity'; |
|
|
|
import { OrderStatuses } from './entities/order-status.entity'; |
|
|
|
import { User } from '../users/entities/user.entity'; |
|
|
|
import { User } from '../users/entities/user.entity'; |
|
|
|
|
|
|
|
import { UUID } from 'crypto'; |
|
|
|
|
|
|
|
|
|
|
|
@Injectable() |
|
|
|
@Injectable() |
|
|
|
export class OrdersService { |
|
|
|
export class OrdersService { |
|
|
@ -30,6 +31,16 @@ export class OrdersService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async findByUser(id: UUID) { |
|
|
|
|
|
|
|
return await this.orderRepository.findAll({ |
|
|
|
|
|
|
|
include: { |
|
|
|
|
|
|
|
model: User, |
|
|
|
|
|
|
|
where: { uuid: id }, |
|
|
|
|
|
|
|
attributes: ['firstName', 'lastName'], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async update(id: number, updateOrderDto: UpdateOrderDto) { |
|
|
|
async update(id: number, updateOrderDto: UpdateOrderDto) { |
|
|
|
const [numberOfAffectedRows, [updatedOrder]] = |
|
|
|
const [numberOfAffectedRows, [updatedOrder]] = |
|
|
|
await this.orderRepository.update( |
|
|
|
await this.orderRepository.update( |
|
|
|