Skip to content

Commit

Permalink
Addresses Review Comments, Adds Server Stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdubs committed Nov 17, 2023
1 parent 309f3d7 commit cab67c7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
1 change: 1 addition & 0 deletions cmd/server/pactasrv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_library(
"pacta_version.go",
"pactasrv.go",
"portfolio.go",
"upload.go",
"user.go",
],
importpath = "github.com/RMI/pacta/cmd/server/pactasrv",
Expand Down
20 changes: 20 additions & 0 deletions cmd/server/pactasrv/upload.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package pactasrv

import (
"context"
"fmt"

api "github.com/RMI/pacta/openapi/pacta"
)

// Starts the process of uploading one or more portfolio files
// (POST /portfolio-upload)
func (s *Server) StartPortfolioUpload(ctx context.Context, request api.StartPortfolioUploadRequestObject) (api.StartPortfolioUploadResponseObject, error) {
return nil, fmt.Errorf("not implemented")
}

// Called after uploads of portfolios to cloud storage are complete.
// (POST /portfolio-upload:complete)
func (s *Server) CompletePortfolioUpload(ctx context.Context, request api.CompletePortfolioUploadRequestObject) (api.CompletePortfolioUploadResponseObject, error) {
return nil, fmt.Errorf("not implemented")
}
44 changes: 26 additions & 18 deletions openapi/pacta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/NewPortfolioAsset'
/startPortfolioUpload:
/portfolio-upload:
post:
summary: Starts the process of uploading one or more portfolio files
description: Creates one or more new incomplete portfolio uploads, and creates upload URLs for the user to put their blobs into.
Expand All @@ -475,15 +475,15 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/StartPortfolioUploadRequest'
$ref: '#/components/schemas/StartPortfolioUploadReq'
responses:
'200':
description: The assets can now be uploaded via the given signed URLs.
content:
application/json:
schema:
$ref: '#/components/schemas/StartPortfolioUploadResponse'
/completePortfolioUpload:
$ref: '#/components/schemas/StartPortfolioUploadResp'
/portfolio-upload:complete:
post:
summary: Called after uploads of portfolios to cloud storage are complete.
description: Signals that the upload of the portfolios are complete, and that the server should start parsing them.
Expand All @@ -494,14 +494,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/CompletePortfolioUploadRequest'
$ref: '#/components/schemas/CompletePortfolioUploadReq'
responses:
'200':
description: The process to initiate the parsing of the uploads has been initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/CompletePortfolioUploadResponse'
$ref: '#/components/schemas/CompletePortfolioUploadResp'
/test:parsePortfolio:
post:
summary: Test endpoint, triggers a task to parse the portfolio
Expand Down Expand Up @@ -876,33 +876,33 @@ components:
asset_id:
type: string
description: A unique identifier for the uploaded asset
StartPortfolioUploadRequest:
StartPortfolioUploadReq:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/StartPortfolioUploadRequestItem'
StartPortfolioUploadRequestItem:
$ref: '#/components/schemas/StartPortfolioUploadReqItem'
StartPortfolioUploadReqItem:
type: object
required:
- file_name
properties:
file_name:
type: string
description: The name of the file, including its extension.
StartPortfolioUploadResponse:
StartPortfolioUploadResp:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/StartPortfolioUploadResponseItem'
StartPortfolioUploadResponseItem:
$ref: '#/components/schemas/StartPortfolioUploadRespItem'
StartPortfolioUploadRespItem:
type: object
required:
- file_name
Expand All @@ -918,17 +918,25 @@ components:
incomplete_upload_id:
type: string
description: A unique identifier for the uploaded asset
CompletePortfolioUpload:
CompletePortfolioUploadReq:
type: object
required:
- incomplete_upload_ids
- items
properties:
incomplete_upload_ids:
items:
type: array
items:
type: string
description: The incomplete uploads that have been successfully uploaded and are ready for parsing.
CompletePortfolioUpload:
$ref: '#/components/schemas/CompletePortfolioUploadReqItem'
description: The incomplete uploads that have been successfully uploaded to storage and are ready for parsing.
CompletePortfolioUploadReqItem:
type: object
required:
- incomplete_upload_id
properties:
incomplete_upload_id:
type: string
description: The unique identifier for the uploaded asset
CompletePortfolioUploadResp:
type: object
required:
- analysis_id
Expand Down

0 comments on commit cab67c7

Please sign in to comment.