Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ SELECT CONCAT(
d.domain_name,',',d.creation_time,',',d.registration_expiration_time,',',d.statuses
) AS result FROM "Domain" d
WHERE d.current_sponsor_registrar_id = :registrarId
AND d.deletion_time > ':now'
AND d.creation_time <= ':now';
AND d.deletion_time > :now
AND d.creation_time <= :now
""";

private static final FluentLogger logger = FluentLogger.forEnclosingClass();
Expand Down Expand Up @@ -107,17 +107,16 @@ protected void getHandler(User user) {
}

private void writeCsv(CSVPrinter printer) throws IOException {
String sql = SQL_TEMPLATE.replaceAll(":now", clock.now().toString());

printer.printRecord(
ImmutableList.of("Domain Name", "Creation Time", "Expiration Time", "Domain Statuses"));

tm().transact(
() -> {
try (var resultStream =
tm().getEntityManager()
.createNativeQuery(sql, String.class)
.createNativeQuery(SQL_TEMPLATE, String.class)
.setParameter("registrarId", registrarId)
.setParameter("now", clock.now())
.setHint("org.hibernate.fetchSize", 1000)
.getResultStream()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ConsoleHistoryDataAction extends ConsoleApiAction {
"""
SELECT *
FROM "ConsoleUpdateHistory"
WHERE SPLIT_PART(description, '|', 1) = :registrarId;
WHERE SPLIT_PART(description, '|', 1) = :registrarId
""";

public static final String PATH = "/console-api/history";
Expand Down
Loading