Skip to content

Commit 416042c

Browse files
committed
feat: skip errors during import
1 parent 559ccd1 commit 416042c

9 files changed

Lines changed: 141 additions & 45 deletions

File tree

frontend/package-lock.json

Lines changed: 111 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@angular/platform-browser": "^19.0.0",
2020
"@angular/platform-browser-dynamic": "^19.0.0",
2121
"@angular/router": "^19.0.0",
22-
"@buf/xskydev_go-money-pb.bufbuild_es": "^2.9.0-20250825232136-eed02e2e6afd.1",
22+
"@buf/xskydev_go-money-pb.bufbuild_es": "^2.11.0-20260221154942-deaf287f58ff.1",
2323
"@bufbuild/buf": "^1.54.0",
2424
"@bufbuild/protobuf": "^2.9.0",
2525
"@bufbuild/protoc-gen-es": "^2.9.0",

frontend/src/app/pages/transactions/transactions-import.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626

2727
<p-checkbox id="chkbox4" [(ngModel)]="skipDuplicateReferenceCheck" [binary]="true" />
2828
<label for="chkbox4">Skip Duplicate Reference Check</label>
29+
30+
@if (!stagingMode) {
31+
<p-checkbox id="chkbox5" [(ngModel)]="skipValidationErrors" [binary]="true" />
32+
<label for="chkbox5">Skip Validation Errors</label>
33+
}
2934
</div>
3035
@if (this.isRawTextImport()) {
3136
<p-iftalabel>

frontend/src/app/pages/transactions/transactions-import.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class TransactionsImportComponent {
5151
public skipRules: boolean = false;
5252
public treatDatesAsUtc: boolean = false;
5353
public skipDuplicateReferenceCheck: boolean = false;
54+
public skipValidationErrors: boolean = false;
5455
public isLoading: boolean = false;
5556
public stagingMode: boolean = true;
5657

@@ -180,12 +181,20 @@ export class TransactionsImportComponent {
180181
skipRules: this.skipRules,
181182
treatDatesAsUtc: this.treatDatesAsUtc,
182183
skipDuplicateReferenceCheck: this.skipDuplicateReferenceCheck,
184+
skipValidationErrors: this.skipValidationErrors,
183185
source: this.selectedSource,
184186
content: contents
185187
})
186188
);
187189

188-
const logText = `Imported ${result.importedCount} transaction(s).\nDuplicate transactions: ${result.duplicateCount}.\n`;
190+
const parts = [
191+
`Imported ${result.importedCount} transaction(s).`,
192+
`Duplicate transactions: ${result.duplicateCount}.`,
193+
];
194+
if (result.skippedCount > 0) {
195+
parts.push(`Skipped (validation errors): ${result.skippedCount}.`);
196+
}
197+
const logText = parts.join('\n');
189198
this.textContent = logText;
190199
this.messageService.add({ severity: 'success', detail: logText });
191200
} catch (e) {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.0
44

55
require (
66
buf.build/gen/go/xskydev/go-money-pb/connectrpc/go v1.19.1-20260221145631-b1f442f55195.2
7-
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221145631-b1f442f55195.1
7+
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221154942-deaf287f58ff.1
88
connectrpc.com/connect v1.19.1
99
connectrpc.com/grpcreflect v1.3.0
1010
github.com/DATA-DOG/go-sqlmock v1.5.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ al.essio.dev/pkg/shellescape v1.6.0 h1:NxFcEqzFSEVCGN2yq7Huv/9hyCEGVa/TncnOOBBeX
33
al.essio.dev/pkg/shellescape v1.6.0/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890=
44
buf.build/gen/go/xskydev/go-money-pb/connectrpc/go v1.19.1-20260221145631-b1f442f55195.2 h1:RKXNh2DP9OU7NJO1zIE7FPr1Hteg/5n5cKk0y7gDx3o=
55
buf.build/gen/go/xskydev/go-money-pb/connectrpc/go v1.19.1-20260221145631-b1f442f55195.2/go.mod h1:VTTULP3xLDXiwW6AkXskKv7ZBgzqh4wgauKnA8Svumc=
6-
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221145631-b1f442f55195.1 h1:TCX0BllmWXkSzbWvPtsD2a7FBELmFhX5NIX1B5Vf6HI=
7-
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221145631-b1f442f55195.1/go.mod h1:h6BlZCpceFTRzghEP6LSlTeYkE05pzKfQCnRYsP4kDA=
6+
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221154942-deaf287f58ff.1 h1:IFpF6B6xAmF2EdWX1P4KxwOfgADCpt8Gxplc5HAXO+Y=
7+
buf.build/gen/go/xskydev/go-money-pb/protocolbuffers/go v1.36.11-20260221154942-deaf287f58ff.1/go.mod h1:h6BlZCpceFTRzghEP6LSlTeYkE05pzKfQCnRYsP4kDA=
88
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
99
connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14=
1010
connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w=

pkg/importers/importer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ func (i *Importer) Import(
163163
tx,
164164
transactions.UpsertOptions{
165165
SkipAccountSourceDestValidation: true,
166+
SkipValidationErrors: req.SkipValidationErrors,
166167
},
167168
)
168169

@@ -177,6 +178,7 @@ func (i *Importer) Import(
177178
return &importv1.ImportTransactionsResponse{
178179
ImportedCount: int32(len(transactionResp)),
179180
DuplicateCount: int32(duplicateCount),
181+
SkippedCount: int32(len(allTransactions) - len(transactionResp)),
180182
}, nil
181183
}
182184

pkg/transactions/service.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ func (s *Service) CreateBulkInternal(
328328

329329
newTx, err := s.ConvertRequestToTransaction(ctx, req.Req, req.OriginalTx)
330330
if err != nil {
331+
if opts.SkipValidationErrors {
332+
zerolog.Ctx(ctx).Warn().
333+
Err(err).
334+
Str("title", req.Req.Title).
335+
Msg("skipping transaction due to validation error")
336+
continue
337+
}
338+
331339
return nil, err
332340
}
333341

pkg/transactions/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ type CalculateDailyStatRequest struct {
1717

1818
type UpsertOptions struct {
1919
SkipAccountSourceDestValidation bool
20+
SkipValidationErrors bool
2021
}

0 commit comments

Comments
 (0)