Open aldy505 opened 1 year ago
btw, I think this return should be non-array status-history
'cuz. when we see the response sample of the StatusHistory
and the Struct of it. its just history that given the array to the response.
{
"reference_number": "string",
"air_waybill": "string",
"history": [
{
"status_code": 1,
"status_description": "ORDER_PLACED",
"timestamp": "2023-01-01T00:00:00Z",
"note": "string"
}
]
}
I found this issue while I tried to handle the presentation-layer.
btw, I think this return should be non-array status-history
'cuz. when we see the response sample of the
StatusHistory
and the Struct of it. its just history that given the array to the response.{ "reference_number": "string", "air_waybill": "string", "history": [ { "status_code": 1, "status_description": "ORDER_PLACED", "timestamp": "2023-01-01T00:00:00Z", "note": "string" } ] }
I found this issue while I tried to handle the presentation-layer.
Oh you're right. You can change that one.
I think the shipping.Estimate()
should return an array of EstimateResult
with included Provider
, because in the presentation we expect array of Estimation
to be returned as response
we've already discussed this btw. but yes, you're right
we've already discussed this btw. but yes, you're right
you are discussed about StatusHistory
😅
nope, we discuss it on private chat a few days ago.
here's the actual how the interface
looks like
Again, should we change the request method for /status-history
into POST
?
Because the StatusRequest
struct in the package business
requires some fields
https://github.com/TokoBapak/mock-shipping-provider/blob/68058d64cc9b8f7db73478fd0a1392055c5c8d45/business/shipping.go#L65-L68
Again, should we change the request method for
/status-history
intoPOST
? Because theStatusRequest
struct in the packagebusiness
requires some fields
What you're specifying is business layer, it's not the same as presentation layer. Remember, the business layer does not care about what happens on the presentation layer. Presentation layer can get the values from the URL parameters. Nothing's wrong with that.
so, what's the StatusRequest
used for?
Where can we get the required data? is it from the query parameters?
Unit tests can come later when the repository tests are finished. But you can try and execute the function that are defined by the repository interface.
https://github.com/TokoBapak/mock-shipping-provider/blob/413bb3e6abb6362ced4b4bdc42173c1c82f6065d/business/shipping/shipping.go#L17-L32
Interface definition:
https://github.com/TokoBapak/mock-shipping-provider/blob/68058d64cc9b8f7db73478fd0a1392055c5c8d45/business/shipping.go#L11-L24
The background worker on the
Create
function is a simple goroutine that is managed by atime.Sleep
. So basically it goes like this:The example above can be wrong. Please test your function accordingly.