ynput / ayon-backend

Server codebase with API access to AYON
Apache License 2.0
18 stars 14 forks source link

Activity feed: Comment entity suggestions #221

Closed martastain closed 1 month ago

martastain commented 1 month ago

Story

Auto-suggestions for entities in comments should be resolved server-side using a dedicated endpoint

Problems

Currently the frontend has to call various graphql queries, often nested to get a list of entities for autocompletion.

Proposal

REST endpoint [POST] /api/projects/{projectName}/suggest with the body

{
  "entityType": ""
  "entityId": ""
}

returning

{
    "tasks": [
        {
            "createdAt": "2024-04-17T13:13:16.202057+00:00",
            "id": "408bd0d2fcbc11ee9ea50242ac140004",
            "name": "matchmove",
            "parent": {
                "createdAt": "2024-04-17T13:13:16.201230+00:00",
                "folderType": "Shot",
                "id": "408bb084fcbc11ee9ea50242ac140004",
                "name": "sh030"
            },
            "relevance": 0.0,
            "taskType": "Matchmove",
            "thumbnailId": "ada3ff4c717a42b2bd21ed653955404e"
        }
    ],
    "users": [
        {
            "fullName": "Viviane Renard",
            "name": "demouser37",
            "relevance": 15.0
        },
        {
            "fullName": "Isabel García",
            "name": "demouser45",
            "relevance": 15.0
        }
    ],
    "versions": [
        {
            "createdAt": "2024-04-17T13:13:16.234911+00:00",
            "id": "4090d460fcbc11ee9ea50242ac140004",
            "parent": {
                "createdAt": "2024-04-17T13:13:16.233779+00:00",
                "id": "4090a8a0fcbc11ee9ea50242ac140004",
                "name": "animationChar2",
                "productType": "animation",
                "relevance": 0.0
            },
            "relevance": 0.0,
            "version": 1
        }
    ]

Response model covers common fields of folders, tasks and versions (more or less) and the list should be returned sorted by relevance. One request for all mentionable entities should be returned (apart from the users as they are already available in the frontend anyways)

Innders commented 1 month ago

Looks good. We will need a couple extra fields.

image

Innders commented 1 month ago

Here is what I show for each entity type.

Folders

Assignees: Every assignee in the project Versions: Disabled - what versions would you want to see on a folder? Tasks: Direct child tasks of the folder.

Tasks

Assignees: Every assignee in the project, sorted by assignees first. Versions: Every version linked to the task. Tasks: Direct sibling tasks to the task.

Versions

Assignees: Every assignee in the project, sorted by author first. Versions: Direct sibling versions to the version. Tasks: Direct sibling tasks to the parent task of the version.

Innders commented 1 month ago

In some ways I think assignees could have it's own endpoint as well.

The sorting of assignees right now is very dumb and usually A-Z.

For mentions it could be way smarter by first suggesting: