Skip to content

Commit

Permalink
Update ConvertToDTO method to public to fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Lindsey Cheng <beckysocute@gmail.com>
  • Loading branch information
lindseysimple committed Nov 15, 2023
1 parent 12bb94b commit b667204
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions central/xlsx/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func newDeviceXlsx(file io.Reader) (Converter[[]*dtos.Device], error) {
}, nil
}

// convertToDTO parses the Devices sheet and convert the rows to Device DTOs
func (deviceXlsx *deviceXlsx) convertToDTO() error {
// ConvertToDTO parses the Devices sheet and convert the rows to Device DTOs
func (deviceXlsx *deviceXlsx) ConvertToDTO() error {
allSheetNames := deviceXlsx.xlsFile.GetSheetList()

err := checkRequiredSheets(allSheetNames, requiredSheets)
Expand Down
2 changes: 1 addition & 1 deletion central/xlsx/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func Test_convertToDTO(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, deviceX)

err = deviceX.convertToDTO()
err = deviceX.ConvertToDTO()
require.NoError(t, err)

devices := deviceX.GetDTOs()
Expand Down
4 changes: 2 additions & 2 deletions central/xlsx/deviceprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func newDeviceProfileXlsx(file io.Reader) (Converter[*dtos.DeviceProfile], error
}, nil
}

// convertToDTO parses the Devices sheet and convert the rows to Device DTOs
func (dpXlsx *deviceProfileXlsx) convertToDTO() error {
// ConvertToDTO parses the DeviceInfo/DeviceResource/DeviceCommand sheets and convert the rows to DeviceProfile DTO
func (dpXlsx *deviceProfileXlsx) ConvertToDTO() error {
allSheetNames := dpXlsx.xlsFile.GetSheetList()

err := checkRequiredSheets(allSheetNames, requiredProfileSheets)
Expand Down
4 changes: 2 additions & 2 deletions central/xlsx/deviceprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func Test_DeviceProfile_convertToDTO_InvalidSheets(t *testing.T) {
require.NoError(t, err)
defer dpX.(*deviceProfileXlsx).xlsFile.Close()

err = dpX.convertToDTO()
err = dpX.ConvertToDTO()
require.Error(t, err, "Expected required worksheet not defined error not occurred")
}

Expand Down Expand Up @@ -153,7 +153,7 @@ func Test_deviceProfileXlsx_convertToDTO(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, dpX)

err = dpX.convertToDTO()
err = dpX.ConvertToDTO()
require.NoError(t, err)

deviceProfile := dpX.GetDTOs()
Expand Down
2 changes: 1 addition & 1 deletion central/xlsx/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type AllowedDTOTypes interface {

type Converter[T AllowedDTOTypes] interface {
// ConvertToDTO parses the xlsx file content to DTOs
convertToDTO() error
ConvertToDTO() error
// GetDTOs returns the coverted DTOs
GetDTOs() T
// GetValidateErrors returns the deviceName-validationError key-value map while parsing the excel data rows to DTOs
Expand Down
4 changes: 2 additions & 2 deletions central/xlsx/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func ConvertDeviceXlsx(file io.Reader) (Converter[[]*dtos.Device], error) {
return nil, fmt.Errorf("failed to create deviceXlsx instance: %w", err)
}

err = deviceX.convertToDTO()
err = deviceX.ConvertToDTO()
if err != nil {
return nil, err
}
Expand All @@ -36,7 +36,7 @@ func ConvertDeviceProfileXlsx(file io.Reader) (Converter[*dtos.DeviceProfile], e
return nil, fmt.Errorf("failed to create deviceProfileXlsx instance: %w", err)
}

err = deviceProfileX.convertToDTO()
err = deviceProfileX.ConvertToDTO()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b667204

Please sign in to comment.