chore: build
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/omnex/control-plane/api/internal/auth"
|
||||
"github.com/omnex/control-plane/api/internal/demos"
|
||||
)
|
||||
|
||||
@@ -65,6 +66,8 @@ type CreateInput struct {
|
||||
AdminUsername string
|
||||
AdminPassword string
|
||||
AdminNumber int // 0 => DefaultAdminNumber
|
||||
// OwnerUsername : compte client propriétaire (voir Request), facultatif.
|
||||
OwnerUsername string
|
||||
}
|
||||
|
||||
// Validate normalise et valide la saisie.
|
||||
@@ -141,6 +144,7 @@ func (s *Service) Create(in CreateInput) (Project, error) {
|
||||
URL: "https://" + host,
|
||||
AdminUsername: in.AdminUsername,
|
||||
AdminNumber: in.AdminNumber,
|
||||
OwnerUsername: auth.NormalizeUsername(in.OwnerUsername),
|
||||
MonthsPurchased: in.Months,
|
||||
CreatedAt: now,
|
||||
ExpiresAt: expires,
|
||||
@@ -190,6 +194,22 @@ func (s *Service) Get(id string) (Project, error) {
|
||||
|
||||
func (s *Service) List() ([]Project, error) { return s.store.List() }
|
||||
|
||||
// ListForOwner : sites du client (hors supprimés), du plus récent au plus ancien.
|
||||
func (s *Service) ListForOwner(username string) ([]Project, error) {
|
||||
username = auth.NormalizeUsername(username)
|
||||
all, err := s.store.List()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := []Project{}
|
||||
for _, p := range all {
|
||||
if p.OwnerUsername == username && p.Status != StatusDeleted {
|
||||
out = append(out, p)
|
||||
}
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// State : état live des composants du projet (phase + CPU/mémoire). Un projet
|
||||
// qui n'a pas (ou plus) de pods (échec, suppression) renvoie un état vide sans
|
||||
// interroger le cluster.
|
||||
|
||||
Reference in New Issue
Block a user