Skip to content

Commit

Permalink
fix: return correct createdOn timestamp for all resources
Browse files Browse the repository at this point in the history
The API was returning the snapshot's created_on timestamp instead of the resource's created_on
timestamp. This commit fixes the issue in the response build functions in `restapi/v1/utils.py`.
  • Loading branch information
keithmanville authored and jkglasbrenner committed Aug 6, 2024
1 parent e878f3d commit 9e03f10
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/dioptra/restapi/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def build_experiment(experiment_dict: ExperimentDict) -> dict[str, Any]:
"description": experiment.description,
"user": build_user_ref(experiment.creator),
"group": build_group_ref(experiment.resource.owner),
"created_on": experiment.created_on,
"created_on": experiment.resource.created_on,
"last_modified_on": experiment.resource.last_modified_on,
"latest_snapshot": experiment.resource.latest_snapshot_id
== experiment.resource_snapshot_id,
Expand Down Expand Up @@ -606,7 +606,7 @@ def build_entrypoint(entrypoint_dict: EntrypointDict) -> dict[str, Any]:
"task_graph": entrypoint.task_graph,
"user": build_user_ref(entrypoint.creator),
"group": build_group_ref(entrypoint.resource.owner),
"created_on": entrypoint.created_on,
"created_on": entrypoint.resource.created_on,
"last_modified_on": entrypoint.resource.last_modified_on,
"latest_snapshot": entrypoint.resource.latest_snapshot_id
== entrypoint.resource_snapshot_id,
Expand Down Expand Up @@ -659,7 +659,7 @@ def build_job(job_dict: JobDict) -> dict[str, Any]:
"queue": build_queue_snapshot_ref(job.queue_job.queue),
"experiment": build_experiment_snapshot_ref(job.experiment_job.experiment),
"entrypoint": build_entrypoint_snapshot_ref(job.entry_point_job.entry_point),
"created_on": job.created_on,
"created_on": job.resource.created_on,
"last_modified_on": job.resource.last_modified_on,
"latest_snapshot": job.resource.latest_snapshot_id == job.resource_snapshot_id,
"tags": [build_tag_ref(tag) for tag in job.tags],
Expand Down Expand Up @@ -709,7 +709,7 @@ def build_model(model_dict: ModelWithVersionDict) -> dict[str, Any]:
"description": model.description,
"user": build_user_ref(model.creator),
"group": build_group_ref(model.resource.owner),
"created_on": model.created_on,
"created_on": model.resource.created_on,
"last_modified_on": model.resource.last_modified_on,
"latest_snapshot": model.resource.latest_snapshot_id
== model.resource_snapshot_id,
Expand Down Expand Up @@ -741,7 +741,7 @@ def build_model_version(model_dict: ModelWithVersionDict) -> dict[str, Any]:
"description": version.description,
"version_number": version.version_number,
"artifact": build_artifact_ref(version.artifact),
"created_on": version.created_on,
"created_on": version.resource.created_on,
}


Expand All @@ -756,7 +756,7 @@ def build_artifact(artifact_dict: ArtifactDict) -> dict[str, Any]:
"description": artifact.description,
"user": build_user_ref(artifact.creator),
"group": build_group_ref(artifact.resource.owner),
"created_on": artifact.created_on,
"created_on": artifact.resource.created_on,
"last_modified_on": artifact.resource.last_modified_on,
"latest_snapshot": artifact.resource.latest_snapshot_id
== artifact.resource_snapshot_id,
Expand Down Expand Up @@ -788,7 +788,7 @@ def build_queue(queue_dict: QueueDict) -> dict[str, Any]:
"description": queue.description,
"user": build_user_ref(queue.creator),
"group": build_group_ref(queue.resource.owner),
"created_on": queue.created_on,
"created_on": queue.resource.created_on,
"last_modified_on": queue.resource.last_modified_on,
"latest_snapshot": queue.resource.latest_snapshot_id
== queue.resource_snapshot_id,
Expand Down Expand Up @@ -821,7 +821,7 @@ def build_plugin(plugin_with_files: PluginWithFilesDict) -> dict[str, Any]:
"description": plugin.description,
"user": build_user_ref(plugin.creator),
"group": build_group_ref(plugin.resource.owner),
"created_on": plugin.created_on,
"created_on": plugin.resource.created_on,
"last_modified_on": plugin.resource.last_modified_on,
"latest_snapshot": plugin.resource.latest_snapshot_id
== plugin.resource_snapshot_id,
Expand Down Expand Up @@ -851,7 +851,7 @@ def build_plugin_file(plugin_file_with_plugin: PluginFileDict) -> dict[str, Any]
"description": plugin_file.description,
"user": build_user_ref(plugin_file.creator),
"group": build_group_ref(plugin_file.resource.owner),
"created_on": plugin_file.created_on,
"created_on": plugin_file.resource.created_on,
"last_modified_on": plugin_file.resource.last_modified_on,
"latest_snapshot": plugin_file.resource.latest_snapshot_id
== plugin_file.resource_snapshot_id,
Expand Down Expand Up @@ -923,7 +923,7 @@ def build_plugin_parameter_type(
"description": plugin_parameter_type.description,
"user": build_user_ref(plugin_parameter_type.creator),
"group": build_group_ref(plugin_parameter_type.resource.owner),
"created_on": plugin_parameter_type.created_on,
"created_on": plugin_parameter_type.resource.created_on,
"last_modified_on": plugin_parameter_type.resource.last_modified_on,
"latest_snapshot": plugin_parameter_type.resource.latest_snapshot_id
== plugin_parameter_type.resource_snapshot_id,
Expand Down

0 comments on commit 9e03f10

Please sign in to comment.