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:
|
||||
|
||||
@@ -6,6 +6,8 @@ info:
|
||||
面向管理端与自定义 hooks 的接口文档。
|
||||
本目录仅收敛自定义 hooks API,不包含 PocketBase 原生 records API。
|
||||
|
||||
本文件为目录索引,支持单文件独立导入,不依赖其他 YAML。
|
||||
|
||||
文档约定:
|
||||
- 不单独配置鉴权组件;如接口需要登录,请直接在说明中关注 `Authorization: Bearer <token>`
|
||||
- 示例字段值统一使用 `<字段说明>|<类型>` 风格
|
||||
@@ -34,70 +36,8 @@ tags:
|
||||
description: hooks 购物车接口
|
||||
- name: 订单
|
||||
description: hooks 订单接口
|
||||
paths:
|
||||
/pb/api/system/test-helloworld:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1test-helloworld'
|
||||
/pb/api/system/health:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1health'
|
||||
/pb/api/system/users-count:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1system~1users-count'
|
||||
/pb/api/system/refresh-token:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1system~1refresh-token'
|
||||
/pb/api/wechat/login:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1wechat~1login'
|
||||
/pb/api/wechat/profile:
|
||||
$ref: '../openapi.yaml#/paths/~1pb~1api~1wechat~1profile'
|
||||
/pb/api/platform/register:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1platform~1register'
|
||||
/pb/api/platform/login:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1platform~1login'
|
||||
/pb/api/dictionary/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1list'
|
||||
/pb/api/dictionary/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1detail'
|
||||
/pb/api/dictionary/create:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1create'
|
||||
/pb/api/dictionary/update:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1update'
|
||||
/pb/api/dictionary/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1dictionary~1delete'
|
||||
/pb/api/attachment/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1list'
|
||||
/pb/api/attachment/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1detail'
|
||||
/pb/api/attachment/upload:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1upload'
|
||||
/pb/api/attachment/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1attachment~1delete'
|
||||
/pb/api/document/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1list'
|
||||
/pb/api/document/detail:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1detail'
|
||||
/pb/api/document/create:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1create'
|
||||
/pb/api/document/update:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1update'
|
||||
/pb/api/document/delete:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document~1delete'
|
||||
/pb/api/document-history/list:
|
||||
$ref: '../openapi-manage.yaml#/paths/~1pb~1api~1document-history~1list'
|
||||
/pb/api/cart/list:
|
||||
$ref: './cart.yaml#/paths/cartList'
|
||||
/pb/api/cart/detail:
|
||||
$ref: './cart.yaml#/paths/cartDetail'
|
||||
/pb/api/cart/create:
|
||||
$ref: './cart.yaml#/paths/cartCreate'
|
||||
/pb/api/cart/update:
|
||||
$ref: './cart.yaml#/paths/cartUpdate'
|
||||
/pb/api/cart/delete:
|
||||
$ref: './cart.yaml#/paths/cartDelete'
|
||||
/pb/api/order/list:
|
||||
$ref: './order.yaml#/paths/orderList'
|
||||
/pb/api/order/detail:
|
||||
$ref: './order.yaml#/paths/orderDetail'
|
||||
/pb/api/order/create:
|
||||
$ref: './order.yaml#/paths/orderCreate'
|
||||
/pb/api/order/update:
|
||||
$ref: './order.yaml#/paths/orderUpdate'
|
||||
/pb/api/order/delete:
|
||||
$ref: './order.yaml#/paths/orderDelete'
|
||||
paths: {}
|
||||
x-index:
|
||||
files:
|
||||
- cart.yaml
|
||||
- order.yaml
|
||||
@@ -1,5 +1,17 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: BAI PocketBase Manage Hooks API - Order
|
||||
version: 1.0.0
|
||||
description: |
|
||||
hooks 订单接口文档。
|
||||
本文件可单独导入使用,不依赖其他 YAML。
|
||||
servers:
|
||||
- url: https://bai-api.blv-oa.com
|
||||
description: 生产环境
|
||||
- url: http://localhost:8090
|
||||
description: PocketBase 本地环境
|
||||
paths:
|
||||
orderList:
|
||||
/pb/api/order/list:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 查询订单列表
|
||||
@@ -31,7 +43,7 @@ paths:
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderDetail:
|
||||
/pb/api/order/detail:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 查询订单详情
|
||||
@@ -65,7 +77,7 @@ paths:
|
||||
description: 请求体必须为 application/json
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderCreate:
|
||||
/pb/api/order/create:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 新增订单记录
|
||||
@@ -104,7 +116,7 @@ paths:
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderUpdate:
|
||||
/pb/api/order/update:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 修改订单记录
|
||||
@@ -148,7 +160,7 @@ paths:
|
||||
description: 重复请求过于频繁
|
||||
'500':
|
||||
description: 服务端错误
|
||||
orderDelete:
|
||||
/pb/api/order/delete:
|
||||
post:
|
||||
tags: [订单]
|
||||
summary: 删除订单记录
|
||||
|
||||
Reference in New Issue
Block a user