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:
@@ -1,5 +1,17 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI PocketBase Manage Hooks API - Cart
|
||||
version: 1.0.0
|
||||
description: |
|
||||
hooks 购物车接口文档。
|
||||
本文件可单独导入使用,不依赖其他 YAML。
|
||||
servers:
|
||||
- url: https://bai-api.blv-oa.com
|
||||
description: 生产环境
|
||||
- url: http://localhost:8090
|
||||
description: PocketBase 本地环境
|
||||
paths:
|
||||
cartList:
|
||||
/pb/api/cart/list:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 查询购物车列表
|
||||
@@ -31,7 +43,7 @@ paths:
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartDetail:
|
||||
/pb/api/cart/detail:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 查询购物车详情
|
||||
@@ -65,7 +77,7 @@ paths:
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartCreate:
|
||||
/pb/api/cart/create:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 新增购物车记录
|
||||
@@ -102,7 +114,7 @@ paths:
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartUpdate:
|
||||
/pb/api/cart/update:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 修改购物车记录
|
||||
@@ -144,7 +156,7 @@ paths:
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
cartDelete:
|
||||
/pb/api/cart/delete:
|
||||
post:
|
||||
tags: [购物车]
|
||||
summary: 删除购物车记录
|
||||
@@ -233,6 +245,9 @@ components:
|
||||
product_modelnumber:
|
||||
type: string
|
||||
description: 产品型号
|
||||
product_barcode:
|
||||
type: string
|
||||
description: 产品料号
|
||||
product_basic_price:
|
||||
type: [integer, number, 'null']
|
||||
description: 产品基础价格
|
||||
@@ -253,6 +268,7 @@ components:
|
||||
is_delete: 删除标记|integer
|
||||
product_name: 产品名称|string
|
||||
product_modelnumber: 产品型号|string
|
||||
product_barcode: 产品料号|string
|
||||
product_basic_price: 产品基础价格|integer
|
||||
CartListRequest:
|
||||
type: object
|
||||
@@ -360,6 +376,10 @@ components:
|
||||
cart_status: 购物车状态|string
|
||||
cart_at_price: 加入购物车时价格|integer
|
||||
cart_remark: 备注|string
|
||||
product_name: 产品名称|string
|
||||
product_modelnumber: 产品型号|string
|
||||
product_barcode: 产品料号|string
|
||||
product_basic_price: 产品基础价格|integer
|
||||
CartDeleteResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
Reference in New Issue
Block a user