You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(api-server): update data management API explanation
- Rename "Model Registry" to "Dual Registry System"
- Introduce DataOperationRegistry for CRUD actions
- Refactor explanation of ModelRegistry's functions
- Update terminology from ModelConfig to ModelRegistry
- Add link to Architectural Deep Dive guide
Copy file name to clipboardExpand all lines: src/content/docs/api-server/features/data-management-api.mdx
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,15 +23,17 @@ GET /api/v1/data?model=headline
23
23
GET /api/v1/data/some-topic-id?model=topic
24
24
```
25
25
26
-
### The Model Registry
26
+
### The Dual Registry System
27
27
28
-
The magic behind this generic endpoint is the **Model Registry** (`model_registry.dart`). This is a central map that links the string name of a model (e.g., `"headline"`) to a configuration object (`ModelConfig`).
28
+
The power behind this generic endpoint comes from two central registries:
29
29
30
-
Each `ModelConfig` contains all the information the generic endpoint needs to handle a specific model, including:
31
-
-**Deserialization:** A function to convert incoming JSON into the correct Dart object.
32
-
-**ID Extraction:** A function to get the unique ID from a model instance.
33
-
-**Ownership Information:** A function to identify the owner of a user-specific item (like `user_app_settings`).
34
-
-**Authorization Rules:** A detailed permission configuration for every HTTP method (GET, POST, PUT, DELETE), specifying who is allowed to perform each action.
30
+
1.**The Model Registry (`ModelRegistry`)**: This registry defines the **rules** for each model. It maps a model name (e.g., `"headline"`) to a configuration object that specifies authorization requirements, ownership details, and how to handle JSON data for that model.
31
+
32
+
2.**The Data Operation Registry (`DataOperationRegistry`)**: This registry provides the **actions**. It maps a model name to the actual functions that perform the CRUD operations (Create, Read, Update, Delete).
33
+
34
+
<Asidetype="tip">
35
+
For a detailed technical explanation of how these registries and the middleware work together, see the [**Architectural Deep Dive: Data Access Flow**](../architecture/data-access-flow) guide.
36
+
</Aside>
35
37
36
38
### Supported Models
37
39
@@ -52,5 +54,5 @@ The `country` and `language` models are configured to be **read-only** through t
52
54
</Aside>
53
55
54
56
<Asidetype="note">
55
-
Some actions are intentionally unsupported through this generic endpoint for security or logical reasons. For example, creating a new user is handled exclusively by the dedicated `/api/v1/auth/verify-code` endpoint, not by a POST request to `?model=user`. These restrictions are defined in the `ModelConfig` for each model.
57
+
Some actions are intentionally unsupported through this generic endpoint for security or logical reasons. For example, creating a new user is handled exclusively by the dedicated `/api/v1/auth/verify-code` endpoint, not by a POST request to `?model=user`. These restrictions are defined in the `ModelRegistry` for each model.
0 commit comments