Skip to content

Commit

Permalink
List Portfolios + Incomplete Uploads API interface (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdubs authored Nov 17, 2023
1 parent 6ffdbda commit 5991f5c
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/server/pactasrv/portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ func (s *Server) ParsePortfolio(ctx context.Context, req api.ParsePortfolioReque
TaskId: string(taskID),
}, nil
}

// (GET /portfolios)

func (s *Server) ListPortfolios(ctx context.Context, request api.ListPortfoliosRequestObject) (api.ListPortfoliosResponseObject, error) {
return nil, oapierr.NotImplemented("not implemented")
}
11 changes: 8 additions & 3 deletions cmd/server/pactasrv/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ package pactasrv

import (
"context"
"fmt"

"github.com/RMI/pacta/oapierr"
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")
return nil, oapierr.NotImplemented("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")
return nil, oapierr.NotImplemented("not implemented")
}

// (GET /incomplete-uploads)
func (s *Server) ListIncompleteUploads(ctx context.Context, request api.ListIncompleteUploadsRequestObject) (api.ListIncompleteUploadsResponseObject, error) {
return nil, oapierr.NotImplemented("not implemented")
}
137 changes: 137 additions & 0 deletions openapi/pacta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,40 @@ paths:
responses:
'204':
description: the relationship changes were applied successfully
/incomplete-uploads:
get:
description: Gets the incomplete uploads that the user is the owner of
operationId: listIncompleteUploads
requestBody:
description: A request describing the incomplete uploads to return
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ListIncompleteUploadsReq'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListIncompleteUploadsResp'
/portfolios:
get:
description: Gets the list of portfolios that the user is the owner of
operationId: listPortfolios
requestBody:
description: A request describing the portfolios to return
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ListPortfoliosReq'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListPortfoliosResp'
/user/me:
get:
description: Returns the logged in user, if the user is logged in, otherwise returns empty
Expand Down Expand Up @@ -944,6 +978,109 @@ components:
analysis_id:
type: string
description: The analysis id to track for the parsing task.
HoldingsDate:
type: object
required:
- time
properties:
time:
type: string
format: date-time
description: The time at which the holdings are represented at
IncompleteUpload:
type: object
required:
- id
- name
- description
- createdAt
- adminDebugEnabled
properties:
id:
type: string # Assuming IncompleteUploadID is a string, otherwise define its structure
description: Unique identifier for the incomplete upload
name:
type: string
description: Name of the upload
description:
type: string
description: Description of the upload
holdingsDate:
$ref: '#/components/schemas/HoldingsDate'
createdAt:
type: string
format: date-time
description: The time when the upload was created
ranAt:
type: string
format: date-time
description: The time when the upload process was run
completedAt:
type: string
format: date-time
description: The time when the upload was completed
failureCode:
type: string
description: Code describing the failure, if any
failureMessage:
type: string
description: Message describing the failure, if any
adminDebugEnabled:
type: boolean
description: Flag to indicate whether admin debug mode is enabled
Portfolio:
type: object
required:
- id
- name
- description
- createdAt
- adminDebugEnabled
- numberOfRows
properties:
id:
type: string
description: the system assigned unique identifier of the portfolio
name:
type: string
description: the human meaningful name of the portfolio
description:
type: string
description: Additional information about the portfolio
createdAt:
type: string
format: date-time
description: The time at which this portfolio was successfully parsed from a raw
holdingsDate:
$ref: '#/components/schemas/HoldingsDate'
adminDebugEnabled:
type: boolean
description: Whether the admin debug mode is enabled for this portfolio
numberOfRows:
type: integer
description: The number of rows in the portfolio
ListIncompleteUploadsReq:
type: object
ListIncompleteUploadsResp:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/IncompleteUpload'
ListPortfoliosReq:
type: object
ListPortfoliosResp:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/Portfolio'
ParsePortfolioReq:
type: object
required:
Expand Down

0 comments on commit 5991f5c

Please sign in to comment.