Fixed#7251: POST API calls to /usage endpoint are inconsistent (#7587)

* Fixed#7251: POST API calls to /usage endpoint are inconsistent

* Fixed#7251: POST API calls to /usage endpoint are inconsistent
This commit is contained in:
Parth Panchal 2022-09-20 17:38:03 +05:30 committed by GitHub
parent c522fa1de2
commit 2c0657fe68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,8 +134,12 @@ public class UsageRepository {
// Insert usage record
insertToUsageRepository(method, entityId, entityType, usage);
Table updated = Entity.getEntity(Entity.TABLE, UUID.fromString(entityId), fields, Include.ALL);
insertToUsageRepository(method, table.getDatabaseSchema().getId().toString(), Entity.DATABASE_SCHEMA, usage);
insertToUsageRepository(method, table.getDatabase().getId().toString(), Entity.DATABASE, usage);
dao.usageDAO()
.insertOrUpdateCount(
usage.getDate(), table.getDatabaseSchema().getId().toString(), Entity.DATABASE_SCHEMA, usage.getCount());
dao.usageDAO()
.insertOrUpdateCount(
usage.getDate(), table.getDatabase().getId().toString(), Entity.DATABASE, usage.getCount());
dao.usageDAO().computePercentile(entityType, usage.getDate());
ChangeDescription change =