Seed provenance + inventory: source links and seed lots (#50) (#64)
Build image / build-and-push (push) Successful in 8s
Build image / build-and-push (push) Successful in 8s
Co-authored-by: Steve Dudenhoeffer <[email protected]>
This commit was merged in pull request #64.
This commit is contained in:
@@ -22,12 +22,13 @@ type plantingCreateRequest struct {
|
||||
Count *int `json:"count"`
|
||||
Label *string `json:"label"`
|
||||
PlantedAt *string `json:"plantedAt"`
|
||||
SeedLotID *int64 `json:"seedLotId"`
|
||||
}
|
||||
|
||||
func (r plantingCreateRequest) toInput() service.PlantingInput {
|
||||
return service.PlantingInput{
|
||||
PlantID: r.PlantID, XCM: r.XCM, YCM: r.YCM, RadiusCM: r.RadiusCM,
|
||||
Count: r.Count, Label: r.Label, PlantedAt: r.PlantedAt,
|
||||
Count: r.Count, Label: r.Label, PlantedAt: r.PlantedAt, SeedLotID: r.SeedLotID,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +46,7 @@ type plantingUpdateRequest struct {
|
||||
Label json.RawMessage `json:"label"`
|
||||
PlantedAt json.RawMessage `json:"plantedAt"`
|
||||
RemovedAt json.RawMessage `json:"removedAt"`
|
||||
SeedLotID json.RawMessage `json:"seedLotId"`
|
||||
Version int64 `json:"version" binding:"required,min=1"`
|
||||
}
|
||||
|
||||
@@ -61,6 +63,10 @@ func (r plantingUpdateRequest) toPatch() (service.PlantingPatch, error) {
|
||||
if err != nil {
|
||||
return service.PlantingPatch{}, err
|
||||
}
|
||||
seedLot, setSeedLot, err := parseNullable[int64](r.SeedLotID)
|
||||
if err != nil {
|
||||
return service.PlantingPatch{}, err
|
||||
}
|
||||
removedAt, setRemovedAt, err := parseNullableString(r.RemovedAt)
|
||||
if err != nil {
|
||||
return service.PlantingPatch{}, err
|
||||
@@ -71,6 +77,7 @@ func (r plantingUpdateRequest) toPatch() (service.PlantingPatch, error) {
|
||||
SetLabel: setLabel, Label: label,
|
||||
SetPlantedAt: setPlantedAt, PlantedAt: plantedAt,
|
||||
SetRemovedAt: setRemovedAt, RemovedAt: removedAt,
|
||||
SetSeedLotID: setSeedLot, SeedLotID: seedLot,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user