Skip to content

Made a taskwrapperview to be able to properly sort in the taskwrapper…#2034

Open
jessevz wants to merge 8 commits intodevfrom
fix-task-sorting-with-view
Open

Made a taskwrapperview to be able to properly sort in the taskwrapper…#2034
jessevz wants to merge 8 commits intodevfrom
fix-task-sorting-with-view

Conversation

@jessevz
Copy link
Copy Markdown
Contributor

@jessevz jessevz commented Apr 13, 2026

… overview

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated TaskWrapperDisplay database view + API model to provide a UI-friendly representation of task wrappers (including a computed displayName) so clients can sort/display wrappers consistently.

Changes:

  • Introduces TaskWrapperDisplay SQL views for both Postgres and MySQL.
  • Adds new DBA model/factory and API v2 endpoint (/api/v2/ui/taskwrapperdisplays) for read-only access.
  • Wires the new model into the API factory mapping and API v2 registration.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/migrations/postgres/20260413140000_task-view.sql Creates the Postgres TaskWrapperDisplay view with wrapper/task fields + displayName.
src/migrations/mysql/20260413140000_task-view.sql Creates the MySQL TaskWrapperDisplay view mirroring the Postgres definition.
src/inc/apiv2/model/TaskWrapperDisplayAPI.php New read-only API resource with ACL filtering based on hashlist access groups.
src/inc/apiv2/common/AbstractBaseAPI.php Maps TaskWrapperDisplay model class to its DBA factory for API operations.
src/dba/models/TaskWrapperDisplayFactory.php New factory to hydrate TaskWrapperDisplay objects from DB rows.
src/dba/models/TaskWrapperDisplay.php New DBA model describing the view’s fields and metadata.
src/dba/models/generator.php Registers TaskWrapperDisplay in the model generator configuration.
src/dba/Factory.php Adds TaskWrapperDisplayFactory singleton getter.
src/api/v2/index.php Registers TaskWrapperDisplayAPI routes with the v2 API app.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jessevz jessevz requested a review from s3inlc April 14, 2026 08:17
@jessevz jessevz marked this pull request as draft April 14, 2026 08:26
@jessevz jessevz marked this pull request as ready for review April 14, 2026 08:39
@jessevz jessevz requested a review from Copilot April 14, 2026 08:39
@jessevz jessevz marked this pull request as draft April 14, 2026 08:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cv5ch
Copy link
Copy Markdown

cv5ch commented Apr 14, 2026

We additionally need the following data in the frontend to be able to display all things we currently do. The taskwrapper endpoint did contain these, the new taskwrapperdisplay endpoint does not:

  • hashtype ("id" and "description")
  • hashlist ("id", "name", "hashcount", "cracked")
  • accessgroup ("id", "groupName")
  • tasks ("status")

The display endpoint contains hashlistId and accessgroupId, but hashtype is completely missing.

@jessevz
Copy link
Copy Markdown
Contributor Author

jessevz commented Apr 14, 2026

We additionally need the following data in the frontend to be able to display all things we currently do. The taskwrapper endpoint did contain these, the new taskwrapperdisplay endpoint does not:

  • hashtype ("id" and "description")
  • hashlist ("id", "name", "hashcount", "cracked")
  • accessgroup ("id", "groupName")

The display endpoint contains hashlistId and accessgroupId, but hashtype is completely missing.

Thanks for checking, I will add them

@cv5ch
Copy link
Copy Markdown

cv5ch commented Apr 14, 2026

*Edit: We need also the task.status of all tasks of the taskWrapper for the status calculation which currently is done in the frontend.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/inc/apiv2/model/TaskWrapperAPI.php:119

  • With the removal of parseFilters() (which previously forced a LEFT JOIN and constrained the Task join to taskType = NORMAL), any sorting/filtering on task.* via the task relationship in this endpoint will now use a default INNER join on Task.taskWrapperId. That can duplicate TaskWrapper rows when multiple tasks share a wrapper and also makes the singular task relationship ambiguous for SUPERTASK wrappers. If this endpoint is still expected to support sort=task.taskName / filters on task.*, the join needs an equivalent constraint; otherwise consider removing the to-one task relationship and using only tasks/the new TaskWrapperDisplay endpoint.
  /**
   * @throws HttpError
   */
  protected function createObject(array $data): int {
    throw new HttpError("TaskWrappers cannot be created via API");
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jessevz jessevz marked this pull request as ready for review April 15, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants