Skip to content

Commit

Permalink
add created timestamp to dataset listing
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxcapades committed Oct 10, 2023
1 parent eb323f1 commit e7fc405
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 10 deletions.
9 changes: 5 additions & 4 deletions docs/vdi-api.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions modules/rest-service/api.raml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ uses:
accepted: true
fileCount: 2
fileSizeTotal: 123456789
created: 2023-10-31T23:59:59.999Z
400:
description: |
Bad Request.
Expand Down
5 changes: 5 additions & 0 deletions modules/rest-service/schema/by-path/vdi-datasets/get.raml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ types:
Sum of the sizes of all the files uploaded for this dataset.
type: integer
format: int64
required: true
created:
displayName: Creation Timestamp
description: Timestamp of the creation of this dataset.
type: datetime
required: true
4 changes: 4 additions & 0 deletions modules/rest-service/schema/library.raml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ types:
Sum of the sizes of all the files uploaded for this dataset.
type: integer
format: int64
created:
displayName: Creation Timestamp
description: Timestamp of the creation of this dataset.
type: datetime
DatasetPostRequest:
displayName: Dataset Post Request
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public class DatasetDetailsImpl implements DatasetDetails {
@JsonProperty("files")
private List<FileSummary> files;

@JsonProperty("created")
@JsonFormat(
shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
)
@JsonDeserialize(
using = TimestampDeserializer.class
)
@JsonProperty("created")
private Date created;

@JsonProperty("datasetID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Date;
import java.util.List;

@JsonDeserialize(
Expand Down Expand Up @@ -91,4 +92,10 @@ public interface DatasetListEntry {

@JsonProperty("fileSizeTotal")
void setFileSizeTotal(Long fileSizeTotal);

@JsonProperty("created")
Date getCreated();

@JsonProperty("created")
void setCreated(Date created);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package org.veupathdb.service.vdi.generated.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Date;
import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
Expand All @@ -20,7 +23,8 @@
"status",
"shares",
"fileCount",
"fileSizeTotal"
"fileSizeTotal",
"created"
})
public class DatasetListEntryImpl implements DatasetListEntry {
@JsonProperty("datasetID")
Expand Down Expand Up @@ -65,6 +69,16 @@ public class DatasetListEntryImpl implements DatasetListEntry {
@JsonProperty("fileSizeTotal")
private Long fileSizeTotal;

@JsonProperty("created")
@JsonFormat(
shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
)
@JsonDeserialize(
using = TimestampDeserializer.class
)
private Date created;

@JsonProperty("datasetID")
public String getDatasetID() {
return this.datasetID;
Expand Down Expand Up @@ -204,4 +218,14 @@ public Long getFileSizeTotal() {
public void setFileSizeTotal(Long fileSizeTotal) {
this.fileSizeTotal = fileSizeTotal;
}

@JsonProperty("created")
public Date getCreated() {
return this.created;
}

@JsonProperty("created")
public void setCreated(Date created) {
this.created = created;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import org.veupathdb.vdi.lib.db.cache.model.DatasetFileSummary
import org.veupathdb.vdi.lib.db.cache.model.DatasetListQuery
import org.veupathdb.vdi.lib.db.cache.model.DatasetRecord
import org.veupathdb.vdi.lib.handler.mapping.PluginHandlers
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.collections.HashSet

fun fetchUserDatasetList(query: DatasetListQuery): List<DatasetListEntry> {
return fetchDatasetList(CacheDB.selectDatasetList(query))
Expand Down Expand Up @@ -123,4 +127,5 @@ private fun DatasetRecord.toListEntry(
out.shares = shares
out.fileCount = fileSummary.count.toInt()
out.fileSizeTotal = fileSummary.size.toLong()
out.created = Date.from(created.toInstant())
}
9 changes: 5 additions & 4 deletions modules/rest-service/src/main/resources/api.html

Large diffs are not rendered by default.

0 comments on commit e7fc405

Please sign in to comment.