Add GraphQL for WorkItems::UserPreference
What does this MR do and why?
Create work_item_user_preferences table
With the goal to save user preferences by work_item type and namespace we're creating a new table to save the preferences, starting by work_item sorting preference.
Changelog: added
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Related to: #501712 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Get preferences
query userPreference($namespace: ID!, $work_item_type: WorkItemsTypeID!) {
currentUser {
workItemTypePreferences(
namespacePath: $namespace
workItemTypeId: $work_item_type
) {
sort
namespace {
fullPath
}
workItemType {
name
}
}
}
}
{
"data": {
"currentUser": {
"workItemTypePreferences": {
"sort": "TITLE_ASC",
"namespace": {
"fullPath": "group"
},
"workItemType": {
"name": "Issue"
}
}
}
},
"correlationId": "01JK86HS9610033W9TMWM4F4W3"
}
- Update preferences
mutation updateWorkItemPreference(
$namespace: ID!,
$work_item_type: WorkItemsTypeID!,
$sort: WorkItemSort
) {
workItemUserPreferenceUpdate(
input: {
namespacePath: $namespace,
workItemTypeId: $work_item_type,
sort: $sort
}
) {
errors
userPreferences {
namespace {
path
}
workItemType {
name
}
sort
}
}
}
{
"data": {
"workItemUserPreferenceUpdate": {
"errors": [],
"userPreferences": {
"namespace": {
"path": "group"
},
"workItemType": {
"name": "Issue"
},
"sort": "DUE_DATE_ASC"
}
}
},
"correlationId": "01JKV9S1DPGF3A6ZJ49J3B3XT4"
}
Edited by Kassio Borges