feat: it works
This commit is contained in:
parent
6302dd62d6
commit
778d5ef146
25 changed files with 638 additions and 106 deletions
27
internal/repository/satellites.go
Normal file
27
internal/repository/satellites.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"git.intra.yksa.space/gsn/gsn-proxy/internal/pkg/ds"
|
||||
"git.intra.yksa.space/gsn/gsn-proxy/internal/pkg/errcodes"
|
||||
)
|
||||
|
||||
func (r *Repository) GetSatellites(ctx context.Context) ([]ds.Satellite, error) {
|
||||
satellites, err := r.queries.GetSatellites(ctx)
|
||||
if err != nil {
|
||||
return nil, errcodes.New(http.StatusInternalServerError, "failed to get satellites", err.Error())
|
||||
}
|
||||
|
||||
ret := make([]ds.Satellite, 0, len(satellites))
|
||||
for _, val := range satellites {
|
||||
ret = append(ret, ds.Satellite{
|
||||
ID: PGToUUID(val.ID),
|
||||
DisplayName: val.DisplayName,
|
||||
Status: ds.Status(val.Status),
|
||||
})
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue