Closed darcato closed 2 months ago
I added the IAM_CLIENT_LAST_USED
table with a bidirectional one to one relationship with CLIENT_DETAILS
. The column LAST_USED
on CLIENT_DETAILS
references the ID
of IAM_CLIENT_LAST_USED
and initially is set to null
.
The first time a client is used an entry is added to IAM_CLIENT_LAST_USED
and its ID
is written to the CLIENT_DETAILS(LAST_USED)
.
Then, when a client is used again the entry in the IAM_CLIENT_LAST_USED
is updated with the new date. So this update does not write to the CLIENT_DETAILS
table. Also, by updating the date corresponding to an existing ID
, we avoid adding lines to the table each time a client is used.
Still, the read operation always performs two queries to the DB (as far as I understand).
I added the ClientLastUsed
entity to MitreID, since it must be visible by ClientDetailsEntity
. I called the table with the IAM_
prefix since it is defined in the SQL migrations in the IAM project, while the entity is defined in MitreID and thus I avoided the Iam
prefix on the entity name. Should I move the the SQL table creation to MitreID?
I added the
IAM_CLIENT_LAST_USED
table with a bidirectional one to one relationship withCLIENT_DETAILS
. The columnLAST_USED
onCLIENT_DETAILS
references theID
ofIAM_CLIENT_LAST_USED
and initially is set tonull
.
Is it necessary to have an entry if the value is set to null?
The value of LAST_USED_ID
on CLIENT_DETAILS
is set to null when the client has been created but not used yet. Anyway with the last commits I modified the one-to-one relationship to use a shared primary key. The primary key of IAM_CLIENT_LAST_USED
references the primary key of CLIENT_DETAILS
. This way we avoid having the LAST_USED_ID
column on CLIENT_DETAILS
.
Issues
0 New issues
Measures
0 Security Hotspots
96.8% Coverage on New Code
0.0% Duplication on New Code
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
96.8% Coverage on New Code
0.0% Duplication on New Code
Related to issue #605
We want to keep track of the last time a client has been used so that the long unused clients can be easily identified and deleted by the administrators.
A
last_used
column is added to theClientDetails
table and the API and dashboard are updated accordingly. This requires an update to theClientDetailsEntity
on MitreID.