Get Settings

Retrieves the current application settings. Returns the singleton AppSettings record containing Jira connection configuration, field mappings, and page visibility toggles.

If no settings have been explicitly saved yet, the endpoint returns a default configuration. Default Jira connection values are populated from environment variables (JIRA_BASE_URL, JIRA_PROJECT_KEY, JIRA_USERNAME, JIRA_API_TOKEN), both toggles default to false, five default field mappings are included for the PI project, and all nine page toggles default to true.

This endpoint is called by the app/plugins/settings.ts plugin on every app initialization to ensure the sidebar navigation and route middleware have the correct toggle state immediately, without flash or stale fallback.

Request

No request body or query parameters.

Response

200 OK

Returns the complete AppSettings object.

FieldTypeDescription
idstringAlways "app_settings"
jiraConnectionJiraConnectionSettingsJira connection configuration
jiraFieldMappingsJiraFieldMapping[]Custom field mappings for Jira ticket normalization
pageTogglesPageTogglesVisibility toggles for sidebar pages
updatedAtstringISO 8601 timestamp of the last settings update

JiraConnectionSettings

FieldTypeDescription
baseUrlstringAtlassian instance URL (e.g. "https://mycompany.atlassian.net")
projectKeystringJira project key (e.g. "PI")
usernamestringJira username / email for Basic auth
apiTokenstringJira API token for Basic auth
enabledbooleanMaster toggle — enables all Jira endpoints
pushEnabledbooleanWrite toggle — enables push and comment endpoints

JiraFieldMapping

FieldTypeDescription
idstringUnique mapping identifier (e.g. "fm_1")
jiraFieldIdstringJira field ID (e.g. "customfield_10908", "priority")
labelstringHuman-readable label for the mapping
shopErpFieldstringThe Shop Planr field this maps to (e.g. "partNumber", "goalQuantity")
isDefaultbooleantrue for built-in mappings, false for user-created ones

PageToggles

FieldTypeDescription
jobsbooleanShow/hide the Jobs page
serialsbooleanShow/hide the Serials browser page
partsbooleanShow/hide the Parts View page
queuebooleanShow/hide the Work Queue page
templatesbooleanShow/hide the Templates page
bombooleanShow/hide the BOM page
certsbooleanShow/hide the Certificates page
jirabooleanShow/hide the Jira dashboard page
auditbooleanShow/hide the Audit Trail page

500 Internal Server Error

ConditionMessage
Database read failure"Internal Server Error"

Examples

Request

curl http://localhost:3000/api/settings

Response — Default settings (never saved)

{
  "id": "app_settings",
  "jiraConnection": {
    "baseUrl": "",
    "projectKey": "PI",
    "username": "",
    "apiToken": "",
    "enabled": false,
    "pushEnabled": false
  },
  "jiraFieldMappings": [
    { "id": "fm_1", "jiraFieldId": "customfield_10908", "label": "Part Number / Rev", "shopErpField": "partNumber", "isDefault": true },
    { "id": "fm_2", "jiraFieldId": "customfield_10900", "label": "Quantity", "shopErpField": "goalQuantity", "isDefault": true },
    { "id": "fm_3", "jiraFieldId": "customfield_10014", "label": "Epic Link", "shopErpField": "epicLink", "isDefault": true },
    { "id": "fm_4", "jiraFieldId": "priority", "label": "Priority", "shopErpField": "priority", "isDefault": true },
    { "id": "fm_5", "jiraFieldId": "labels", "label": "Labels", "shopErpField": "labels", "isDefault": true }
  ],
  "pageToggles": {
    "jobs": true,
    "serials": true,
    "parts": true,
    "queue": true,
    "templates": true,
    "bom": true,
    "certs": true,
    "jira": true,
    "audit": true
  },
  "updatedAt": "2024-01-15T10:30:00.000Z"
}

Response — Configured settings

{
  "id": "app_settings",
  "jiraConnection": {
    "baseUrl": "https://mycompany.atlassian.net",
    "projectKey": "PI",
    "username": "admin@company.com",
    "apiToken": "ATATT3xFfGF0...",
    "enabled": true,
    "pushEnabled": true
  },
  "jiraFieldMappings": [
    { "id": "fm_1", "jiraFieldId": "customfield_10908", "label": "Part Number / Rev", "shopErpField": "partNumber", "isDefault": true },
    { "id": "fm_2", "jiraFieldId": "customfield_10900", "label": "Quantity", "shopErpField": "goalQuantity", "isDefault": true },
    { "id": "fm_3", "jiraFieldId": "customfield_10014", "label": "Epic Link", "shopErpField": "epicLink", "isDefault": true },
    { "id": "fm_4", "jiraFieldId": "priority", "label": "Priority", "shopErpField": "priority", "isDefault": true },
    { "id": "fm_5", "jiraFieldId": "labels", "label": "Labels", "shopErpField": "labels", "isDefault": true },
    { "id": "fm_6", "jiraFieldId": "customfield_11000", "label": "Material Spec", "shopErpField": "materialSpec", "isDefault": false }
  ],
  "pageToggles": {
    "jobs": true,
    "serials": true,
    "parts": true,
    "queue": true,
    "templates": true,
    "bom": false,
    "certs": false,
    "jira": true,
    "audit": true
  },
  "updatedAt": "2024-01-16T14:00:00.000Z"
}

Notes

  • The API token is returned in plaintext. In a production environment, consider masking this value in the frontend.
  • Default settings are computed on-the-fly from environment variables and built-in constants. They are not persisted until the first PUT call.
  • The updatedAt timestamp on default settings reflects the current server time, not a stored value.
  • The settings plugin (app/plugins/settings.ts) calls this endpoint once on app initialization. Subsequent reads use the cached composable state.