form builder module
This commit is contained in:
@@ -129,7 +129,7 @@ export class OrderController {
|
||||
@Post('admin/orders/:orderId/invoice')
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiOperation({ summary: 'Create Order invoice ' })
|
||||
createInvoice(@Param('orderId') orderId: string) {
|
||||
createInvoice(@Param('orderId') orderId: string, @Body() dto: UpdateOrderDtoAsAdmin) {
|
||||
return this.orderService.createInvoice(orderId);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,14 +74,14 @@ export class Order {
|
||||
|
||||
// @Property({ type: 'decimal', precision: 10, scale: 0, default: null, nullable: true })
|
||||
// subTotal?: number;
|
||||
@Formula(alias => `
|
||||
@Formula(alias => `
|
||||
(
|
||||
SELECT COALESCE(SUM(COALESCE(oi.unit_price, 0) * oi.quantity), 0)
|
||||
FROM order_items oi
|
||||
WHERE oi.order_id = ${alias}.id
|
||||
)
|
||||
`)
|
||||
subTotal!: number;
|
||||
subTotal!: number;
|
||||
|
||||
|
||||
// @Property({ type: 'decimal', precision: 10, scale: 0, default: null, nullable: true })
|
||||
@@ -202,7 +202,7 @@ subTotal!: number;
|
||||
attachments?: string[]
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
printIds?: string[] // id of field options
|
||||
print?: { fieldId: string, value: string }[] // id of field options
|
||||
|
||||
@Property({ type: 'string', nullable: true })
|
||||
paymentMethod?: string;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import { Product } from "src/modules/product/entities/product.entity"
|
||||
import { Order } from "../entities/order.entity"
|
||||
|
||||
export enum OrderStatusEnum {
|
||||
CREATED = 'created',
|
||||
|
||||
|
||||
@@ -285,10 +285,7 @@ export class OrderService {
|
||||
}
|
||||
|
||||
async createInvoice(orderId: string) {
|
||||
const order = await this.findOrderOrFail(orderId)
|
||||
await this.updateStatus(orderId, OrderStatusEnum.INVOICED)
|
||||
// await this.calculateOrder(order)
|
||||
await this.em.flush()
|
||||
}
|
||||
|
||||
async getOrderAsUser(userId: string, orderId: string) {
|
||||
|
||||
Reference in New Issue
Block a user