refactor: move common package to pkg directory

This commit is contained in:
Prad Nukala 2025-01-06 15:09:44 -05:00
parent 659d0fe2e9
commit d3e41fa69a
35 changed files with 51 additions and 24 deletions

View File

@ -90,7 +90,7 @@ dockers:
- onsonr/hway:latest - onsonr/hway:latest
- ghcr.io/onsonr/hway:{{ .Tag }} - ghcr.io/onsonr/hway:{{ .Tag }}
- ghcr.io/onsonr/hway:latest - ghcr.io/onsonr/hway:latest
dockerfile: ./docker/Dockerfile dockerfile: ./docker/release.Dockerfile
announce: announce:
telegram: telegram:

View File

@ -5,9 +5,9 @@ import (
"github.com/labstack/echo-contrib/echoprometheus" "github.com/labstack/echo-contrib/echoprometheus"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware" echomiddleware "github.com/labstack/echo/v4/middleware"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
config "github.com/onsonr/hway/config" config "github.com/onsonr/hway/pkg/config"
hwayorm "github.com/onsonr/hway/models" hwayorm "github.com/onsonr/hway/pkg/models"
// "github.com/onsonr/hway/pkg/context" // "github.com/onsonr/hway/pkg/context"
) )

View File

@ -9,9 +9,9 @@ import (
"os" "os"
"github.com/onsonr/hway/app" "github.com/onsonr/hway/app"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
"github.com/onsonr/hway/config" "github.com/onsonr/hway/pkg/config"
hwayorm "github.com/onsonr/hway/models" hwayorm "github.com/onsonr/hway/pkg/models"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )

1
go.mod
View File

@ -189,6 +189,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/onsi/ginkgo/v2 v2.22.0 // indirect github.com/onsi/ginkgo/v2 v2.22.0 // indirect
github.com/onsonr/nebula v0.1.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect

2
go.sum
View File

@ -750,6 +750,8 @@ github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
github.com/onsonr/crypto v1.50.0 h1:U1oEFPG3v/fPywAUE8VW5w1FSMjpckPS6PLH2bVDI2I= github.com/onsonr/crypto v1.50.0 h1:U1oEFPG3v/fPywAUE8VW5w1FSMjpckPS6PLH2bVDI2I=
github.com/onsonr/crypto v1.50.0/go.mod h1:bBNLhUlfIaBiVRpKprYtPV8h/9nXB32TXMujkKGwg8w= github.com/onsonr/crypto v1.50.0/go.mod h1:bBNLhUlfIaBiVRpKprYtPV8h/9nXB32TXMujkKGwg8w=
github.com/onsonr/nebula v0.1.1 h1:YBIbf4JSt8jVz6DI04fa7gKY9fBZ47YBIzwe3Nom+YQ=
github.com/onsonr/nebula v0.1.1/go.mod h1:1Dcmw5lB4dvKRKSp55B/iLmN4ejZ4vp1/EB/RzXetAQ=
github.com/onsonr/sonr v0.6.1 h1:pNP2BbOfe/3UN/bZSYNyf9F+nlIpZaqi2LJ6Ol0496w= github.com/onsonr/sonr v0.6.1 h1:pNP2BbOfe/3UN/bZSYNyf9F+nlIpZaqi2LJ6Ol0496w=
github.com/onsonr/sonr v0.6.1/go.mod h1:L4ywLeJemlGD2pmlIX/j3eEKEgu5o/yzgFjkHNr7dAk= github.com/onsonr/sonr v0.6.1/go.mod h1:L4ywLeJemlGD2pmlIX/j3eEKEgu5o/yzgFjkHNr7dAk=
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=

View File

@ -2,7 +2,7 @@ package handlers
import ( import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/hway/app/context" "github.com/onsonr/hway/pkg/context"
) )
func ErrorHandler(err error, c echo.Context) { func ErrorHandler(err error, c echo.Context) {

View File

@ -2,7 +2,7 @@ package handlers
import ( import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/hway/app/context" "github.com/onsonr/hway/pkg/context"
) )
func IndexHandler(c echo.Context) error { func IndexHandler(c echo.Context) error {

View File

@ -4,11 +4,11 @@ import (
"encoding/json" "encoding/json"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/hway/app/common"
"github.com/onsonr/hway/app/context"
"github.com/onsonr/hway/app/islands" "github.com/onsonr/hway/app/islands"
"github.com/onsonr/hway/app/views" "github.com/onsonr/hway/app/views"
hwayorm "github.com/onsonr/hway/models" "github.com/onsonr/hway/pkg/common"
"github.com/onsonr/hway/pkg/context"
hwayorm "github.com/onsonr/hway/pkg/models"
) )
func RegisterHandler(g *echo.Group) { func RegisterHandler(g *echo.Group) {

View File

@ -1,4 +1,4 @@
@go.Package { name = "github.com/onsonr/hway/config" } @go.Package { name = "github.com/onsonr/hway/pkg/config" }
open module sonr.net.Hway open module sonr.net.Hway

View File

@ -8,4 +8,4 @@ sql:
emit_interface: true emit_interface: true
emit_json_tags: true emit_json_tags: true
package: "models" package: "models"
out: "../models" out: "../pkg/models"

View File

@ -7,9 +7,9 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/medama-io/go-useragent" "github.com/medama-io/go-useragent"
"github.com/onsonr/crypto/mpc" "github.com/onsonr/crypto/mpc"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
hway "github.com/onsonr/hway/config" hway "github.com/onsonr/hway/pkg/config"
hwayorm "github.com/onsonr/hway/internal/models" hwayorm "github.com/onsonr/hway/pkg/models"
) )
type GatewayContext struct { type GatewayContext struct {

View File

@ -4,7 +4,7 @@ import (
"net/http" "net/http"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
hwayorm "github.com/onsonr/hway/internal/models" hwayorm "github.com/onsonr/hway/pkg/models"
) )
func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) { func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) {

View File

@ -3,7 +3,7 @@ package context
import ( import (
"fmt" "fmt"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
) )
// ParamsBank returns the bank params // ParamsBank returns the bank params

View File

@ -4,7 +4,7 @@ import (
gocontext "context" gocontext "context"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
"github.com/segmentio/ksuid" "github.com/segmentio/ksuid"
"lukechampine.com/blake3" "lukechampine.com/blake3"
) )

View File

@ -4,7 +4,7 @@ import (
"github.com/go-webauthn/webauthn/protocol" "github.com/go-webauthn/webauthn/protocol"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/medama-io/go-useragent" "github.com/medama-io/go-useragent"
hwayorm "github.com/onsonr/hway/internal/models" hwayorm "github.com/onsonr/hway/pkg/models"
) )
// Define the credential structure matching our frontend data // Define the credential structure matching our frontend data

View File

@ -2,7 +2,7 @@ package context
import ( import (
"github.com/onsonr/crypto/mpc" "github.com/onsonr/crypto/mpc"
"github.com/onsonr/hway/app/common" "github.com/onsonr/hway/pkg/common"
"lukechampine.com/blake3" "lukechampine.com/blake3"
) )

View File

@ -1 +1 @@
package index package errors

View File

@ -1 +1 @@
package index package errors

24
x/errors/view.templ Normal file
View File

@ -0,0 +1,24 @@
package errors
templ ErrorView(error string) {
@LayoutView("Error | Sonr.ID") {
@LayoutContainer() {
@HeroTitle("Error", "Something went wrong.")
@Form("/error", "error-form") {
@FormBody() {
@FormHeader() {
<div class="w-full py-2">
<sl-avatar shape="circle" size="large" src="https://avatars.githubusercontent.com/u/101929?v=4"></sl-avatar>
</div>
}
@islands.InputHandle()
@FormFooter() {
@FormCancel()
@FormSubmit("Next")
}
}
}
}
}
}