Skip to content

Commit

Permalink
add timestamp filter
Browse files Browse the repository at this point in the history
  • Loading branch information
notshivansh committed Nov 29, 2024
1 parent 03d16f1 commit 55d3333
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/dashboard/src/main/java/com/akto/action/InternalAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class InternalAction extends UserAction {

boolean actuallyDelete;
int count;
int timestamp;

public String deleteApisWithoutHost() {

Expand All @@ -46,10 +47,14 @@ public String deleteApisWithoutHost() {
int apiCollectionId = apiCollection.getId();
if (demosAndDeactivated.contains(apiCollectionId)) {
loggerMaker.infoAndAddToDb("Skipping deleteApisBasedOnHeader for apiCollectionId " + apiCollectionId);
continue;
}

List<Bson> pipeline = Arrays.asList(new Document("$match",
new Document("apiCollectionId", apiCollectionId)),
new Document("$and", Arrays.asList(new Document("$or", Arrays.asList(
new Document("lastSeen", new Document("$gt", timestamp)),
new Document("timestamp", new Document("$gt", timestamp)))),
new Document("apiCollectionId", apiCollectionId)))),
new Document("$group",
new Document("_id",
new Document("apiCollectionId", "$apiCollectionId")
Expand Down Expand Up @@ -118,4 +123,12 @@ public int getCount() {
public void setCount(int count) {
this.count = count;
}

public int getTimestamp() {
return timestamp;
}

public void setTimestamp(int timestamp) {
this.timestamp = timestamp;
}
}

0 comments on commit 55d3333

Please sign in to comment.