Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion echo/directus/sync/snapshot/collections/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"collapse": "open",
"collection": "conversation",
"color": null,
"display_template": null,
"display_template": "{{participant_name}}.{{project_id.name}}",
"group": null,
"hidden": false,
"icon": null,
Expand Down
28 changes: 28 additions & 0 deletions echo/directus/sync/snapshot/collections/conversation_link.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"collection": "conversation_link",
"meta": {
"accountability": "all",
"archive_app_filter": true,
"archive_field": null,
"archive_value": null,
"collapse": "open",
"collection": "conversation_link",
"color": null,
"display_template": null,
"group": "conversation",
"hidden": true,
"icon": null,
"item_duplication_fields": null,
"note": null,
"preview_url": null,
"singleton": false,
"sort": 1,
"sort_field": null,
"translations": null,
"unarchive_value": null,
"versioning": false
},
"schema": {
"name": "conversation_link"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"note": null,
"preview_url": null,
"singleton": false,
"sort": 2,
"sort": 3,
"sort_field": null,
"translations": null,
"unarchive_value": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"note": null,
"preview_url": null,
"singleton": false,
"sort": 1,
"sort": 2,
"sort_field": "sort",
"translations": null,
"unarchive_value": "draft",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"collection": "conversation",
"field": "linked_conversations",
"type": "alias",
"meta": {
"collection": "conversation",
"conditions": null,
"display": null,
"display_options": null,
"field": "linked_conversations",
"group": null,
"hidden": false,
"interface": "list-o2m",
"note": null,
"options": {
"enableCreate": false,
"enableLink": true,
"enableSelect": false,
"template": "{{target_conversation_id.participant_name}}"
},
"readonly": false,
"required": false,
"sort": 23,
"special": [
"o2m"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"collection": "conversation",
"field": "linking_conversations",
"type": "alias",
"meta": {
"collection": "conversation",
"conditions": null,
"display": null,
"display_options": null,
"field": "linking_conversations",
"group": null,
"hidden": false,
"interface": "list-o2m",
"note": null,
"options": {
"enableCreate": false,
"enableLink": true,
"enableSelect": false
},
"readonly": false,
"required": false,
"sort": 24,
"special": [
"o2m"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
}
Comment on lines +1 to +30
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Alias field missing related_collection / related_field metadata?

Directus usually expects related_collection & related_field on alias O2M definitions so the UI knows which relation it fronts. If those live exclusively in the relation snapshots, you’re fine; otherwise add:

"meta": {
   ...
+  "related_collection": "conversation_link",
+  "related_field": "target_conversation_id",
   ...
}

Prevents the list-o2m picker from rendering an empty state.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"collection": "conversation",
"field": "linking_conversations",
"type": "alias",
"meta": {
"collection": "conversation",
"conditions": null,
"display": null,
"display_options": null,
"field": "linking_conversations",
"group": null,
"hidden": false,
"interface": "list-o2m",
"note": null,
"options": {
"enableCreate": false,
"enableLink": true,
"enableSelect": false
},
"readonly": false,
"required": false,
"sort": 24,
"special": [
"o2m"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
}
{
"collection": "conversation",
"field": "linking_conversations",
"type": "alias",
"meta": {
"collection": "conversation",
"conditions": null,
"display": null,
"display_options": null,
"field": "linking_conversations",
"group": null,
"hidden": false,
"interface": "list-o2m",
"note": null,
"options": {
"enableCreate": false,
"enableLink": true,
"enableSelect": false
},
"readonly": false,
"required": false,
"sort": 24,
"special": [
"o2m"
],
"related_collection": "conversation_link",
"related_field": "target_conversation_id",
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
}
}
🤖 Prompt for AI Agents
In echo/directus/sync/snapshot/fields/conversation/linking_conversations.json
lines 1 to 30, the alias field definition for "linking_conversations" is missing
the required metadata properties "related_collection" and "related_field". Add
these properties to the "meta" object with appropriate values pointing to the
related collection and field to ensure the list-o2m picker renders correctly and
does not show an empty state in the UI.

}
6 changes: 6 additions & 0 deletions echo/directus/sync/snapshot/fields/conversation/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@
"options": {
"choices": [
{
"icon": "upload",
"text": "DASHBOARD_UPLOAD",
"value": "DASHBOARD_UPLOAD"
},
{
"icon": "content_copy",
"text": "CLONE",
"value": "CLONE"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"collection": "conversation_link",
"field": "date_created",
"type": "timestamp",
"meta": {
"collection": "conversation_link",
"conditions": null,
"display": "datetime",
"display_options": {
"relative": true
},
"field": "date_created",
"group": null,
"hidden": true,
"interface": "datetime",
"note": null,
"options": null,
"readonly": true,
"required": false,
"sort": 3,
"special": [
"date-created"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "half"
},
"schema": {
"name": "date_created",
"table": "conversation_link",
"data_type": "timestamp with time zone",
"default_value": null,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": true,
"is_unique": false,
"is_indexed": false,
"is_primary_key": false,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": false,
"foreign_key_table": null,
"foreign_key_column": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"collection": "conversation_link",
"field": "date_updated",
"type": "timestamp",
"meta": {
"collection": "conversation_link",
"conditions": null,
"display": "datetime",
"display_options": {
"relative": true
},
"field": "date_updated",
"group": null,
"hidden": true,
"interface": "datetime",
"note": null,
"options": null,
"readonly": true,
"required": false,
"sort": 4,
"special": [
"date-updated"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "half"
},
"schema": {
"name": "date_updated",
"table": "conversation_link",
"data_type": "timestamp with time zone",
"default_value": null,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": true,
"is_unique": false,
"is_indexed": false,
"is_primary_key": false,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": false,
"foreign_key_table": null,
"foreign_key_column": null
}
}
43 changes: 43 additions & 0 deletions echo/directus/sync/snapshot/fields/conversation_link/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"collection": "conversation_link",
"field": "id",
"type": "bigInteger",
"meta": {
"collection": "conversation_link",
"conditions": null,
"display": null,
"display_options": null,
"field": "id",
"group": null,
"hidden": true,
"interface": "input",
"note": null,
"options": null,
"readonly": true,
"required": false,
"sort": 1,
"special": null,
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "id",
"table": "conversation_link",
"data_type": "bigint",
"default_value": "nextval('conversation_link_id_seq'::regclass)",
"max_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"is_nullable": false,
"is_unique": true,
"is_indexed": false,
"is_primary_key": true,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": true,
"foreign_key_table": null,
"foreign_key_column": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"collection": "conversation_link",
"field": "link_type",
"type": "string",
"meta": {
"collection": "conversation_link",
"conditions": null,
"display": null,
"display_options": null,
"field": "link_type",
"group": null,
"hidden": false,
"interface": "input",
"note": null,
"options": null,
"readonly": false,
"required": false,
"sort": 7,
"special": null,
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "link_type",
"table": "conversation_link",
"data_type": "character varying",
"default_value": null,
"max_length": 255,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": true,
"is_unique": false,
"is_indexed": false,
"is_primary_key": false,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": false,
"foreign_key_table": null,
"foreign_key_column": null
}
Comment on lines +1 to +42
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider tightening the contract on link_type.

If link_type is intended to hold a finite set of values ("CLONE", "FOLLOW-UP", "REFERENCE", …), declaring an enum via "validation": { "enum": [...] } (and optionally switching the interface to "select-dropdown") prevents typo-driven bugs and speeds up querying.

Bonus: add a lightweight index if you foresee filtering by link type in analytics.

🤖 Prompt for AI Agents
In echo/directus/sync/snapshot/fields/conversation_link/link_type.json lines 1
to 42, the link_type field currently allows any string, which risks typos and
inconsistent values. To fix this, define a validation enum listing all allowed
values like "CLONE", "FOLLOW-UP", and "REFERENCE" under the "validation" key.
Optionally, change the interface from "input" to "select-dropdown" to enforce
selection from these values. Additionally, consider adding an index on this
field in the schema if filtering by link_type is expected in queries or
analytics.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"collection": "conversation_link",
"field": "source_conversation_id",
"type": "uuid",
"meta": {
"collection": "conversation_link",
"conditions": null,
"display": null,
"display_options": null,
"field": "source_conversation_id",
"group": null,
"hidden": false,
"interface": "select-dropdown-m2o",
"note": null,
"options": {
"enableCreate": false,
"enableLink": true,
"template": "{{participant_name}}.{{project_id.name}}"
},
"readonly": false,
"required": false,
"sort": 5,
"special": [
"m2o"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "source_conversation_id",
"table": "conversation_link",
"data_type": "uuid",
"default_value": null,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": false,
"is_unique": false,
Comment on lines +21 to +40
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Hard-stop: UI says “optional”, DB says “NOT NULL”.

required: false (l.21) lets the API/UI send nulls, while is_nullable: false (l.39) guarantees an INSERT failure.
Pick one stance and stick to it.

Most teams make the FK non-nullable, so tighten the UI:

-    "required": false,
+    "required": true,

(or flip is_nullable to true if nulls are legit).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"required": false,
"sort": 5,
"special": [
"m2o"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "source_conversation_id",
"table": "conversation_link",
"data_type": "uuid",
"default_value": null,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": false,
"is_unique": false,
"required": true,
"sort": 5,
"special": [
"m2o"
],
"translations": null,
"validation": null,
"validation_message": null,
"width": "full"
},
"schema": {
"name": "source_conversation_id",
"table": "conversation_link",
"data_type": "uuid",
"default_value": null,
"max_length": null,
"numeric_precision": null,
"numeric_scale": null,
"is_nullable": false,
"is_unique": false,
🤖 Prompt for AI Agents
In
echo/directus/sync/snapshot/fields/conversation_link/source_conversation_id.json
between lines 21 and 40, there is a mismatch where "required" is false allowing
nulls in the UI/API, but "is_nullable" is false in the DB schema, causing insert
failures. To fix this, either set "required" to true to make the UI/API enforce
non-null values consistent with the DB, or if nulls are valid, change
"is_nullable" to true in the schema. Choose one consistent approach and update
both fields accordingly.

"is_indexed": true,
"is_primary_key": false,
"is_generated": false,
"generation_expression": null,
"has_auto_increment": false,
"foreign_key_table": "conversation",
"foreign_key_column": "id"
}
}
Loading