-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pfs-116 FE only for downloading a report #3
Conversation
5018f15
to
9f111f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This form is meant to select a report type with parameters, which will then generate the report and return it as a file (presuming CSV), but this doesn't appear to do that. We don't have the API for that yet, but that should be what the mock does, so when we do have a solution, we can just plug it in.
cafb428
to
d5c3010
Compare
internal/api/download.go
Outdated
"net/http" | ||
) | ||
|
||
func (c *ApiClient) Download(ctx Context, reportType string, reportJournalType string, reportScheduleType string, reportAccountType string, reportDebtType string, dateField string, dateFromField string, dateToField string, emailField string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field
is redundant naming here. Also, dateField
needs to be more descriptive to distinguish it from the other date fields.
821da89
to
cfdf923
Compare
import ( | ||
"bytes" | ||
"encoding/json" | ||
"github.com/opg-sirius-finance-admin/internal/model" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you look into this?
internal/api/download.go
Outdated
innerMap := make(map[string]string) | ||
innerMap[reason] = reason | ||
validationErrors[reason] = innerMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
innerMap := make(map[string]string) | |
innerMap[reason] = reason | |
validationErrors[reason] = innerMap | |
validationErrors[reason] = map[string]string{reason: reason} |
internal/api/api_client_test.go
Outdated
) | ||
|
||
type MockClient struct { | ||
DoFunc func(req *http.Request) (*http.Response, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove this field since you aren't using it
) | ||
|
||
type Date struct { | ||
Time time.Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use model.NewDate
in tests instead
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enums will need json un/marshalling functions, otherwise they will be sent across the wire as integers
No description provided.