Skip to content

Commit dbc2048

Browse files
committed
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
1 parent 64e7520 commit dbc2048

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/content/docs/api-server/features/data-management-api.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ GET /api/v1/data?model=headline
2323
GET /api/v1/data/some-topic-id?model=topic
2424
```
2525

26-
### The Model Registry
26+
### The Dual Registry System
2727

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

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+
<Aside type="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>
3537

3638
### Supported Models
3739

@@ -52,5 +54,5 @@ The `country` and `language` models are configured to be **read-only** through t
5254
</Aside>
5355

5456
<Aside type="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.
5658
</Aside>

0 commit comments

Comments
 (0)