Skip to content

Commit

Permalink
feat: use dto in getversion
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbrache committed Sep 12, 2024
2 parents b95e1c6 + add720a commit 2eb3a18
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand All @@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand All @@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand All @@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand All @@ -101,7 +101,7 @@ jobs:
os: [windows-2019, windows-2022, ubuntu-22.04, ubuntu-20.04]
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/projectsSync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
security-events: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/golang-migrate/migrate/v4 v4.18.1
github.com/gorilla/websocket v1.5.3
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jackc/pgx/v5 v5.7.0
github.com/jackc/pgx/v5 v5.7.1
github.com/prometheus/client_golang v1.20.3
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
Expand All @@ -29,6 +29,7 @@ require (
require (
github.com/klauspost/compress v1.17.9 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
golang.org/x/mod v0.21.0 // indirect
)

require (
Expand All @@ -54,7 +55,7 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -69,7 +70,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
Expand All @@ -86,7 +87,7 @@ require (
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.0 h1:FG6VLIdzvAPhnYqP14sQ2xhFLkiUQHCs6ySqO91kF4g=
github.com/jackc/pgx/v5 v5.7.0/go.mod h1:awP1KNnjylvpxHuHP63gzjhnGkI1iw+PMoIwvoleN/8=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs=
github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down Expand Up @@ -167,8 +167,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0 h1:jmQTwkHWocY4PMemtpxh4hnB87GNMXyESYmX83JqtFw=
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.14.0/go.mod h1:LyY8fOvYBt5gawHYuivROR7EBySRuSR0u/k8QosnCeU=
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0 h1:ySOGxNA252aNikQvTr213aCgWQ3bouJhCLGjF+CNQt4=
github.com/open-amt-cloud-toolkit/go-wsman-messages/v2 v2.15.0/go.mod h1:LyY8fOvYBt5gawHYuivROR7EBySRuSR0u/k8QosnCeU=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
Expand Down Expand Up @@ -278,8 +278,8 @@ golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/http/v1/domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ func TestDomainRoutes(t *testing.T) {
expectedCode: http.StatusBadRequest,
},
{
name: "insert domain validation - failed",
name: "insert domain validation - failed",
method: http.MethodPost,
url: "/api/v1/admin/domains",
url: "/api/v1/admin/domains",
mock: func(domain *MockDomainsFeature) {
domain400Test := &dtov1.Domain{ProfileName: "p1", TenantID: "t1", DomainSuffix: "domain1.com", ProvisioningCert: "cert1", ProvisioningCertStorageFormat: "string1"}
domain.EXPECT().Insert(context.Background(), domain400Test).Return(nil, domains.ErrDatabase)
Expand Down
14 changes: 0 additions & 14 deletions internal/entity/dto/v1/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,3 @@ type AuditLog struct {
TotalCount int `json:"totalCnt" binding:"required" example:"0"`
Records []auditlog.AuditLogRecord `json:"records" binding:"required"`
}

// type AuditLogRecord struct {
// AuditAppID int `json:"AuditAppId" binding:"required" example:"0"`
// EventID int `json:"EventId" binding:"required" example:"0"`
// InitiatorType int `json:"InitiatorType" binding:"required" example:"0"`
// AuditApp string `json:"AuditApp" binding:"required" example:"MikeIsAmazing"`
// Event string `json:"Event" binding:"required" example:"MikeIsAmazing"`
// Initiator string `json:"Initiator" binding:"required" example:"MikeIsAmazing"`
// Time time.Time `json:"Time" binding:"required" example:"MikeIsAmazing"`
// MCLocationType int `json:"MCLocationType" binding:"required" example:"0"`
// NetAddress string `json:"NetAddress" binding:"required" example:"MikeIsAmazing"`
// Ex string `json:"Ex" binding:"required" example:"MikeIsAmazing"`
// ExStr string `json:"ExStr" binding:"required" example:"MikeIsAmazing"`
// }
2 changes: 1 addition & 1 deletion internal/entity/dto/v1/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Device struct {
LastSeen *time.Time `json:"lastSeen,omitempty"`
LastDisconnected *time.Time `json:"lastDisconnected,omitempty"`
DeviceInfo *DeviceInfo `json:"deviceInfo,omitempty"`
Username string `json:"username"`
Username string `json:"username" binding:"max=16"`
Password string `json:"password"`
UseTLS bool `json:"useTLS"`
AllowSelfSigned bool `json:"allowSelfSigned"`
Expand Down
2 changes: 1 addition & 1 deletion internal/usecase/devices/connections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
gomock "go.uber.org/mock/gomock"

"github.com/open-amt-cloud-toolkit/console/internal/entity"
"github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
devices "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices"
"github.com/open-amt-cloud-toolkit/console/pkg/logger"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/usecase/devices/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
dtov2 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v2"
)

func (uc *UseCase) GetVersion(c context.Context, guid string) (dtov1.Version, dtov2.Version, error) {
func (uc *UseCase) GetVersion(c context.Context, guid string) (v1 dtov1.Version, v2 dtov2.Version, err error) {
item, err := uc.GetByID(c, guid, "")
if err != nil {
return dtov1.Version{}, dtov2.Version{}, err
Expand Down
2 changes: 1 addition & 1 deletion internal/usecase/devices/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package devices
import (
"context"

"github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
"github.com/open-amt-cloud-toolkit/console/internal/usecase/devices/wsman"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/usecase/devices/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
gomock "go.uber.org/mock/gomock"

"github.com/open-amt-cloud-toolkit/console/internal/entity"
"github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
dtov1 "github.com/open-amt-cloud-toolkit/console/internal/entity/dto/v1"
devices "github.com/open-amt-cloud-toolkit/console/internal/usecase/devices"
"github.com/open-amt-cloud-toolkit/console/internal/usecase/devices/wsman"
"github.com/open-amt-cloud-toolkit/console/pkg/logger"
Expand Down

0 comments on commit 2eb3a18

Please sign in to comment.