diff --git a/db/migrations/00002_config_sets.sql b/db/migrations/00002_config_sets.sql index cd6a4d1..20d67af 100644 --- a/db/migrations/00002_config_sets.sql +++ b/db/migrations/00002_config_sets.sql @@ -15,7 +15,6 @@ CREATE TABLE public.bios_config_components ( name STRING NOT NULL, vendor STRING NOT NULL, model STRING NOT NULL, - serial STRING NOT NULL, created_at TIMESTAMPTZ NULL, updated_at TIMESTAMPTZ NULL, UNIQUE (fk_bios_config_set_id, name) diff --git a/internal/dbtools/fixtures.go b/internal/dbtools/fixtures.go index 72b33c7..4e3bdae 100644 --- a/internal/dbtools/fixtures.go +++ b/internal/dbtools/fixtures.go @@ -692,13 +692,11 @@ func setupConfigSet(ctx context.Context, db *sqlx.DB) error { { Name: "Fixture Test SM Motherboard", Vendor: "SUPERMICRO", - Serial: "BIOS", Model: "ATX", }, { Name: "Fixture Test Intel Network Adapter", Vendor: "Intel", - Serial: "NIC", Model: "PCIE", }, } diff --git a/internal/models/bios_config_components.go b/internal/models/bios_config_components.go index e88b561..b320aeb 100644 --- a/internal/models/bios_config_components.go +++ b/internal/models/bios_config_components.go @@ -29,7 +29,6 @@ type BiosConfigComponent struct { Name string `boil:"name" json:"name" toml:"name" yaml:"name"` Vendor string `boil:"vendor" json:"vendor" toml:"vendor" yaml:"vendor"` Model string `boil:"model" json:"model" toml:"model" yaml:"model"` - Serial string `boil:"serial" json:"serial" toml:"serial" yaml:"serial"` CreatedAt null.Time `boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty"` UpdatedAt null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"` @@ -43,7 +42,6 @@ var BiosConfigComponentColumns = struct { Name string Vendor string Model string - Serial string CreatedAt string UpdatedAt string }{ @@ -52,7 +50,6 @@ var BiosConfigComponentColumns = struct { Name: "name", Vendor: "vendor", Model: "model", - Serial: "serial", CreatedAt: "created_at", UpdatedAt: "updated_at", } @@ -63,7 +60,6 @@ var BiosConfigComponentTableColumns = struct { Name string Vendor string Model string - Serial string CreatedAt string UpdatedAt string }{ @@ -72,7 +68,6 @@ var BiosConfigComponentTableColumns = struct { Name: "bios_config_components.name", Vendor: "bios_config_components.vendor", Model: "bios_config_components.model", - Serial: "bios_config_components.serial", CreatedAt: "bios_config_components.created_at", UpdatedAt: "bios_config_components.updated_at", } @@ -85,7 +80,6 @@ var BiosConfigComponentWhere = struct { Name whereHelperstring Vendor whereHelperstring Model whereHelperstring - Serial whereHelperstring CreatedAt whereHelpernull_Time UpdatedAt whereHelpernull_Time }{ @@ -94,7 +88,6 @@ var BiosConfigComponentWhere = struct { Name: whereHelperstring{field: "\"bios_config_components\".\"name\""}, Vendor: whereHelperstring{field: "\"bios_config_components\".\"vendor\""}, Model: whereHelperstring{field: "\"bios_config_components\".\"model\""}, - Serial: whereHelperstring{field: "\"bios_config_components\".\"serial\""}, CreatedAt: whereHelpernull_Time{field: "\"bios_config_components\".\"created_at\""}, UpdatedAt: whereHelpernull_Time{field: "\"bios_config_components\".\"updated_at\""}, } @@ -137,8 +130,8 @@ func (r *biosConfigComponentR) GetFKBiosConfigComponentBiosConfigSettings() Bios type biosConfigComponentL struct{} var ( - biosConfigComponentAllColumns = []string{"id", "fk_bios_config_set_id", "name", "vendor", "model", "serial", "created_at", "updated_at"} - biosConfigComponentColumnsWithoutDefault = []string{"fk_bios_config_set_id", "name", "vendor", "model", "serial"} + biosConfigComponentAllColumns = []string{"id", "fk_bios_config_set_id", "name", "vendor", "model", "created_at", "updated_at"} + biosConfigComponentColumnsWithoutDefault = []string{"fk_bios_config_set_id", "name", "vendor", "model"} biosConfigComponentColumnsWithDefault = []string{"id", "created_at", "updated_at"} biosConfigComponentPrimaryKeyColumns = []string{"id"} biosConfigComponentGeneratedColumns = []string{} diff --git a/internal/models/bios_config_components_test.go b/internal/models/bios_config_components_test.go index e0319cb..86867f5 100644 --- a/internal/models/bios_config_components_test.go +++ b/internal/models/bios_config_components_test.go @@ -888,7 +888,7 @@ func testBiosConfigComponentsSelect(t *testing.T) { } var ( - biosConfigComponentDBTypes = map[string]string{`ID`: `uuid`, `FKBiosConfigSetID`: `uuid`, `Name`: `string`, `Vendor`: `string`, `Model`: `string`, `Serial`: `string`, `CreatedAt`: `timestamptz`, `UpdatedAt`: `timestamptz`} + biosConfigComponentDBTypes = map[string]string{`ID`: `uuid`, `FKBiosConfigSetID`: `uuid`, `Name`: `string`, `Vendor`: `string`, `Model`: `string`, `CreatedAt`: `timestamptz`, `UpdatedAt`: `timestamptz`} _ = bytes.MinRead ) diff --git a/pkg/api/v1/bios_config_component.go b/pkg/api/v1/bios_config_component.go index 3ffa06b..f8fb533 100644 --- a/pkg/api/v1/bios_config_component.go +++ b/pkg/api/v1/bios_config_component.go @@ -12,7 +12,6 @@ type BiosConfigComponent struct { Name string `json:"name" binding:"required"` Vendor string `json:"vendor"` Model string `json:"model"` - Serial string `json:"serial"` Settings []BiosConfigSetting `json:"settings" binding:"required"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` @@ -23,7 +22,6 @@ func (cc *BiosConfigComponent) toDBModelBiosConfigComponent() *models.BiosConfig Name: cc.Name, Vendor: cc.Vendor, Model: cc.Model, - Serial: cc.Serial, } return dbcc @@ -35,7 +33,6 @@ func (cc *BiosConfigComponent) fromDBModelBiosConfigComponent(component *models. cc.Name = component.Name cc.Vendor = component.Vendor cc.Model = component.Model - cc.Serial = component.Serial cc.CreatedAt = component.CreatedAt.Time cc.UpdatedAt = component.CreatedAt.Time diff --git a/pkg/api/v1/bios_config_component_params.go b/pkg/api/v1/bios_config_component_params.go index 61b73e5..6c25723 100644 --- a/pkg/api/v1/bios_config_component_params.go +++ b/pkg/api/v1/bios_config_component_params.go @@ -11,7 +11,6 @@ type BiosConfigComponentQuery struct { Name string `query:"name"` Vendor string `query:"vendor"` Model string `query:"model"` - Serial string `query:"serial"` Settings []BiosConfigSettingQuery `query:"settings"` } @@ -22,7 +21,6 @@ func (cc *BiosConfigComponentQuery) queryMods(comparitor OperatorComparitorType) mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Name, cc.Name) mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Vendor, cc.Vendor) mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Model, cc.Model) - mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Serial, cc.Serial) mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Vendor, cc.Vendor) for i := range cc.Settings { diff --git a/pkg/api/v1/bios_config_set_test.go b/pkg/api/v1/bios_config_set_test.go index 59cb0b6..11bb98e 100644 --- a/pkg/api/v1/bios_config_set_test.go +++ b/pkg/api/v1/bios_config_set_test.go @@ -20,7 +20,6 @@ var BiosConfigSetTest fleetdbapi.BiosConfigSet = fleetdbapi.BiosConfigSet{ { Name: "SM Motherboard", Vendor: "SUPERMICRO", - Serial: "BIOS", Model: "ATX", Settings: []fleetdbapi.BiosConfigSetting{ { @@ -36,22 +35,21 @@ var BiosConfigSetTest fleetdbapi.BiosConfigSet = fleetdbapi.BiosConfigSet{ { Name: "Intel Network Adapter", Vendor: "Intel", - Serial: "NIC", Model: "PCIE", Settings: []fleetdbapi.BiosConfigSetting{ { - Key: "PXEEnable", - Value: "true", - Raw: []byte(`{}`), + Key: "PXEEnable", + Value: "true", + Raw: []byte(`{}`), }, { Key: "SRIOVEnable", Value: "false", }, { - Key: "position", - Value: "1", - Raw: []byte(`{ "lanes": 8 }`), + Key: "position", + Value: "1", + Raw: []byte(`{ "lanes": 8 }`), }, }, }, diff --git a/pkg/api/v1/router_bios_config_set_test.go b/pkg/api/v1/router_bios_config_set_test.go index 9e233ae..1db2dd2 100644 --- a/pkg/api/v1/router_bios_config_set_test.go +++ b/pkg/api/v1/router_bios_config_set_test.go @@ -42,11 +42,11 @@ func TestIntegrationServerBiosConfigSetCreate(t *testing.T) { }) var testCases = []struct { - testName string + testName string BiosConfigSetName string BiosConfigSetID string - expectedError bool - msgs []string + expectedError bool + msgs []string }{ { "config set router: config set create; success", @@ -134,7 +134,7 @@ func TestIntegrationServerBiosConfigSetGet(t *testing.T) { var testCases = []struct { testName string - BiosConfigSetID string + BiosConfigSetID string expectedError bool expectedResponse string msg string @@ -219,7 +219,7 @@ func TestIntegrationServerBiosConfigSetDelete(t *testing.T) { var testCases = []struct { testName string - BiosConfigSetID string + BiosConfigSetID string expectedError bool expectedResponse string msg string @@ -318,7 +318,7 @@ func TestIntegrationServerBiosConfigSetUpdate(t *testing.T) { var testCases = []struct { testName string - BiosConfigSetID string + BiosConfigSetID string expectedError bool expectedResponse string msg string @@ -638,7 +638,6 @@ func assertBiosConfigComponentEqual(t *testing.T, expected *models.BiosConfigCom assert.Equal(t, expected.Name, actual.Name) assert.Equal(t, expected.Vendor, actual.Vendor) assert.Equal(t, expected.Model, actual.Model) - assert.Equal(t, expected.Serial, actual.Serial) assert.WithinDuration(t, expected.CreatedAt.Time, actual.CreatedAt, time.Second) assert.WithinDuration(t, expected.UpdatedAt.Time, actual.UpdatedAt, time.Second)