mirror of
https://github.com/cve-search/vulnerability-lookup.git
synced 2024-12-29 17:01:34 +00:00
chg: [website] Provide the possibility to the user to set the timestamp of a sighting (optional).
This commit is contained in:
parent
9ab342c19f
commit
e3506e69a7
1 changed files with 5 additions and 2 deletions
|
@ -218,13 +218,16 @@ class SightingsList(Resource): # type: ignore[misc]
|
|||
sighting = sighting_ns.payload
|
||||
sighting["uuid"] = sighting.get("uuid", str(uuid.uuid4()))
|
||||
sighting["vulnerability_lookup_origin"] = local_instance_uuid
|
||||
sighting["creation_timestamp"] = current_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
if sighting.get("creation_timestamp"):
|
||||
sighting["creation_timestamp"] = sighting["creation_timestamp"]
|
||||
else:
|
||||
sighting["creation_timestamp"] = current_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
|
||||
if (
|
||||
Sighting.query.filter(
|
||||
Sighting.vulnerability.ilike(sighting["vulnerability"]),
|
||||
Sighting.source == sighting["source"],
|
||||
func.date(Sighting.creation_timestamp) == func.date(current_time),
|
||||
# func.date(Sighting.creation_timestamp) == func.date(current_time),
|
||||
).count()
|
||||
!= 0
|
||||
):
|
||||
|
|
Loading…
Reference in a new issue