Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
added additional filtering for return method by specifying only retur…
Browse files Browse the repository at this point in the history
…n content since last update
  • Loading branch information
j-Rosenthal committed Sep 1, 2023
1 parent 886151f commit e0bf985
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions pkg/trdm/get_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ type GetTableRequestElement struct {
privateKey *rsa.PrivateKey
Input struct {
TRDM struct {
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
ContentUpdatedSinceDateTime string `xml:"contentUpdatedSinceDateTime"`
}
}
}
Expand Down Expand Up @@ -99,23 +100,26 @@ type GetTableUpdater interface {
GetTable(appCtx appcontext.AppContext, physicalName string, lastUpdate string) error
}

func NewGetTable(physicalName string, securityToken string, privateKey *rsa.PrivateKey, soapClient SoapCaller) GetTableUpdater {
func NewGetTable(physicalName string, lastUpdateDateTime string, securityToken string, privateKey *rsa.PrivateKey, soapClient SoapCaller) GetTableUpdater {
return &GetTableRequestElement{
securityToken: securityToken,
privateKey: privateKey,
soapClient: soapClient,
Input: struct {
TRDM struct {
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
ContentUpdatedSinceDateTime string `xml:"contentUpdatedSinceDateTime"`
}
}{
TRDM: struct {
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
PhysicalName string `xml:"physicalName"`
ReturnContent string `xml:"returnContent"`
ContentUpdatedSinceDateTime string `xml:"contentUpdatedSinceDateTime"`
}{
PhysicalName: physicalName,
ReturnContent: fmt.Sprintf("%t", true),
PhysicalName: physicalName,
ReturnContent: fmt.Sprintf("%t", true),
ContentUpdatedSinceDateTime: lastUpdateDateTime,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/trdm/get_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (suite *TRDMSuite) TestGetTableFake() {
suite.Error(keyErr)
}

getTable := trdm.NewGetTable(test.physicalName, "kjdhfkasjhflaksjfhklafhkadsf=", privatekey, testSoapClient)
getTable := trdm.NewGetTable(test.physicalName, time.Now().Format(time.RFC3339), "kjdhfkasjhflaksjfhklafhkadsf=", privatekey, testSoapClient)
err := getTable.GetTable(suite.AppContextForTest(), test.physicalName, time.Now().Format(time.RFC3339))

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/trdm/last_table_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func lastTableUpdateSoapCall(d *GetLastTableUpdateRequestElement, params gosoap.
}

if r.Status.StatusCode == successfulStatusCode {
getTable := NewGetTable(d.PhysicalName, d.securityToken, d.privateKey, d.soapClient)
getTable := NewGetTable(d.PhysicalName, r.LastUpdate, d.securityToken, d.privateKey, d.soapClient)
getTableErr := getTable.GetTable(appCtx, d.PhysicalName, r.LastUpdate)
if getTableErr != nil {
return fmt.Errorf("getTable error: %s", getTableErr.Error())
Expand Down

0 comments on commit e0bf985

Please sign in to comment.