feat: 添加系统刷新令牌请求和用户统计响应的 OpenAPI 规范
feat: 添加微信认证相关的 OpenAPI 规范,包括用户信息、登录请求和个人资料请求 feat: 添加 is_delete 字段迁移脚本,支持在集合中添加软删除字段 feat: 添加软删除规则应用脚本,确保所有相关集合的查询规则包含软删除条件 feat: 添加购物车和订单业务 ID 自动生成的迁移脚本,确保字段类型和自动生成规则正确
This commit is contained in:
@@ -15,6 +15,7 @@ const AUTH_TOKEN = process.env.POCKETBASE_AUTH_TOKEN || runtimeConfig.POCKETBASE
|
||||
const OWNER_AUTH_RULE = '@request.auth.id != ""';
|
||||
const CART_OWNER_MATCH_RULE = 'cart_owner = @request.auth.openid';
|
||||
const ORDER_OWNER_MATCH_RULE = 'order_owner = @request.auth.openid';
|
||||
const SOFT_DELETE_RULE = 'is_delete = 0';
|
||||
|
||||
if (!AUTH_TOKEN) {
|
||||
console.error('❌ 缺少 POCKETBASE_AUTH_TOKEN,无法执行建表。');
|
||||
@@ -27,13 +28,13 @@ const collections = [
|
||||
{
|
||||
name: 'tbl_cart',
|
||||
type: 'base',
|
||||
listRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE}`,
|
||||
viewRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE}`,
|
||||
listRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE} && ${SOFT_DELETE_RULE}`,
|
||||
viewRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE} && ${SOFT_DELETE_RULE}`,
|
||||
createRule: `${OWNER_AUTH_RULE} && @request.body.cart_owner = @request.auth.openid`,
|
||||
updateRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE}`,
|
||||
deleteRule: `${OWNER_AUTH_RULE} && ${CART_OWNER_MATCH_RULE}`,
|
||||
fields: [
|
||||
{ name: 'cart_id', type: 'text', required: true },
|
||||
{ name: 'cart_id', type: 'text', required: true, autogeneratePattern: 'CART-[0-9]{13}-[A-Za-z0-9]{6}' },
|
||||
{ name: 'cart_number', type: 'text', required: true },
|
||||
{ name: 'cart_create', type: 'autodate', onCreate: true, onUpdate: false },
|
||||
{ name: 'cart_owner', type: 'text', required: true },
|
||||
@@ -42,6 +43,7 @@ const collections = [
|
||||
{ name: 'cart_status', type: 'text', required: true },
|
||||
{ name: 'cart_at_price', type: 'number', required: true },
|
||||
{ name: 'cart_remark', type: 'text' },
|
||||
{ name: 'is_delete', type: 'number', default: 0, min: 0, max: 1, onlyInt: true },
|
||||
],
|
||||
indexes: [
|
||||
'CREATE UNIQUE INDEX idx_tbl_cart_cart_id ON tbl_cart (cart_id)',
|
||||
@@ -57,13 +59,13 @@ const collections = [
|
||||
{
|
||||
name: 'tbl_order',
|
||||
type: 'base',
|
||||
listRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE}`,
|
||||
viewRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE}`,
|
||||
listRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE} && ${SOFT_DELETE_RULE}`,
|
||||
viewRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE} && ${SOFT_DELETE_RULE}`,
|
||||
createRule: `${OWNER_AUTH_RULE} && @request.body.order_owner = @request.auth.openid`,
|
||||
updateRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE}`,
|
||||
deleteRule: `${OWNER_AUTH_RULE} && ${ORDER_OWNER_MATCH_RULE}`,
|
||||
fields: [
|
||||
{ name: 'order_id', type: 'text', required: true },
|
||||
{ name: 'order_id', type: 'text', required: true, autogeneratePattern: 'ORDER-[0-9]{13}-[A-Za-z0-9]{6}' },
|
||||
{ name: 'order_number', type: 'text', required: true },
|
||||
{ name: 'order_create', type: 'autodate', onCreate: true, onUpdate: false },
|
||||
{ name: 'order_owner', type: 'text', required: true },
|
||||
@@ -73,6 +75,7 @@ const collections = [
|
||||
{ name: 'order_snap', type: 'json', required: true },
|
||||
{ name: 'order_amount', type: 'number', required: true },
|
||||
{ name: 'order_remark', type: 'text' },
|
||||
{ name: 'is_delete', type: 'number', default: 0, min: 0, max: 1, onlyInt: true },
|
||||
],
|
||||
indexes: [
|
||||
'CREATE UNIQUE INDEX idx_tbl_order_order_id ON tbl_order (order_id)',
|
||||
|
||||
Reference in New Issue
Block a user