Fix/hway db driver (#1198)

* fix/hway-db-driver

* fix/hway-db-driver

* chore(scripts): add tx indexer and psql connection to test

* fix(scripts): make testnet setup more robust and configurable
This commit is contained in:
Prad Nukala
2024-12-19 11:22:44 +00:00
committed by GitHub
parent 36191d2bd4
commit 9d86dad38d
20 changed files with 439 additions and 374 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware"
config "github.com/onsonr/sonr/internal/config/hway"
"github.com/onsonr/sonr/internal/models/drivers/hwayorm"
hwayorm "github.com/onsonr/sonr/pkg/gateway/orm"
"github.com/onsonr/sonr/pkg/common"
"github.com/onsonr/sonr/pkg/gateway/middleware"
"github.com/onsonr/sonr/pkg/gateway/routes"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/models/drivers/hwayorm"
hwayorm "github.com/onsonr/sonr/pkg/gateway/orm"
)
func ListCredentials(c echo.Context, handle string) ([]*CredentialDescriptor, error) {
+1 -1
View File
@@ -5,8 +5,8 @@ import (
"github.com/medama-io/go-useragent"
"github.com/onsonr/sonr/crypto/mpc"
"github.com/onsonr/sonr/internal/config/hway"
"github.com/onsonr/sonr/internal/models/drivers/hwayorm"
"github.com/onsonr/sonr/pkg/common"
hwayorm "github.com/onsonr/sonr/pkg/gateway/orm"
)
type GatewayContext struct {
+7 -7
View File
@@ -5,7 +5,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/context"
repository "github.com/onsonr/sonr/internal/models/drivers/hwayorm"
hwayorm "github.com/onsonr/sonr/pkg/gateway/orm"
)
func CheckHandleUnique(c echo.Context, handle string) bool {
@@ -24,7 +24,7 @@ func CheckHandleUnique(c echo.Context, handle string) bool {
return true
}
func CreateProfile(c echo.Context) (*repository.Profile, error) {
func CreateProfile(c echo.Context) (*hwayorm.Profile, error) {
ctx, ok := c.(*GatewayContext)
if !ok {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Profile Context not found")
@@ -33,7 +33,7 @@ func CreateProfile(c echo.Context) (*repository.Profile, error) {
handle := c.FormValue("handle")
origin := c.FormValue("origin")
name := c.FormValue("name")
profile, err := ctx.dbq.InsertProfile(bgCtx(), repository.InsertProfileParams{
profile, err := ctx.dbq.InsertProfile(bgCtx(), hwayorm.InsertProfileParams{
Address: address,
Handle: handle,
Origin: origin,
@@ -44,7 +44,7 @@ func CreateProfile(c echo.Context) (*repository.Profile, error) {
}
// Update session with profile id
sid := GetSessionID(c)
_, err = ctx.dbq.UpdateSessionWithProfileID(bgCtx(), repository.UpdateSessionWithProfileIDParams{
_, err = ctx.dbq.UpdateSessionWithProfileID(bgCtx(), hwayorm.UpdateSessionWithProfileIDParams{
ProfileID: profile.ID,
ID: sid,
})
@@ -54,7 +54,7 @@ func CreateProfile(c echo.Context) (*repository.Profile, error) {
return &profile, nil
}
func UpdateProfile(c echo.Context) (*repository.Profile, error) {
func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) {
ctx, ok := c.(*GatewayContext)
if !ok {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Profile Context not found")
@@ -62,7 +62,7 @@ func UpdateProfile(c echo.Context) (*repository.Profile, error) {
address := c.FormValue("address")
handle := c.FormValue("handle")
name := c.FormValue("name")
profile, err := ctx.dbq.UpdateProfile(bgCtx(), repository.UpdateProfileParams{
profile, err := ctx.dbq.UpdateProfile(bgCtx(), hwayorm.UpdateProfileParams{
Address: address,
Handle: handle,
Name: name,
@@ -73,7 +73,7 @@ func UpdateProfile(c echo.Context) (*repository.Profile, error) {
return &profile, nil
}
func ReadProfile(c echo.Context) (*repository.Profile, error) {
func ReadProfile(c echo.Context) (*hwayorm.Profile, error) {
ctx, ok := c.(*GatewayContext)
if !ok {
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Profile Context not found")
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/medama-io/go-useragent"
ctx "github.com/onsonr/sonr/internal/context"
"github.com/onsonr/sonr/internal/models/drivers/hwayorm"
hwayorm "github.com/onsonr/sonr/pkg/gateway/orm"
"github.com/segmentio/ksuid"
)