weldr/upload: no longer reuse the structs from the target package
For serializeation, make our own private structs. The structs in the target package are not exactly the same as the ones used by weldr, so in order to avoid too many compromises, let's just do an explicity translation. As a general principle, we aim to only use private types for serialization and rather translate than reuse for different purposes. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
440a5acb41
commit
61836a7079
3 changed files with 69 additions and 61 deletions
|
|
@ -1,10 +1,11 @@
|
|||
package weldr
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/compose"
|
||||
"sort"
|
||||
)
|
||||
|
||||
type ComposeEntry struct {
|
||||
|
|
@ -17,7 +18,7 @@ type ComposeEntry struct {
|
|||
JobCreated float64 `json:"job_created"`
|
||||
JobStarted float64 `json:"job_started,omitempty"`
|
||||
JobFinished float64 `json:"job_finished,omitempty"`
|
||||
Uploads []UploadResponse `json:"uploads,omitempty"`
|
||||
Uploads []uploadResponse `json:"uploads,omitempty"`
|
||||
}
|
||||
|
||||
func composeToComposeEntry(id uuid.UUID, compose compose.Compose, includeUploads bool) *ComposeEntry {
|
||||
|
|
@ -30,7 +31,7 @@ func composeToComposeEntry(id uuid.UUID, compose compose.Compose, includeUploads
|
|||
composeEntry.QueueStatus = compose.ImageBuilds[0].QueueStatus
|
||||
|
||||
if includeUploads {
|
||||
composeEntry.Uploads = TargetsToUploadResponses(compose.ImageBuilds[0].Targets)
|
||||
composeEntry.Uploads = targetsToUploadResponses(compose.ImageBuilds[0].Targets)
|
||||
}
|
||||
|
||||
switch compose.ImageBuilds[0].QueueStatus {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue