loot tracker service: remove type argument from delete
The client does not track type and eventId so it cannot use it
This commit is contained in:
@@ -31,7 +31,6 @@ import java.util.Collection;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import net.runelite.http.api.loottracker.LootRecord;
|
||||
import net.runelite.http.api.loottracker.LootRecordType;
|
||||
import net.runelite.http.service.account.AuthFilter;
|
||||
import net.runelite.http.service.account.beans.SessionEntry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -81,7 +80,7 @@ public class LootTrackerController
|
||||
|
||||
@DeleteMapping
|
||||
public void deleteLoot(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(required = false) LootRecordType type, @RequestParam(required = false) String eventId) throws IOException
|
||||
@RequestParam(required = false) String eventId) throws IOException
|
||||
{
|
||||
SessionEntry e = auth.handle(request, response);
|
||||
if (e == null)
|
||||
@@ -90,6 +89,6 @@ public class LootTrackerController
|
||||
return;
|
||||
}
|
||||
|
||||
service.delete(e.getUser(), type, eventId);
|
||||
service.delete(e.getUser(), eventId);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import net.runelite.http.api.loottracker.GameItem;
|
||||
import net.runelite.http.api.loottracker.LootRecord;
|
||||
import net.runelite.http.api.loottracker.LootRecordType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -70,7 +69,7 @@ public class LootTrackerService
|
||||
private static final String SELECT_LOOT_QUERY = "SELECT killId,time,type,eventId,itemId,itemQuantity FROM kills JOIN drops ON drops.killId = kills.id WHERE accountId = :accountId ORDER BY TIME DESC LIMIT :limit";
|
||||
|
||||
private static final String DELETE_LOOT_ACCOUNT = "DELETE FROM kills WHERE accountId = :accountId";
|
||||
private static final String DELETE_LOOT_ACCOUNT_TYPE = "DELETE FROM kills WHERE accountId = :accountId AND type = :type AND eventId = :eventId";
|
||||
private static final String DELETE_LOOT_ACCOUNT_EVENTID = "DELETE FROM kills WHERE accountId = :accountId AND eventId = :eventId";
|
||||
|
||||
private final Sql2o sql2o;
|
||||
|
||||
@@ -164,21 +163,20 @@ public class LootTrackerService
|
||||
return lootRecords;
|
||||
}
|
||||
|
||||
public void delete(int accountId, LootRecordType type, String eventId)
|
||||
public void delete(int accountId, String eventId)
|
||||
{
|
||||
try (Connection con = sql2o.open())
|
||||
{
|
||||
if (eventId == null && type == null)
|
||||
if (eventId == null)
|
||||
{
|
||||
con.createQuery(DELETE_LOOT_ACCOUNT)
|
||||
.addParameter("accountId", accountId)
|
||||
.executeUpdate();
|
||||
}
|
||||
else if (eventId != null && type != null)
|
||||
else
|
||||
{
|
||||
con.createQuery(DELETE_LOOT_ACCOUNT_TYPE)
|
||||
con.createQuery(DELETE_LOOT_ACCOUNT_EVENTID)
|
||||
.addParameter("accountId", accountId)
|
||||
.addParameter("type", type)
|
||||
.addParameter("eventId", eventId)
|
||||
.executeUpdate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user