freescout-github/Http/routes.php
Jack Arturo f35ecc23d5 feat: add user-to-GitHub mapping and watchers dropdown
Implements #2 - Full user mapping and watchers selection feature:

Settings:
- Add FreeScout User → GitHub Username mapping table
- Shows all active FreeScout users with GitHub username fields
- Stored as JSON in Options table (no schema change needed)

Modal:
- Add 'Watchers' multi-select dropdown in create issue modal
- Populated from user mappings (only users with GitHub usernames)
- Defaults to current user if they have a mapping
- Select2 for consistent UX with labels dropdown

Backend:
- New endpoint: GET /github/user-mappings
- createIssue() accepts watchers[] parameter
- createRemoteLink() @mentions all selected watchers
- @mentioned users are auto-subscribed to issue notifications

This replaces the simpler default_watcher approach with full
FreeScout-to-GitHub user mapping, allowing any support agent
to select who gets notified about new issues.
2025-11-24 22:13:53 +01:00

45 lines
No EOL
2.6 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
// GitHub module routes
Route::group([
'middleware' => ['web', 'auth', 'roles'],
'prefix' => \Helper::getSubdirectory(),
'namespace' => 'Modules\Github\Http\Controllers'
], function () {
// AJAX routes for GitHub operations
Route::post('/github/search-issues', 'GithubController@searchIssues')->name('github.search_issues');
Route::post('/github/create-issue', 'GithubController@createIssue')->name('github.create_issue');
Route::post('/github/link-issue', 'GithubController@linkIssue')->name('github.link_issue');
Route::post('/github/unlink-issue', 'GithubController@unlinkIssue')->name('github.unlink_issue');
Route::get('/github/issue-details/{id}', 'GithubController@getIssueDetails')->name('github.issue_details');
Route::post('/github/refresh-issue/{id}', 'GithubController@refreshIssue')->name('github.refresh_issue');
Route::post('/github/refresh-conversation-issues', 'GithubController@refreshConversationIssues')->name('github.refresh_conversation_issues');
Route::post('/github/generate-content', 'GithubController@generateContent')->name('github.generate_content');
// Settings routes
Route::post('/github/test-connection', 'GithubController@testConnection')->name('github.test_connection');
Route::post('/github/repositories', 'GithubController@getRepositories')->name('github.repositories');
Route::get('/github/repositories/search', 'GithubController@searchRepositories')->name('github.repositories.search');
Route::post('/github/repositories/refresh', 'GithubController@refreshRepositories')->name('github.repositories.refresh');
Route::get('/github/labels/{repository}', 'GithubController@getLabels')->name('github.labels')->where('repository', '.*');
Route::post('/github/save-settings', 'GithubController@saveSettings')->name('github.save_settings');
// Label mapping routes
Route::get('/github/label-mappings', 'GithubController@getLabelMappings')->name('github.label_mappings');
Route::post('/github/label-mappings', 'GithubController@saveLabelMappings')->name('github.save_label_mappings');
// User mapping routes (for watchers dropdown)
Route::get('/github/user-mappings', 'GithubController@getUserMappings')->name('github.user_mappings');
});
// Public webhook route (no middleware - external access required)
Route::group([
'prefix' => \Helper::getSubdirectory(),
'namespace' => 'Modules\Github\Http\Controllers'
], function () {
Route::post('/github/webhook', 'GithubController@webhook')->name('github.webhook');
});