Skip to content

Commit e591066

Browse files
authored
INTG-1858, INTG-1452 update sqlboiler and all deps, track powertrain, track failed vins (#301)
* update sqlboiler, add table for tracking failed vins, add powertrain * fix nil pointer. track country * improve dat group decoder, return and store the failure vin decoding * set all fields for failed vin * fix issues from signature changes, dat group country hard coded * update tests * update more tests * check db for powertrain first
1 parent b95c5f6 commit e591066

62 files changed

Lines changed: 1864 additions & 1186 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ If brew version does not work, download from https://github.com/golangci/golangc
6161

6262
### Database ORM
6363

64-
This is using [sqlboiler](https://github.com/volatiletech/sqlboiler). The ORM models are code generated. If the db changes,
64+
This is using [sqlboiler](https://github.com/aarondl/sqlboiler). The ORM models are code generated. If the db changes,
6565
you must update the models.
6666

6767
Make sure you have sqlboiler installed:
6868

6969
```bash
70-
go install github.com/volatiletech/sqlboiler/v4@latest
71-
go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
70+
go install github.com/aarondl/sqlboiler/v4@latest
71+
go install github.com/aarondl/sqlboiler/v4/drivers/sqlboiler-psql@latest
7272
```
7373

7474
To generate the models:

cmd/device-definitions-api/add_vin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import (
2222
"github.com/DIMO-Network/shared/pkg/db"
2323
stringutils "github.com/DIMO-Network/shared/pkg/strings"
2424
vinutils "github.com/DIMO-Network/shared/pkg/vin"
25+
"github.com/aarondl/null/v8"
26+
"github.com/aarondl/sqlboiler/v4/boil"
2527
"github.com/google/subcommands"
2628
"github.com/pkg/errors"
2729
"github.com/rs/zerolog"
28-
"github.com/volatiletech/null/v8"
29-
"github.com/volatiletech/sqlboiler/v4/boil"
3030
)
3131

3232
type addVINCmd struct {

cmd/device-definitions-api/decode_vin.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"github.com/DIMO-Network/device-definitions-api/internal/infrastructure/db/models"
1515
"github.com/DIMO-Network/shared/pkg/db"
1616
vinutil "github.com/DIMO-Network/shared/pkg/vin"
17+
"github.com/aarondl/null/v8"
18+
"github.com/aarondl/sqlboiler/v4/boil"
1719
"github.com/ethereum/go-ethereum/ethclient"
18-
"github.com/volatiletech/null/v8"
19-
"github.com/volatiletech/sqlboiler/v4/boil"
2020

2121
"github.com/goccy/go-json"
2222

@@ -116,7 +116,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
116116
vinInfo := &coremodels.VINDecodingInfoData{VIN: vin}
117117

118118
if p.datGroup {
119-
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, coremodels.DATGroupProvider, country)
119+
vinInfo, _, err = vinDecodingService.GetVIN(ctx, vin, coremodels.DATGroupProvider, country)
120120
// use the dat group service to decode
121121
if err != nil {
122122
fmt.Println(err.Error())
@@ -126,7 +126,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
126126
fmt.Printf("\n\nVIN Response: %+v\n", vinInfo)
127127
}
128128
if p.drivly {
129-
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, coremodels.DrivlyProvider, country)
129+
vinInfo, _, err = vinDecodingService.GetVIN(ctx, vin, coremodels.DrivlyProvider, country)
130130
if err != nil {
131131
fmt.Println(err.Error())
132132
continue
@@ -135,23 +135,23 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
135135
fmt.Printf("VIN Response: %+v\n", vinInfo)
136136
}
137137
if p.vincario {
138-
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, coremodels.VincarioProvider, country)
138+
vinInfo, _, err = vinDecodingService.GetVIN(ctx, vin, coremodels.VincarioProvider, country)
139139
if err != nil {
140140
fmt.Println(err.Error())
141141
continue
142142
}
143143
fmt.Printf("VIN Response: %+v\n", vinInfo)
144144
}
145145
if p.carvx {
146-
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, coremodels.CarVXVIN, country)
146+
vinInfo, _, err = vinDecodingService.GetVIN(ctx, vin, coremodels.CarVXVIN, country)
147147
if err != nil {
148148
fmt.Println(err.Error())
149149
continue
150150
}
151151
fmt.Printf("VIN Response: %+v\n", vinInfo)
152152
}
153153
if p.japan17vin {
154-
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, coremodels.Japan17VIN, country)
154+
vinInfo, _, err = vinDecodingService.GetVIN(ctx, vin, coremodels.Japan17VIN, country)
155155
if err != nil {
156156
fmt.Println(err.Error())
157157
continue

cmd/device-definitions-api/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type migrateDBCmd struct {
2323
func (*migrateDBCmd) Name() string { return "migrate" }
2424
func (*migrateDBCmd) Synopsis() string { return "migrate args to stdout." }
2525
func (*migrateDBCmd) Usage() string {
26-
return `migrate [-up-to|-down-to] <some text>:
26+
return `migrate [-up|-down] <some text>:
2727
migrate args.
2828
`
2929
}

0 commit comments

Comments
 (0)