-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore REST all mod versions response contents (#82)
- Loading branch information
1 parent
b9b5358
commit 7cb4de8
Showing
4 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package conversion | ||
|
||
import ( | ||
"github.com/satisfactorymodding/smr-api/generated/ent" | ||
"github.com/satisfactorymodding/smr-api/nodes/types" | ||
) | ||
|
||
// goverter:converter | ||
// goverter:output:file ../generated/conv/version.go | ||
// goverter:output:package conv | ||
// goverter:extend TimeToString UIntToInt Int64ToInt | ||
type ModAllVersions interface { | ||
// goverter:map Edges.Targets Targets | ||
// goverter:map Edges.VersionDependencies Dependencies | ||
Convert(source *ent.Version) *types.ModAllVersionsVersion | ||
ConvertSlice(source []*ent.Version) []*types.ModAllVersionsVersion | ||
|
||
// goverter:map . Link | TargetLink | ||
ConvertTarget(source *ent.VersionTarget) *types.ModAllVersionsVersionTarget | ||
} | ||
|
||
func TargetLink(source *ent.VersionTarget) string { | ||
if source == nil { | ||
return "" | ||
} | ||
return "/v1/version/" + source.VersionID + "/" + source.TargetName + "/download" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package types | ||
|
||
type ModAllVersionsVersion struct { | ||
ID string `json:"id"` | ||
Version string `json:"version"` | ||
GameVersion string `json:"game_version"` | ||
Targets []*ModAllVersionsVersionTarget `json:"targets"` | ||
Dependencies []*ModAllVersionsVersionDependency `json:"dependencies"` | ||
} | ||
|
||
type ModAllVersionsVersionTarget struct { | ||
VersionID string `json:"version_id"` | ||
TargetName string `json:"target_name"` | ||
Link string `json:"link"` | ||
Hash string `json:"hash"` | ||
Size int `json:"size"` | ||
} | ||
|
||
type ModAllVersionsVersionDependency struct { | ||
ModID string `json:"mod_id"` | ||
Condition string `json:"condition"` | ||
Optional bool `json:"optional"` | ||
} |