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

File diff suppressed because it is too large Load Diff

View File

@@ -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:

View File

@@ -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

View File

@@ -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: 删除订单记录

View File

@@ -1,571 +0,0 @@
openapi: 3.1.0
info:
title: PocketBase MiniApp Company API
version: 1.0.0
summary: 小程序端通过 PocketBase JS SDK 直连 tbl_company 的基础 CRUD 文档
description: >-
本文档面向小程序端直接使用 PocketBase JS SDK / REST API 访问 `tbl_company`。
本文档统一以 PocketBase 原生记录主键 `id` 作为唯一识别键。
`company_id` 保留为普通业务字段,可用于展示、筛选和业务关联,但不再作为 CRUD 的唯一键。
当前线上 `tbl_company` 还包含 `company_owner_openid` 字段,用于保存公司所有者 openid并带普通索引。
同时新增了国家、省、市、区的名称与编码字段,便于前端直接按行政区划存取。
license:
name: Proprietary
identifier: LicenseRef-Proprietary
servers:
- url: https://bai-api.blv-oa.com/pb
description: 线上 PocketBase 服务
tags:
- name: Company
description: tbl_company 公司信息基础 CRUD
paths:
/api/collections/tbl_company/records:
get:
tags: [Company]
operationId: listCompanyRecords
summary: 查询公司列表
description: >-
使用 PocketBase 原生 records list/search 接口查询 `tbl_company`。
支持三种常见模式:
1. 全表查询:不传 `filter`
2. 精确查询:`filter=id="q1w2e3r4t5y6u7i"`
3. 模糊查询:`filter=(company_name~"华住" || company_usci~"9131" || company_entity~"张三")`
4. 按 `company_id` 查询单条:`filter=company_id="WX-COMPANY-10001"&perPage=1&page=1`。
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
- $ref: '#/components/parameters/Sort'
- $ref: '#/components/parameters/Filter'
- $ref: '#/components/parameters/Fields'
- $ref: '#/components/parameters/SkipTotal'
responses:
'200':
description: 查询成功
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyListResponse'
examples:
all:
summary: 全表查询
value:
page: 1
perPage: 30
totalItems: 2
totalPages: 1
items:
- id: q1w2e3r4t5y6u7i
collectionId: pbc_company_demo
collectionName: tbl_company
created: '2026-03-27 10:00:00.000Z'
updated: '2026-03-27 10:00:00.000Z'
company_id: C10001
company_name: 宝镜科技
company_type: 渠道商
company_entity: 张三
company_usci: '91310000123456789A'
company_nationality: 中国
company_nationality_code: CN
company_province: 上海
company_province_code: '310000'
company_city: 上海
company_city_code: '310100'
company_district: 浦东新区
company_district_code: '310115'
company_postalcode: '200000'
company_add: 上海市浦东新区XX路1号
company_status: 有效
company_level: A
company_owner_openid: wx-openid-owner-001
company_remark: ''
exact:
summary: 按 id 精确查询
value:
page: 1
perPage: 1
totalItems: 1
totalPages: 1
items:
- id: q1w2e3r4t5y6u7i
collectionId: pbc_company_demo
collectionName: tbl_company
created: '2026-03-27 10:00:00.000Z'
updated: '2026-03-27 10:00:00.000Z'
company_id: C10001
company_name: 宝镜科技
company_type: 渠道商
company_entity: 张三
company_usci: '91310000123456789A'
company_nationality: 中国
company_nationality_code: CN
company_province: 上海
company_province_code: '310000'
company_city: 上海
company_city_code: '310100'
company_district: 浦东新区
company_district_code: '310115'
company_postalcode: '200000'
company_add: 上海市浦东新区XX路1号
company_status: 有效
company_level: A
company_owner_openid: wx-openid-owner-001
company_remark: ''
'400':
description: 过滤表达式或查询参数不合法
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'403':
description: 当前调用方没有 list 权限
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
post:
tags: [Company]
operationId: createCompanyRecord
summary: 新增公司
description: >-
创建一条 `tbl_company` 记录。当前文档以 `id` 作为记录唯一识别键,
新建成功后由 PocketBase 自动生成 `id``company_id` 也由数据库自动生成,
客户端创建时不需要传入,但仍可作为后续业务查询字段。
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyCreateRequest'
examples:
default:
value:
company_name: 宝镜科技
company_type: 渠道商
company_entity: 张三
company_usci: '91310000123456789A'
company_nationality: 中国
company_nationality_code: CN
company_province: 上海
company_province_code: '310000'
company_city: 上海
company_city_code: '310100'
company_district: 浦东新区
company_district_code: '310115'
company_postalcode: '200000'
company_add: 上海市浦东新区XX路1号
company_status: 有效
company_level: A
company_owner_openid: wx-openid-owner-001
company_remark: 首次创建
responses:
'200':
description: 创建成功
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyRecord'
'400':
description: 校验失败,例如字段类型不合法或违反当前集合约束
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'403':
description: 当前调用方没有 create 权限
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'404':
description: 集合不存在
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
/api/collections/tbl_company/records/{recordId}:
get:
tags: [Company]
operationId: getCompanyRecordByRecordId
summary: 按 PocketBase 记录 id 查询公司
description: >-
这是 PocketBase 原生单条查询接口,路径参数必须传记录主键 `id`。
parameters:
- $ref: '#/components/parameters/RecordId'
- $ref: '#/components/parameters/Fields'
responses:
'200':
description: 查询成功
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyRecord'
'403':
description: 当前调用方没有 view 权限
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'404':
description: 记录不存在
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
patch:
tags: [Company]
operationId: updateCompanyRecordByRecordId
summary: 按 PocketBase 记录 id 更新公司
description: >-
这是 PocketBase 原生更新接口,路径参数统一使用记录主键 `id`。
如果业务侧只有 `company_id`,标准流程是先调用 list 接口
`filter=company_id="..."&perPage=1&page=1` 查出对应记录,再用返回的 `id` 调用本接口。
parameters:
- $ref: '#/components/parameters/RecordId'
- $ref: '#/components/parameters/Fields'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyUpdateRequest'
examples:
default:
value:
company_name: 宝镜科技(更新)
company_status: 有效
company_level: S
company_owner_openid: wx-openid-owner-002
company_remark: 已更新基础资料
responses:
'200':
description: 更新成功
content:
application/json:
schema:
$ref: '#/components/schemas/CompanyRecord'
'400':
description: 更新参数不合法
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'403':
description: 当前调用方没有 update 权限
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'404':
description: 记录不存在
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
delete:
tags: [Company]
operationId: deleteCompanyRecordByRecordId
summary: 按 PocketBase 记录 id 删除公司
description: >-
这是 PocketBase 原生删除接口,路径参数统一使用记录主键 `id`。
parameters:
- $ref: '#/components/parameters/RecordId'
responses:
'204':
description: 删除成功
'400':
description: 删除失败,例如仍被必填 relation 引用
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'403':
description: 当前调用方没有 delete 权限
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
'404':
description: 记录不存在
content:
application/json:
schema:
$ref: '#/components/schemas/PocketBaseError'
components:
parameters:
Page:
name: page
in: query
description: 页码,默认 1
schema:
type: integer
minimum: 1
default: 1
PerPage:
name: perPage
in: query
description: 每页返回条数,默认 30
schema:
type: integer
minimum: 1
default: 30
Sort:
name: sort
in: query
description: 排序字段,例如 `-created,+company_name`
schema:
type: string
Filter:
name: filter
in: query
description: >-
PocketBase 过滤表达式。
精确查询示例:`id="q1w2e3r4t5y6u7i"`
模糊查询示例:`(company_name~"宝镜" || company_usci~"9131" || company_entity~"张三")`
schema:
type: string
Fields:
name: fields
in: query
description: 逗号分隔的返回字段列表,例如 `id,company_id,company_name`
schema:
type: string
SkipTotal:
name: skipTotal
in: query
description: 是否跳过 totalItems/totalPages 统计
schema:
type: boolean
default: false
RecordId:
name: recordId
in: path
required: true
description: PocketBase 记录主键 id
schema:
type: string
schemas:
CompanyBase:
type: object
properties:
company_id:
type: string
description: 公司业务编号字段,不再作为 CRUD 唯一键
company_name:
type: string
description: 公司名称
company_type:
type: string
description: 公司类型
company_entity:
type: string
description: 公司法人
company_usci:
type: string
description: 统一社会信用代码
company_nationality:
type: string
description: 国家
company_nationality_code:
type: string
description: 国家编码
company_province:
type: string
description: 省份
company_province_code:
type: string
description: 省份编码
company_city:
type: string
description: 城市
company_city_code:
type: string
description: 城市编码
company_district:
type: string
description: 区/县
company_district_code:
type: string
description: 区/县编码
company_postalcode:
type: string
description: 邮编
company_add:
type: string
description: 地址
company_status:
type: string
description: 公司状态
company_level:
type: string
description: 公司等级
company_owner_openid:
type: string
description: 公司所有者 openid
company_remark:
type: string
description: 备注
CompanyCreateRequest:
type: object
description: 创建时不需要传 `company_id`,由数据库自动生成。
properties:
company_name:
description: "公司名称"
type: string
company_type:
description: "公司类型"
type: string
company_entity:
description: "公司法人"
type: string
company_usci:
description: "统一社会信用代码"
type: string
company_nationality:
description: "国家名称"
type: string
company_nationality_code:
description: "国家编码"
type: string
company_province:
description: "省份名称"
type: string
company_province_code:
description: "省份编码"
type: string
company_city:
description: "城市名称"
type: string
company_city_code:
description: "城市编码"
type: string
company_district:
description: "区 / 县名称"
type: string
company_district_code:
description: "区 / 县编码"
type: string
company_postalcode:
description: "邮编"
type: string
company_add:
description: "地址"
type: string
company_status:
description: "公司状态"
type: string
company_level:
description: "公司等级"
type: string
company_owner_openid:
description: "公司所有者 openid"
type: string
company_remark:
description: "备注"
type: string
additionalProperties: false
CompanyUpdateRequest:
type: object
description: >-
更新时可只传需要修改的字段;记录定位统一依赖路径参数 `id`。
properties:
company_id:
description: "所属公司业务 ID"
type: string
company_name:
description: "公司名称"
type: string
company_type:
description: "公司类型"
type: string
company_entity:
description: "公司法人"
type: string
company_usci:
description: "统一社会信用代码"
type: string
company_nationality:
description: "国家名称"
type: string
company_nationality_code:
description: "国家编码"
type: string
company_province:
description: "省份名称"
type: string
company_province_code:
description: "省份编码"
type: string
company_city:
description: "城市名称"
type: string
company_city_code:
description: "城市编码"
type: string
company_district:
description: "区 / 县名称"
type: string
company_district_code:
description: "区 / 县编码"
type: string
company_postalcode:
description: "邮编"
type: string
company_add:
description: "地址"
type: string
company_status:
description: "公司状态"
type: string
company_level:
description: "公司等级"
type: string
company_owner_openid:
description: "公司所有者 openid"
type: string
company_remark:
description: "备注"
type: string
CompanyRecord:
allOf:
- type: object
properties:
id:
type: string
description: PocketBase 记录主键 id
collectionId:
type: string
collectionName:
type: string
created:
description: "记录创建时间"
type: string
updated:
description: "记录更新时间"
type: string
- $ref: '#/components/schemas/CompanyBase'
CompanyListResponse:
type: object
properties:
page:
type: integer
perPage:
type: integer
totalItems:
type: integer
totalPages:
type: integer
items:
type: array
items:
$ref: '#/components/schemas/CompanyRecord'
PocketBaseError:
type: object
properties:
status:
type: integer
message:
type: string
data:
description: "业务响应数据"
type: object
additionalProperties: true

View File

@@ -1,44 +0,0 @@
openapi: 3.1.0
info:
title: BAI PocketBase Native API
version: 1.0.0-wx
description: |
顶层兼容入口。
当前原生 API 文档已整理到 `spec/openapi-wx/` 目录下;本文件保留为兼容总入口。
servers:
- url: https://bai-api.blv-oa.com
description: 生产环境
- url: http://127.0.0.1:8090
description: PocketBase 本地环境
tags:
- name: 企业信息
description: PocketBase 原生公司记录接口
- name: 附件信息
description: PocketBase 原生附件记录接口
- name: 产品信息
description: PocketBase 原生产品记录接口
- name: 文档信息
description: PocketBase 原生文档记录接口
- name: 购物车
description: PocketBase 原生购物车记录接口
- name: 订单
description: PocketBase 原生订单记录接口
paths:
/pb/api/collections/tbl_company/records:
$ref: './openapi-wx/company.yaml#/paths/companyRecords'
/pb/api/collections/tbl_company/records/{recordId}:
$ref: './openapi-wx/company.yaml#/paths/companyRecordById'
/pb/api/collections/tbl_attachments/records:
$ref: './openapi-wx/attachments.yaml#/paths/attachmentRecords'
/pb/api/collections/tbl_product_list/records:
$ref: './openapi-wx/products.yaml#/paths/productRecords'
/pb/api/collections/tbl_document/records:
$ref: './openapi-wx/documents.yaml#/paths/documentRecords'
/pb/api/collections/tbl_cart/records:
$ref: './openapi-wx/cart.yaml#/paths/cartRecords'
/pb/api/collections/tbl_cart/records/{recordId}:
$ref: './openapi-wx/cart.yaml#/paths/cartRecordById'
/pb/api/collections/tbl_order/records:
$ref: './openapi-wx/order.yaml#/paths/orderRecords'
/pb/api/collections/tbl_order/records/{recordId}:
$ref: './openapi-wx/order.yaml#/paths/orderRecordById'

View File

@@ -1,5 +1,17 @@
openapi: 3.1.0
info:
title: BAI PocketBase Native API - Attachments
version: 1.0.0
description: |
PocketBase 原生 `tbl_attachments` records API 文档。
本文件可单独导入使用,不依赖其他 YAML。
servers:
- url: https://bai-api.blv-oa.com
description: 生产环境
- url: http://localhost:8090
description: PocketBase 本地环境
paths:
attachmentRecords:
/pb/api/collections/tbl_attachments/records:
get:
operationId: getPocketBaseAttachmentRecords
tags:
@@ -38,7 +50,7 @@ paths:
- 不传该参数时,返回分页列表
schema:
type: string
example: attachments_id="ATT-1774599142438-8n1UcU"
example: 过滤表达式|string
- name: page
in: query
required: false
@@ -60,8 +72,6 @@ paths:
description: 查询成功
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseAttachmentListResponse
example:
page: page|integer
perPage: perPage|integer
@@ -85,8 +95,6 @@ paths:
description: 查询参数错误
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -97,7 +105,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -108,7 +116,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -240,8 +248,6 @@ components:
example: 总页数 | integer
items:
type: array
items:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseAttachmentRecord
example:
page: page|integer
perPage: perPage|integer

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,17 @@
openapi: 3.1.0
info:
title: BAI PocketBase Native API - Company
version: 1.0.0
description: |
PocketBase 原生 `tbl_company` records API 文档。
本文件可单独导入使用,不依赖其他 YAML。
servers:
- url: https://bai-api.blv-oa.com
description: 生产环境
- url: http://localhost:8090
description: PocketBase 本地环境
paths:
companyRecords:
/pb/api/collections/tbl_company/records:
post:
operationId: postPocketBaseCompanyRecord
tags:
@@ -21,7 +33,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyCreateRequest
$ref: #/components/schemas/PocketBaseCompanyCreateRequest
example:
company_name: 公司名称|string
company_type: 公司类型|string
@@ -47,7 +59,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyRecord
$ref: #/components/schemas/PocketBaseCompanyRecord
example:
id: PocketBase 记录主键|string
collectionId: collectionId|string
@@ -78,7 +90,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -89,7 +101,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -100,7 +112,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -142,7 +154,7 @@ paths:
- 查询整个列表时:不传该参数
schema:
type: string
example: company_id="WX-COMPANY-10001"
example: 过滤表达式|string
- name: page
in: query
required: false
@@ -165,7 +177,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyListResponse
$ref: #/components/schemas/PocketBaseCompanyListResponse
example:
page: page|integer
perPage: perPage|integer
@@ -201,7 +213,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -212,7 +224,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -223,13 +235,13 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
data:
业务响应数据字段|string: 业务响应数据值|string
companyRecordById:
/pb/api/collections/tbl_company/records/{recordId}:
patch:
operationId: patchPocketBaseCompanyRecordByRecordId
tags:
@@ -253,13 +265,13 @@ paths:
description: 通过 `company_id` 查询结果拿到的 PocketBase 记录主键 `id`
schema:
type: string
example: l2r3nq7rqhuob0h
example: PocketBase记录主键|string
requestBody:
required: true
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyUpdateRequest
$ref: #/components/schemas/PocketBaseCompanyUpdateRequest
example:
company_id: 所属公司业务 ID|string
company_name: 公司名称|string
@@ -286,7 +298,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyRecord
$ref: #/components/schemas/PocketBaseCompanyRecord
example:
id: PocketBase 记录主键|string
collectionId: collectionId|string
@@ -317,7 +329,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -328,7 +340,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -339,7 +351,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -350,7 +362,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -653,8 +665,8 @@ components:
company_remark: 备注|string
PocketBaseCompanyRecord:
allOf:
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseRecordBase
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyFields
- $ref: #/components/schemas/PocketBaseRecordBase
- $ref: #/components/schemas/PocketBaseCompanyFields
example:
id: PocketBase 记录主键|string
collectionId: collectionId|string
@@ -870,7 +882,7 @@ components:
items:
type: array
items:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseCompanyRecord
$ref: #/components/schemas/PocketBaseCompanyRecord
example:
page: page|integer
perPage: perPage|integer

View File

@@ -1,5 +1,17 @@
openapi: 3.1.0
info:
title: BAI PocketBase Native API - Documents
version: 1.0.0
description: |
PocketBase 原生 `tbl_document` records API 文档。
本文件可单独导入使用,不依赖其他 YAML。
servers:
- url: https://bai-api.blv-oa.com
description: 生产环境
- url: http://localhost:8090
description: PocketBase 本地环境
paths:
documentRecords:
/pb/api/collections/tbl_document/records:
get:
operationId: getPocketBaseDocumentRecords
tags:
@@ -57,7 +69,7 @@ paths:
- 例如:`document_type ~ "DICT-1774599144591-hAEFQj" && document_type ~ "@UT1"`
schema:
type: string
example: document_type ~ "DICT-1774599144591-hAEFQj" && document_type ~ "@UT1"
example: 过滤表达式|string
- name: page
in: query
required: false
@@ -84,14 +96,14 @@ paths:
- `-document_create`:按最新上传倒序返回
schema:
type: string
example: -document_create
example: 排序表达式|string
responses:
"200":
description: 查询成功
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseDocumentListResponse
$ref: #/components/schemas/PocketBaseDocumentListResponse
example:
page: page|integer
perPage: perPage|integer
@@ -135,7 +147,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -146,7 +158,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -157,7 +169,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -289,15 +301,15 @@ components:
document_share_count:
type: number
description: 分享次数
example: 0
example: 分享次数|number
document_download_count:
type: number
description: 下载次数
example: 0
example: 下载次数|number
document_favorite_count:
type: number
description: 收藏次数
example: 0
example: 收藏次数|number
document_embedding_status:
type: string
description: 文档嵌入状态
@@ -360,8 +372,8 @@ components:
document_remark: 备注|string
PocketBaseDocumentRecord:
allOf:
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseRecordBase
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseDocumentFields
- $ref: #/components/schemas/PocketBaseRecordBase
- $ref: #/components/schemas/PocketBaseDocumentFields
example:
id: PocketBase 记录主键|string
collectionId: collectionId|string
@@ -427,7 +439,7 @@ components:
items:
type: array
items:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseDocumentRecord
$ref: #/components/schemas/PocketBaseDocumentRecord
example:
page: page|integer
perPage: perPage|integer

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,17 @@
openapi: 3.1.0
info:
title: BAI PocketBase Native API - Products
version: 1.0.0
description: |
PocketBase 原生 `tbl_product_list` records API 文档。
本文件可单独导入使用,不依赖其他 YAML。
servers:
- url: https://bai-api.blv-oa.com
description: 生产环境
- url: http://localhost:8090
description: PocketBase 本地环境
paths:
productRecords:
/pb/api/collections/tbl_product_list/records:
get:
operationId: getPocketBaseProductListRecords
tags:
@@ -30,7 +42,7 @@ paths:
推荐写法:`prod_list_category="<产品分类>"`
schema:
type: string
example: prod_list_category="<产品分类>"
example: 过滤表达式|string
- name: page
in: query
required: false
@@ -57,14 +69,14 @@ paths:
- `prod_list_sort`:按分类排序值从小到大
schema:
type: string
example: prod_list_sort
example: 排序表达式|string
responses:
"200":
description: 查询成功
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseProductListListResponse
$ref: #/components/schemas/PocketBaseProductListListResponse
example:
page: page|integer
perPage: perPage|integer
@@ -79,6 +91,7 @@ paths:
prod_list_id: 产品列表业务 ID唯一标识|string
prod_list_name: 产品名称|string
prod_list_modelnumber: 产品型号|string
prod_list_barcode: 产品料号|string
prod_list_icon: 产品图标附件 ID保存 tbl_attachments.attachments_id|string
prod_list_description: 产品说明|string
prod_list_feature: 产品特色|string
@@ -103,7 +116,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -114,7 +127,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -125,7 +138,7 @@ paths:
content:
application/json:
schema:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseNativeError
$ref: #/components/schemas/PocketBaseNativeError
example:
code: 业务状态码|integer
message: message|string
@@ -202,6 +215,10 @@ components:
type: string
description: 产品型号
example: <产品型号>|<string>
prod_list_barcode:
type: string
description: 产品料号
example: <产品料号>|<string>
prod_list_icon:
type: string
description: 产品图标附件 ID保存 `tbl_attachments.attachments_id`
@@ -242,7 +259,7 @@ components:
- number
- integer
description: 排序值(同分类内按升序)
example: 10
example: 排序值|number
prod_list_comm_type:
type: string
description: 通讯类型
@@ -268,7 +285,7 @@ components:
- number
- integer
description: 基础价格
example: 1999
example: 基础价格|number
prod_list_vip_price:
type: array
description: 会员价数组,每项包含会员等级枚举值与价格
@@ -282,10 +299,10 @@ components:
type:
- number
- integer
example: 1899
example: 会员价格|number
example:
- viplevel: VIP1
price: 1899
- viplevel: 会员等级|string
price: 会员价格|number
prod_list_remark:
type: string
description: 备注
@@ -294,6 +311,7 @@ components:
prod_list_id: 产品列表业务 ID唯一标识|string
prod_list_name: 产品名称|string
prod_list_modelnumber: 产品型号|string
prod_list_barcode: 产品料号|string
prod_list_icon: 产品图标附件 ID保存 tbl_attachments.attachments_id|string
prod_list_description: 产品说明|string
prod_list_feature: 产品特色|string
@@ -315,8 +333,8 @@ components:
prod_list_remark: 备注|string
PocketBaseProductListRecord:
allOf:
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseRecordBase
- $ref: ../openapi-wx.yaml#/components/schemas/PocketBaseProductListFields
- $ref: #/components/schemas/PocketBaseRecordBase
- $ref: #/components/schemas/PocketBaseProductListFields
example:
id: PocketBase 记录主键|string
collectionId: collectionId|string
@@ -326,6 +344,7 @@ components:
prod_list_id: 产品列表业务 ID唯一标识|string
prod_list_name: 产品名称|string
prod_list_modelnumber: 产品型号|string
prod_list_barcode: 产品料号|string
prod_list_icon: 产品图标附件 ID保存 tbl_attachments.attachments_id|string
prod_list_description: 产品说明|string
prod_list_feature: 产品特色|string
@@ -377,7 +396,7 @@ components:
items:
type: array
items:
$ref: ../openapi-wx.yaml#/components/schemas/PocketBaseProductListRecord
$ref: #/components/schemas/PocketBaseProductListRecord
example:
page: page|integer
perPage: perPage|integer
@@ -392,6 +411,7 @@ components:
prod_list_id: 产品列表业务 ID唯一标识|string
prod_list_name: 产品名称|string
prod_list_modelnumber: 产品型号|string
prod_list_barcode: 产品料号|string
prod_list_icon: 产品图标附件 ID保存 tbl_attachments.attachments_id|string
prod_list_description: 产品说明|string
prod_list_feature: 产品特色|string

File diff suppressed because it is too large Load Diff