add logic to GetModule handler
This commit is contained in:
@@ -16,30 +16,30 @@ type Package struct {
|
||||
}
|
||||
|
||||
type Module struct {
|
||||
ID int64 `db:"id"`
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"` // module name
|
||||
Version string `db:"version"` // module
|
||||
Package int64 `db:"package"`
|
||||
Package uint64 `db:"package"`
|
||||
LastVersion string `db:"last_version"`
|
||||
}
|
||||
|
||||
type Issue struct {
|
||||
ID int64 `db:"id"`
|
||||
Status int64 `db:"status"`
|
||||
ID uint64 `db:"id"`
|
||||
Status uint64 `db:"status"`
|
||||
Desc string `db:"desc"`
|
||||
Package int64 `db:"package"`
|
||||
Modules []int64 `db:"modules"`
|
||||
}
|
||||
|
||||
type Comment struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
ID uint64 `db:"id" json:"id"`
|
||||
Text string `db:"value" json:"text"`
|
||||
Created pgtype.Date `db:"created" json:"created"`
|
||||
Updated pgtype.Date `db:"updated" json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
type Dashboard struct {
|
||||
ID int64 `db:"id"`
|
||||
ID uint64 `db:"id"`
|
||||
Uuid uuid.UUID `db:"uuid"`
|
||||
Packages []int64 `db:"package"`
|
||||
Packages []uint64 `db:"package"`
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
type ListPackage []*Package
|
||||
|
||||
func (l ListPackage) Mapping() []*pb.Package {
|
||||
func (l ListPackage) Decode() []*pb.Package {
|
||||
result := make([]*pb.Package, 0, len(l))
|
||||
|
||||
for i := range l {
|
||||
@@ -24,3 +24,21 @@ func (l ListPackage) Mapping() []*pb.Package {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
type ListModule []*Module
|
||||
|
||||
func (l ListModule) Decode() []*pb.Module {
|
||||
result := make([]*pb.Module, 0, len(l))
|
||||
for i := range l {
|
||||
temp := &pb.Module{
|
||||
Id: l[i].ID,
|
||||
Name: l[i].Name,
|
||||
Version: l[i].Version,
|
||||
LastVersion: l[i].LastVersion,
|
||||
}
|
||||
|
||||
result = append(result, temp)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
Reference in New Issue
Block a user