Skip to content

Conversation

ayushaga14
Copy link
Contributor

No description provided.

KafkaConfig kafkaConfig, MaliciousEventDao maliciousEventDao) {
this.kafka = new Kafka(kafkaConfig);
this.mongoClient = mongoClient;
this.maliciousEventDao = maliciousEventDao;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the Dao as a variable now ? We should directly use MaliciousEventsDao.instance.. ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed keeping this


MaliciousEventService maliciousEventService =
new MaliciousEventService(internalKafkaConfig, threatProtectionMongo);
new MaliciousEventService(internalKafkaConfig, MaliciousEventDao.instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same why create dependency ? we can directly use MaliciousEventDao.instance ?

MongoCollection<Document> coll = database.getCollection(MongoDBCollection.ThreatDetection.MALICIOUS_EVENTS, Document.class);
public static void createIndexIfAbsent(String accountId, MaliciousEventDao maliciousEventDao) {
// Get the collection from DAO - this will create the collection if it doesn't exist
MongoCollection<?> collection = maliciousEventDao.getCollection(accountId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dao.Instance

create indices for api_distirbution_data as well.

return super.getCollection(accountId);
}

public AggregateIterable<Document> aggregateRaw(String accountId, List<Document> pipeline) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simly MaliciosDao.instance.aggregate won't work ?

long modifiedCount = coll.updateMany(query, update).getModifiedCount();

long modifiedCount = maliciousEventDao.getCollection(accountId).updateMany(query, update).getModifiedCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Dao it should directly be Dao.instance.updateMany ???

.setDetectedAt(event.getDetectedAt())
.setSubCategory(event.getFilterId())
.setSeverity(event.getSeverity())
.setMethod(event.getLatestApiMethod().name())
Copy link
Contributor

@gauravakto gauravakto Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if latestApiMethod is an enum ? .name needed ?

Copy link
Contributor

@gauravakto gauravakto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check

@ayushaga14 ayushaga14 merged commit ed74146 into master Oct 20, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants