form builder module

This commit is contained in:
2026-01-28 14:59:25 +03:30
parent e44a239ef0
commit 8121b27248
27 changed files with 151 additions and 129 deletions
@@ -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);
}
+3 -3
View File
@@ -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) {