feat: 规范化PocketBase数据库文档与原生API访问

- 将数据库文档拆分为按collection命名的标准文件,统一格式
- 补充tbl_company、tbl_system_dict等表的原生访问规则
- 新增users_tag、document_create等字段
- 优化用户资料更新接口,支持非必填字段
- 添加公司原生API测试脚本
- 归档本次变更至OpenSpec
This commit is contained in:
2026-03-29 16:21:34 +08:00
parent 51a90260e4
commit e9fe1165e3
46 changed files with 3790 additions and 1108 deletions

View File

@@ -0,0 +1,38 @@
# pocketbase-native-data-access Specification
## Purpose
TBD - created by archiving change normalize-pocketbase-schema-docs. Update Purpose after archive.
## Requirements
### Requirement: PocketBase native company access SHALL expose a stable public create and query boundary
The system SHALL allow native PocketBase clients to create company records publicly and to query company records through standard PocketBase records APIs, while privileged mutations remain restricted to management users.
#### Scenario: Public client creates company record
- **WHEN** a client calls the native PocketBase create-record API for `tbl_company`
- **THEN** the request SHALL succeed without requiring a management token
#### Scenario: Public client queries company list
- **WHEN** a client calls the native PocketBase list-records API for `tbl_company`
- **THEN** the request SHALL return company records using standard PocketBase pagination parameters
#### Scenario: Management user updates company record
- **WHEN** a client attempts to update or delete `tbl_company`
- **THEN** PocketBase SHALL allow the operation only for management users or administrators
### Requirement: Public dictionary and document reads SHALL be supported through native PocketBase APIs
The system SHALL allow native PocketBase clients to read `tbl_system_dict` and `tbl_document` records without requiring application hooks tokens, while write operations remain restricted.
#### Scenario: Public client reads dictionary records
- **WHEN** a client calls the native PocketBase records API for `tbl_system_dict`
- **THEN** list and view operations SHALL be readable without authentication
#### Scenario: Public client reads document records
- **WHEN** a client calls the native PocketBase records API for `tbl_document`
- **THEN** list and view operations SHALL be readable without authentication

View File

@@ -0,0 +1,33 @@
# pocketbase-schema-docs Specification
## Purpose
TBD - created by archiving change normalize-pocketbase-schema-docs. Update Purpose after archive.
## Requirements
### Requirement: Database structure docs SHALL be maintained per PocketBase collection
The project SHALL document PocketBase schema structures in per-collection markdown files under `docs/`, and each file SHALL use the collection name in the filename.
#### Scenario: Collection doc is named by collection
- **WHEN** a PocketBase collection has a dedicated schema document
- **THEN** the document filename SHALL follow the `pb_tbl_xxx.md` naming convention
#### Scenario: Mixed schema docs are replaced
- **WHEN** older documents combine multiple unrelated collection structures in one file
- **THEN** the project SHALL replace them with per-collection docs to avoid conflicting schema descriptions
### Requirement: Database structure docs SHALL use a uniform format
Each PocketBase schema document SHALL use the same section structure so readers can quickly compare tables and verify field and index changes.
#### Scenario: Reader opens a schema document
- **WHEN** a reader opens any database structure document under `docs/`
- **THEN** the document SHALL include source, collection type, access rule summary, purpose, field table, index table, and supplementary notes
#### Scenario: Schema docs reflect live collection state
- **WHEN** the project documents a collection structure
- **THEN** the field list and rule summary SHALL be aligned with the current live PocketBase collection state whenever practical