feat: 规范化PocketBase数据库文档与原生API访问
- 将数据库文档拆分为按collection命名的标准文件,统一格式 - 补充tbl_company、tbl_system_dict等表的原生访问规则 - 新增users_tag、document_create等字段 - 优化用户资料更新接口,支持非必填字段 - 添加公司原生API测试脚本 - 归档本次变更至OpenSpec
This commit is contained in:
@@ -13,6 +13,11 @@ const collections = [
|
||||
{
|
||||
name: 'tbl_system_dict',
|
||||
type: 'base',
|
||||
listRule: '',
|
||||
viewRule: '',
|
||||
createRule: '(@request.auth.users_idtype = "ManagePlatform" || @request.auth.usergroups_id = "ROLE-1774666070666-9dDrTB")',
|
||||
updateRule: '(@request.auth.users_idtype = "ManagePlatform" || @request.auth.usergroups_id = "ROLE-1774666070666-9dDrTB")',
|
||||
deleteRule: '(@request.auth.users_idtype = "ManagePlatform" || @request.auth.usergroups_id = "ROLE-1774666070666-9dDrTB")',
|
||||
fields: [
|
||||
{ name: 'system_dict_id', type: 'text', required: true },
|
||||
{ name: 'dict_name', type: 'text', required: true },
|
||||
@@ -33,23 +38,30 @@ const collections = [
|
||||
name: 'tbl_company',
|
||||
type: 'base',
|
||||
fields: [
|
||||
{ name: 'company_id', type: 'text', required: true },
|
||||
{ name: 'company_id', type: 'text', required: true, autogeneratePattern: 'WX-COMPANY-[0-9]{13}' },
|
||||
{ name: 'company_name', type: 'text' },
|
||||
{ name: 'company_type', type: 'text' },
|
||||
{ name: 'company_entity', type: 'text' },
|
||||
{ name: 'company_usci', type: 'text' },
|
||||
{ name: 'company_nationality', type: 'text' },
|
||||
{ name: 'company_nationality_code', type: 'text' },
|
||||
{ name: 'company_province', type: 'text' },
|
||||
{ name: 'company_province_code', type: 'text' },
|
||||
{ name: 'company_city', type: 'text' },
|
||||
{ name: 'company_city_code', type: 'text' },
|
||||
{ name: 'company_district', type: 'text' },
|
||||
{ name: 'company_district_code', type: 'text' },
|
||||
{ name: 'company_postalcode', type: 'text' },
|
||||
{ name: 'company_add', type: 'text' },
|
||||
{ name: 'company_status', type: 'text' },
|
||||
{ name: 'company_level', type: 'text' },
|
||||
{ name: 'company_owner_openid', type: 'text' },
|
||||
{ name: 'company_remark', type: 'text' }
|
||||
],
|
||||
indexes: [
|
||||
'CREATE UNIQUE INDEX idx_company_id ON tbl_company (company_id)',
|
||||
'CREATE INDEX idx_company_usci ON tbl_company (company_usci)'
|
||||
'CREATE INDEX idx_company_usci ON tbl_company (company_usci)',
|
||||
'CREATE INDEX idx_company_owner_openid ON tbl_company (company_owner_openid)'
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -122,6 +134,11 @@ async function createOrUpdateCollection(collectionData) {
|
||||
const payload = {
|
||||
name: collectionData.name,
|
||||
type: collectionData.type,
|
||||
listRule: collectionData.listRule,
|
||||
viewRule: collectionData.viewRule,
|
||||
createRule: collectionData.createRule,
|
||||
updateRule: collectionData.updateRule,
|
||||
deleteRule: collectionData.deleteRule,
|
||||
fields: collectionData.fields,
|
||||
indexes: collectionData.indexes
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user