Skip to content

Commit

Permalink
feat(api): make baseChildren available for parents
Browse files Browse the repository at this point in the history
  • Loading branch information
ook37 committed Jan 19, 2025
1 parent 5ef2695 commit 20dece3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/src/types/package-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default interface PackageInfo {
packageBase: string
baseIndex: int
baseTotal: int
baseChildren: string[]
description: string
version: string
sourceVersion: string
Expand Down
7 changes: 7 additions & 0 deletions server/types/pac/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Script struct {
PackageBase string `json:"packageBase"`
BaseIndex int `json:"baseIndex"`
BaseTotal int `json:"baseTotal"`
BaseChildren []string `json:"baseChildren"`
Description string `json:"description"`
Version string `json:"version"`
SourceVersion string `json:"sourceVersion"`
Expand Down Expand Up @@ -106,12 +107,17 @@ func (p *Script) Type() types.PackageTypeName {
func FromSrcInfo(info srcinfo.Srcinfo) []*Script {
var scripts []*Script
if len(info.Packages) > 1 {
children := make([]string, len(info.Packages))
for i, pkg := range info.Packages {
children[i] = pkg.Pkgname
}
scripts = append(scripts, &Script{
PackageName: info.Pkgbase,
PrettyName: "",
PackageBase: info.Pkgbase,
BaseIndex: 0,
BaseTotal: len(info.Packages),
BaseChildren: children,
Description: info.Pkgdesc,
Version: info.Version(),
SourceVersion: info.Pkgver,
Expand Down Expand Up @@ -163,6 +169,7 @@ func FromSrcInfo(info srcinfo.Srcinfo) []*Script {
PackageBase: info.Pkgbase,
BaseIndex: i + 1,
BaseTotal: len(info.Packages),
BaseChildren: nil,
Description: fallback[string, string](pkg.Pkgdesc, info.Pkgdesc, nil),
Version: info.Version(),
SourceVersion: info.Pkgver,
Expand Down

0 comments on commit 20dece3

Please sign in to comment.