Skip to content

Commit

Permalink
created and updated times added to job response
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDieckmann committed May 11, 2021
1 parent cdebe2b commit e9babbb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions endpoints/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import (
"fmt"
"log"
"os"
"time"

"github.com/ag-computational-bio/bakta-web-api-go/api"
"github.com/ag-computational-bio/bakta-web-backend/objectStorage"
"google.golang.org/protobuf/types/known/structpb"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/ag-computational-bio/bakta-web-backend/database"
"github.com/ag-computational-bio/bakta-web-backend/scheduler"
Expand Down Expand Up @@ -125,9 +127,14 @@ func (apiHandler *BaktaJobAPI) GetJobsStatus(ctx context.Context, request *api.J

statusEnum := api.JobStatusEnum(statusNumber)

created_time := timestamppb.New(time.Unix(job.Created, 0))
updated_time := timestamppb.New(time.Unix(job.Updated, 0))

statusResponse := api.JobStatusResponse{
JobID: job.JobID,
JobStatus: statusEnum,
Started: created_time,
Updated: updated_time,
}

jobsStatus = append(jobsStatus, &statusResponse)
Expand Down Expand Up @@ -173,9 +180,14 @@ func (apiHandler *BaktaJobAPI) GetJobResult(ctx context.Context, request *api.Jo
return nil, err
}

created_time := timestamppb.New(time.Unix(job.Created, 0))
updated_time := timestamppb.New(time.Unix(job.Updated, 0))

jobResponse := api.JobResultResponse{
JobID: job.JobID,
ResultFiles: &structData,
Started: created_time,
Updated: updated_time,
}

return &jobResponse, nil
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ module github.com/ag-computational-bio/bakta-web-backend
go 1.16

require (
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210303193734-0c148f9a32b5
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210511164724-debd1af1ed2a
github.com/aws/aws-sdk-go-v2 v1.4.0
github.com/aws/aws-sdk-go-v2/config v1.1.7
github.com/aws/aws-sdk-go-v2/service/s3 v1.6.0
github.com/aws/smithy-go v1.4.0
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210303185402-09d4bb672
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210303185402-09d4bb672f38/go.mod h1:4/KoQvwX2nhcnR2C7jllPBLGsc2ZL/n0vbVgwnP/Xq4=
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210303193734-0c148f9a32b5 h1:IImNFid+Lm6D1oT7zgueQk95TFMlknXicMOyeAeJy5g=
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210303193734-0c148f9a32b5/go.mod h1:1OlDWCwtXP1w0oZ3pLdj7kVL+s0W47Qj45SMsAU+VZA=
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210511164724-debd1af1ed2a h1:KDxR2b5p3Zkgi3K6uRFzl88/LSVzpusQK/4ox1gdisw=
github.com/ag-computational-bio/bakta-web-api-go v0.0.0-20210511164724-debd1af1ed2a/go.mod h1:1OlDWCwtXP1w0oZ3pLdj7kVL+s0W47Qj45SMsAU+VZA=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down

0 comments on commit e9babbb

Please sign in to comment.