Skip to content

Conversation

@WedgeSparda
Copy link

Added a couple of options in order to filter the response from API_GetConsoleIDs:

  • a: If 1, only active systems will return. Default to 0.
  • g: If 1, only game systems will return (not Hubs, Events, etc). Default to 0.

Also, added two new fields to the response indicating the value of these properties for each element in the response:

[
  {
    "ID": 1,
    "Name": "Mega Drive",
    "IconURL": "https://static.retroachievements.org/assets/images/system/md.png",
    "Active": true,
    "IsGameSystem": true
  }
  // ...
]

@WedgeSparda
Copy link
Author

Sorry for the amount of commits, I messed with my git and some extra commits are here despite already being merged into master

Copy link
Member

@wescopeland wescopeland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursory glance to help steer in the right direction

@wescopeland wescopeland changed the title feat(api): Added new filter options to API_GetConsoleIDs endpoint feat(api): add new filter options and fields to API_GetConsoleIDs endpoint Feb 29, 2024
- Removed helper function for system
- Deleted SystemFlag and used a bool value instead
- Moved all logic to endpoint file
- Added tests for new filters
@WedgeSparda
Copy link
Author

WedgeSparda commented Mar 2, 2024

UPDATE: OK, so I was able to push this once I shot down my local Docker instance. So maybe the problem was related to that.

ORIGINAL MESSAGE: I'm facing a problem when running phpstan before pushing.

 ------ ------------------------------------------------------------------------------------------------------------------------ 
  Line   app/Providers/AppServiceProvider.php                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------ 
  108    mysqli_connect(): php_network_getaddresses: getaddrinfo for mysql failed: nodename nor servname provided, or not known  
  108    mysqli_connect(): php_network_getaddresses: getaddrinfo for mysql failed: nodename nor servname provided, or not known  
 ------ ------------------------------------------------------------------------------------------------------------------------

But I didn't change anything from AppServiceProvider. Any idea?

I see the code causing this fail is this

        // TODO remove
        $this->app->singleton('mysqli', function () {
            try {
                $db = mysqli_connect(
                    config('database.connections.mysql.host'),
                    config('database.connections.mysql.username'),
                    config('database.connections.mysql.password'),
                    config('database.connections.mysql.database'),
                    (int) config('database.connections.mysql.port')
                );
                if (!$db) {
                    throw new Exception('Could not connect to database. Please try again later.');
                }
                mysqli_set_charset($db, config('database.connections.mysql.charset'));
                mysqli_query($db, "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));");

                return $db;
            } catch (Exception $exception) {
                if (app()->environment('local', 'testing')) {
                    throw $exception;
                }
                echo 'Could not connect to database. Please try again later.';
                exit;
            }
        });

Not sure if this should be there since there is a TODO there indicating it should be removed.

@wescopeland
Copy link
Member

You should be good to open an accompanying PR in api-docs for these changes now.

@WedgeSparda
Copy link
Author

@wescopeland Docs PR opened RetroAchievements/api-docs#42

Co-authored-by: Wes Copeland <wlcopeland1@gmail.com>
@WedgeSparda
Copy link
Author

Any ETA for this to be merged?

@wescopeland
Copy link
Member

We don't have a strict release schedule, however I don't believe we plan on doing a release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants