gempir / justlog

twitch logging platform
MIT License
161 stars 38 forks source link

/list Endpoint Does Not Filter Logs by User ID #200

Open Alb11747 opened 6 months ago

Alb11747 commented 6 months ago

Description

The /list endpoint in JustLog does not correctly filter logs by the userid parameter. Instead of returning logs specific to the provided user ID, it returns logs for the entire channel.

Steps to Reproduce

  1. Make a GET request to https://justlog.alb11747.com/list?channel=fobm4ster&userid=31062476.

    • Expected: Logs filtered by the specified user ID.
    • Actual: Logs for the entire channel.

    Sample Output:

    {
     "availableLogs": [
       {"year": "2024", "month": "3"},
       {"year": "2024", "month": "2"},
       {"year": "2024", "month": "1"},
       {"year": "2023", "month": "12"}
     ]
    }
  2. Make a GET request to https://justlog.alb11747.com/list?channelid=31062476&userid=31062476.

    • Expected: Logs filtered by the specified user ID.
    • Actual: Logs for the entire channel.

    Sample Output:

    {
     "availableLogs": [
       {"year": "2024", "month": "3"},
       {"year": "2024", "month": "2"},
       {"year": "2024", "month": "1"},
       {"year": "2023", "month": "12"}
     ]
    }
  3. Make a GET request to https://justlog.alb11747.com/list?username=fobm4ster&channelid=31062476.

    • This call correctly returns logs filtered by the username and channel ID.

    Sample Output:

    {
     "availableLogs": [
       {"year": "2023", "month": "12", "day": "23"},
       {"year": "2023", "month": "12", "day": "12"},
       {"year": "2023", "month": "12", "day": "24"}
     ]
    }

Expected Behavior

The /list endpoint should filter logs based on the userid parameter when provided, similar to how it filters based on the username and channelid parameters.

Actual Behavior

The /list endpoint ignores the userid parameter and returns logs for the entire channel.

Additional Information

Possible Solution

It appears that the userid parameter is not being properly handled in the query logic for the /list endpoint. A review of the parameter parsing and filtering logic may be necessary to resolve this issue.