fix(modpackchecker): getStatus() use server_uuid and status column
BUG: Was using server_id (column doesn't exist) instead of server_uuid
BUG: Was using update_available (column doesn't exist) instead of status
FIXED:
- Changed whereIn('server_id', $serverIds) to whereIn('server_uuid', $serverUuids)
- Changed pluck('id') to pluck('uuid')
- Changed (bool) $status->update_available to $status->status === 'update_available'
This fix makes the dashboard badge API actually work!
Signed-off-by: Claude (Chronicler #63) <claude@firefrostgaming.com>
This commit is contained in:
@@ -511,19 +511,19 @@ class ModpackAPIController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
// Get all servers the user has access to
|
||||
$serverIds = $user->accessibleServers()->pluck('id')->toArray();
|
||||
// Get all server UUIDs the user has access to
|
||||
$serverUuids = $user->accessibleServers()->pluck('uuid')->toArray();
|
||||
|
||||
// Query our cache table for these servers
|
||||
$statuses = DB::table('modpackchecker_servers')
|
||||
->whereIn('server_id', $serverIds)
|
||||
->whereIn('server_uuid', $serverUuids)
|
||||
->get()
|
||||
->keyBy('server_uuid');
|
||||
|
||||
$result = [];
|
||||
foreach ($statuses as $uuid => $status) {
|
||||
$result[$uuid] = [
|
||||
'update_available' => (bool) $status->update_available,
|
||||
'update_available' => $status->status === 'update_available',
|
||||
'modpack_name' => $status->modpack_name,
|
||||
'current_version' => $status->current_version,
|
||||
'latest_version' => $status->latest_version,
|
||||
|
||||
Reference in New Issue
Block a user