Merge branch 'feature/new-networks-concept' into add-networks-db-support

This commit is contained in:
bcmmbaga
2024-12-10 10:59:28 +01:00

View File

@ -26,11 +26,13 @@ type NetworkResource struct {
ID string `gorm:"index"` ID string `gorm:"index"`
NetworkID string `gorm:"index"` NetworkID string `gorm:"index"`
AccountID string `gorm:"index"` AccountID string `gorm:"index"`
Name string
Description string
Type NetworkResourceType Type NetworkResourceType
Address string Address string
} }
func NewNetworkResource(accountID, networkID, address string) (*NetworkResource, error) { func NewNetworkResource(accountID, networkID, name, description, address string) (*NetworkResource, error) {
resourceType, err := getResourceType(address) resourceType, err := getResourceType(address)
if err != nil { if err != nil {
return nil, fmt.Errorf("invalid address: %w", err) return nil, fmt.Errorf("invalid address: %w", err)
@ -40,6 +42,8 @@ func NewNetworkResource(accountID, networkID, address string) (*NetworkResource,
ID: xid.New().String(), ID: xid.New().String(),
AccountID: accountID, AccountID: accountID,
NetworkID: networkID, NetworkID: networkID,
Name: name,
Description: description,
Type: resourceType, Type: resourceType,
Address: address, Address: address,
}, nil }, nil