refactor (store): consolidate all pg store related actions

* All postgres related functions now live in internal/store.
* Updated queries.sql file to match struct order (readibility)
* Moved keystore -> store
* Moved queries -> store
* Removed pkg/postgres
This commit is contained in:
2023-04-11 10:14:49 +00:00
parent 82294b96f8
commit eba329eefa
22 changed files with 318 additions and 394 deletions

View File

@@ -22,7 +22,7 @@ func HandleAccountCreate(cu *custodial.Custodial) func(echo.Context) error {
return err
}
id, err := cu.Keystore.WriteKeyPair(c.Request().Context(), generatedKeyPair)
id, err := cu.Store.WriteKeyPair(c.Request().Context(), generatedKeyPair)
if err != nil {
return err
}

View File

@@ -40,7 +40,7 @@ func HandleSignTransfer(cu *custodial.Custodial) func(echo.Context) error {
return err
}
accountActive, gasQuota, err := cu.PgStore.GetAccountStatusByAddress(c.Request().Context(), req.From)
accountActive, gasQuota, err := cu.Store.GetAccountStatus(c.Request().Context(), req.From)
if err != nil {
return err
}

View File

@@ -28,7 +28,7 @@ func HandleTrackTx(cu *custodial.Custodial) func(echo.Context) error {
return err
}
txs, err := cu.PgStore.GetTxStatusByTrackingId(c.Request().Context(), txStatusRequest.TrackingId)
txs, err := cu.Store.GetTxStatus(c.Request().Context(), txStatusRequest.TrackingId)
if err != nil {
return err
}
@@ -36,7 +36,7 @@ func HandleTrackTx(cu *custodial.Custodial) func(echo.Context) error {
return c.JSON(http.StatusOK, OkResp{
Ok: true,
Result: H{
"transactions": txs,
"transaction": txs,
},
})
}