Refactor database queries and handle non-429 errors in history
Updated database query code to use consistent parameter naming and revised query structure for clarity. Added logic in the history component to return existing data when encountering non-429 HTTP errors.
This commit is contained in:
+13
-13
@@ -137,20 +137,21 @@ public interface NameHistoryMapper {
|
||||
@Select("""
|
||||
SELECT punishment.uuid,
|
||||
user_lookup.name AS punished_name,
|
||||
reason,
|
||||
banned_by_uuid,
|
||||
banned_by_name,
|
||||
removed_by_name,
|
||||
time,
|
||||
until,
|
||||
removed_by_reason
|
||||
FROM ${tableName} AS punishment
|
||||
INNER JOIN user_lookup ON user_lookup.uuid = punishment.uuid
|
||||
punishment.reason,
|
||||
punishment.banned_by_uuid,
|
||||
punishment.banned_by_name,
|
||||
punishment.removed_by_name,
|
||||
punishment.time,
|
||||
punishment.until,
|
||||
punishment.removed_by_reason
|
||||
FROM ${table_name} AS punishment
|
||||
INNER JOIN user_lookup
|
||||
ON user_lookup.uuid = punishment.uuid
|
||||
WHERE ${name_column} LIKE #{partialName}
|
||||
ORDER BY time DESC
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
""")
|
||||
List<HistoryRecord> getRecentHistoryForName(@Param("tableName") String tableName,
|
||||
List<HistoryRecord> getRecentHistoryForName(@Param("table_name") String tableName,
|
||||
@Param("partialName") String partialName,
|
||||
@Param("name_column") String nameColumn,
|
||||
@Param("limit") int limit,
|
||||
@@ -199,14 +200,13 @@ public interface NameHistoryMapper {
|
||||
time,
|
||||
until,
|
||||
removed_by_reason
|
||||
FROM ${tableName} AS punishment
|
||||
WHERE ${name_column} LIKE #{partialName}
|
||||
FROM ${table_name} AS punishment
|
||||
ORDER BY time DESC
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
) AS punishment
|
||||
INNER JOIN user_lookup ON user_lookup.uuid = punishment.uuid
|
||||
""")
|
||||
List<HistoryRecord> getRecentHistory(@Param("tableName") String tableName,
|
||||
List<HistoryRecord> getRecentHistory(@Param("table_name") String tableName,
|
||||
@Param("limit") int limit,
|
||||
@Param("offset") int offset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user