Updates to the documentation about the id_random legacy.
This commit is contained in:
@@ -68,6 +68,30 @@ Modify data in the system.
|
|||||||
* **Header:** `x-ae-ignore-extra-fields: true`
|
* **Header:** `x-ae-ignore-extra-fields: true`
|
||||||
* **Behavior:** When set to `true`, the backend will automatically strip any fields from the payload that are not defined in the object's model before attempting to save to the database.
|
* **Behavior:** When set to `true`, the backend will automatically strip any fields from the payload that are not defined in the object's model before attempting to save to the database.
|
||||||
|
|
||||||
|
### D. ID Fields in Responses (Vision ID Convention)
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **V3 responses always use random string IDs — never database integers.**
|
||||||
|
|
||||||
|
After a successful `POST` create or any `GET`, the response contains:
|
||||||
|
|
||||||
|
| Field | Type | Use |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| `{obj_type}_id` | `string` | **Primary public ID.** Use this for subsequent `PATCH` calls and UI routing. |
|
||||||
|
| `{obj_type}_id_random` | `string` | Legacy alias. Same value as `{obj_type}_id`. Present for backward compat only. |
|
||||||
|
|
||||||
|
**Example — create then immediately PATCH:**
|
||||||
|
```ts
|
||||||
|
const created = await postArchiveContent(archiveId, payload);
|
||||||
|
const newId = created.data.archive_content_id; // random string e.g. "xK9mP3qRtL2"
|
||||||
|
|
||||||
|
// Use it directly in the PATCH URL — no lookup needed
|
||||||
|
await patchArchiveContent(newId, { name: 'Updated Name' });
|
||||||
|
// PATCH /v3/crud/archive/{archive_id}/archive_content/{newId}
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note on `_id_random` suffix:** The `{obj_type}_id_random` field is a legacy artifact from the pre-Vision model. Once you confirm `{obj_type}_id` is a random string (length 11–22), you do not need `_id_random` as a fallback. New code should only read `{obj_type}_id`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 4. V3 Uniform Lookup System
|
## 4. V3 Uniform Lookup System
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import type { key_val } from '$lib/stores/ae_stores';
|
|||||||
*/
|
*/
|
||||||
export interface Archive {
|
export interface Archive {
|
||||||
id: string;
|
id: string;
|
||||||
// id_random: string;
|
// id_random: string; // NO LONGER USE "_random"
|
||||||
archive_id: string;
|
archive_id: string;
|
||||||
// archive_id_random: string;
|
// archive_id_random: string; // NO LONGER USE "_random"
|
||||||
|
|
||||||
code?: null | string;
|
code?: null | string;
|
||||||
|
|
||||||
account_id: string;
|
account_id: string;
|
||||||
// account_id_random: string;
|
// account_id_random: string; // NO LONGER USE "_random"
|
||||||
|
|
||||||
// archive_type: string;
|
// archive_type: string;
|
||||||
|
|
||||||
@@ -80,12 +80,12 @@ export interface Archive {
|
|||||||
*/
|
*/
|
||||||
export interface Archive_Content {
|
export interface Archive_Content {
|
||||||
id: string;
|
id: string;
|
||||||
// id_random: string;
|
// id_random: string; // NO LONGER USE "_random"
|
||||||
archive_content_id: string;
|
archive_content_id: string;
|
||||||
// archive_content_id_random: string;
|
// archive_content_id_random: string; // NO LONGER USE "_random"
|
||||||
|
|
||||||
archive_id: string;
|
archive_id: string;
|
||||||
// archive_id_random: string;
|
// archive_id_random: string; // NO LONGER USE "_random"
|
||||||
|
|
||||||
archive_content_type: string;
|
archive_content_type: string;
|
||||||
|
|
||||||
@@ -169,10 +169,6 @@ export class MySubClassedDexie extends Dexie {
|
|||||||
enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]`
|
enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]`
|
||||||
});
|
});
|
||||||
|
|
||||||
// file_path,
|
|
||||||
// filename, file_extension,
|
|
||||||
// original_datetime, original_timezone, original_location, original_url, original_url_text,
|
|
||||||
// enable_for_public,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user