fix(api): have correct behaviour for 'before' param

This commit is contained in:
spiral 2021-11-17 09:52:58 -05:00
parent 1d5943b6e1
commit b4b83f2c94
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ namespace PluralKit.API
select members.hid from switch_members, members select members.hid from switch_members, members
where switch_members.switch = switches.id and members.id = switch_members.member where switch_members.switch = switches.id and members.id = switch_members.member
) as members from switches ) as members from switches
where switches.system = @System and switches.timestamp <= @Before where switches.system = @System and switches.timestamp < @Before
order by switches.timestamp desc order by switches.timestamp desc
limit @Limit;", new { System = system.Id, Before = before, Limit = limit })); limit @Limit;", new { System = system.Id, Before = before, Limit = limit }));
return Ok(res); return Ok(res);

View File

@ -212,7 +212,7 @@ Query String Parameters
|key|type|description| |key|type|description|
|---|---|---| |---|---|---|
|before|timestamp|date to get latest switch from (inclusive)| |before|timestamp|date to get latest switch from|
|limit|int|number of switches to get| |limit|int|number of switches to get|
Returns a [switch object](/api/models#switch-model) containing a list of IDs. Returns a [switch object](/api/models#switch-model) containing a list of IDs.