feat: 添加购物车相关迁移和索引功能

- 在 package.json 中添加迁移脚本 `migrate:cart-active-unique-index`。
- 修改 `pocketbase.cart-order.js` 文件,更新 `cart_id` 和 `cart_product_id` 字段的必填属性,并添加唯一索引 `idx_tbl_cart_owner_product_active_unique`。
- 在 `pocketbase.ensure-cart-order-autogen-id.js` 中,调整 `cart_id` 字段的必填属性为可选,并确保 `order_id` 字段为必填。
- 在 `pocketbase.product-list.js` 中,新增 `prod_list_barcode` 字段。
- 新增 `make-openapi-standalone.cjs` 脚本,用于处理 OpenAPI 文档。
- 新增 `pocketbase.cart-active-unique-index.js` 脚本,处理购物车的唯一索引和去重逻辑。
This commit is contained in:
2026-04-09 14:49:12 +08:00
parent 0bdaf54eed
commit ec6b59b4fa
29 changed files with 1240 additions and 6449 deletions

View File

@@ -5,6 +5,8 @@ info:
description: |
本目录仅收敛 PocketBase 原生 API 文档,不包含自定义 hooks API。
本文件为目录索引,支持单文件独立导入,不依赖其他 YAML。
文档约定:
- 不单独配置鉴权组件;如接口需要登录,请直接在说明中关注 `Authorization: Bearer <token>`
- 示例字段值统一使用 `<字段说明>|<类型>` 风格
@@ -27,22 +29,12 @@ tags:
description: PocketBase 原生购物车记录接口
- name: 订单
description: PocketBase 原生订单记录接口
paths:
/pb/api/collections/tbl_company/records:
$ref: './company.yaml#/paths/companyRecords'
/pb/api/collections/tbl_company/records/{recordId}:
$ref: './company.yaml#/paths/companyRecordById'
/pb/api/collections/tbl_attachments/records:
$ref: './attachments.yaml#/paths/attachmentRecords'
/pb/api/collections/tbl_product_list/records:
$ref: './products.yaml#/paths/productRecords'
/pb/api/collections/tbl_document/records:
$ref: './documents.yaml#/paths/documentRecords'
/pb/api/collections/tbl_cart/records:
$ref: './cart.yaml#/paths/cartRecords'
/pb/api/collections/tbl_cart/records/{recordId}:
$ref: './cart.yaml#/paths/cartRecordById'
/pb/api/collections/tbl_order/records:
$ref: './order.yaml#/paths/orderRecords'
/pb/api/collections/tbl_order/records/{recordId}:
$ref: './order.yaml#/paths/orderRecordById'
paths: {}
x-index:
files:
- company.yaml
- attachments.yaml
- products.yaml
- documents.yaml
- cart.yaml
- order.yaml