This commit is contained in:
2026-03-20 21:17:26 +01:00
parent 1a62fcb81d
commit 29c3ff8572
229 changed files with 13147 additions and 2577 deletions

View File

@@ -12,6 +12,21 @@ Route::middleware(['web', 'auth'])->prefix('dashboard')->name('api.dashboard.')-
Route::get('analytics', [DashboardController::class, 'analytics'])->name('analytics');
Route::get('trending-artworks', [DashboardController::class, 'trendingArtworks'])->name('trending-artworks');
Route::get('recommended-creators', [DashboardController::class, 'recommendedCreators'])->name('recommended-creators');
Route::put('preferences/shortcuts', [\App\Http\Controllers\Dashboard\DashboardPreferenceController::class, 'updateShortcuts'])->name('preferences.shortcuts');
});
Route::middleware(['web', 'auth'])
->get('user/xp', \App\Http\Controllers\Api\UserXpController::class)
->name('api.user.xp');
Route::middleware(['web', 'auth'])
->get('user/achievements', \App\Http\Controllers\Api\UserAchievementsController::class)
->name('api.user.achievements');
Route::middleware(['web', 'throttle:60,1'])->prefix('leaderboard')->name('api.leaderboard.')->group(function () {
Route::get('creators', [\App\Http\Controllers\Api\LeaderboardController::class, 'creators'])->name('creators');
Route::get('artworks', [\App\Http\Controllers\Api\LeaderboardController::class, 'artworks'])->name('artworks');
Route::get('stories', [\App\Http\Controllers\Api\LeaderboardController::class, 'stories'])->name('stories');
});
Route::middleware(['web', 'auth', 'creator.access'])->prefix('stories')->name('api.stories.')->group(function () {
@@ -56,6 +71,14 @@ Route::middleware(['web', 'throttle:reactions-read'])
->get('community/activity', [\App\Http\Controllers\Api\CommunityActivityController::class, 'index'])
->name('api.community.activity');
Route::middleware(['web', 'throttle:social-read'])
->get('activity', [\App\Http\Controllers\Api\SocialActivityController::class, 'index'])
->name('api.activity');
Route::middleware(['web', 'throttle:social-read'])
->get('comments', [\App\Http\Controllers\Api\SocialCompatibilityController::class, 'comments'])
->name('api.social.comments.index');
// ── Ranking lists (public, throttled, Redis-cached) ─────────────────────────
// GET /api/rank/global?type=trending|new_hot|best
// GET /api/rank/category/{id}?type=trending|new_hot|best
@@ -308,6 +331,22 @@ Route::middleware(['web'])
});
Route::middleware(['web', 'auth', 'normalize.username'])->group(function () {
Route::match(['post', 'delete'], 'like', [\App\Http\Controllers\Api\SocialCompatibilityController::class, 'like'])
->name('api.social.like');
Route::post('comments', [\App\Http\Controllers\Api\SocialCompatibilityController::class, 'comments'])
->name('api.social.comments.store');
Route::match(['post', 'delete'], 'bookmark', [\App\Http\Controllers\Api\SocialCompatibilityController::class, 'bookmark'])
->name('api.social.bookmark');
Route::get('bookmarks', [\App\Http\Controllers\Api\SocialCompatibilityController::class, 'bookmarks'])
->name('api.social.bookmarks');
Route::match(['post', 'delete'], 'artworks/{id}/bookmark', [\App\Http\Controllers\Api\ArtworkInteractionController::class, 'bookmark'])
->whereNumber('id')
->name('api.artworks.bookmark');
Route::post('artworks/{id}/favorite', [\App\Http\Controllers\Api\ArtworkInteractionController::class, 'favorite'])
->whereNumber('id')
->name('api.artworks.favorite');
@@ -320,9 +359,13 @@ Route::middleware(['web', 'auth', 'normalize.username'])->group(function () {
->whereNumber('id')
->name('api.artworks.report');
Route::post('users/{id}/follow', [\App\Http\Controllers\Api\ArtworkInteractionController::class, 'follow'])
Route::match(['post', 'delete'], 'users/{id}/follow', [\App\Http\Controllers\Api\ArtworkInteractionController::class, 'follow'])
->whereNumber('id')
->name('api.users.follow');
Route::match(['post', 'delete'], 'follow/{id}', [\App\Http\Controllers\Api\ArtworkInteractionController::class, 'follow'])
->whereNumber('id')
->name('api.follow.alias');
});
// ── Share tracking (public, throttled) ────────────────────────────────────────
@@ -615,6 +658,38 @@ Route::middleware(['web', 'auth'])
Route::post('{id}/read', [\App\Http\Controllers\Api\NotificationController::class, 'markRead'])->name('mark-read');
});
Route::middleware(['web', 'throttle:social-read'])
->prefix('stories')
->name('api.stories.comments.')
->group(function () {
Route::get('{id}/comments', [\App\Http\Controllers\Api\StoryCommentController::class, 'index'])
->whereNumber('id')
->name('index');
});
Route::middleware(['web', 'auth'])
->prefix('stories')
->name('api.stories.social.')
->group(function () {
Route::post('{id}/like', [\App\Http\Controllers\Api\StoryInteractionController::class, 'like'])
->whereNumber('id')
->middleware(['throttle:social-write', 'forum.bot.protection:api_write'])
->name('like');
Route::post('{id}/bookmark', [\App\Http\Controllers\Api\StoryInteractionController::class, 'bookmark'])
->whereNumber('id')
->middleware(['throttle:social-write', 'forum.bot.protection:api_write'])
->name('bookmark');
Route::post('{id}/comments', [\App\Http\Controllers\Api\StoryCommentController::class, 'store'])
->whereNumber('id')
->middleware(['throttle:social-write', 'forum.bot.protection:api_write'])
->name('comments.store');
Route::delete('{id}/comments/{commentId}', [\App\Http\Controllers\Api\StoryCommentController::class, 'destroy'])
->whereNumber('id')
->whereNumber('commentId')
->middleware('throttle:social-write')
->name('comments.destroy');
});
// ── Artwork search for share modal (public, throttled) ────────────────────────
// GET /api/search/artworks?q=...&shareable=1 → reuses existing ArtworkSearchController