Skip to content

Commit

Permalink
chg: [website] Provide the possibility to the user to set the timesta…
Browse files Browse the repository at this point in the history
…mp of a sighting (optional).
  • Loading branch information
cedricbonhomme committed Nov 12, 2024
1 parent 9ab342c commit e3506e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions website/web/api/v1/sighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,16 @@ def post(self) -> Tuple[ResultType, int]:
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
):
Expand Down

0 comments on commit e3506e6

Please sign in to comment.