Skip to content

Commit

Permalink
add app
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyKomarovCoder committed Oct 1, 2023
1 parent e7410fb commit 5b715d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions cmd/api/init/app/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package app

import (
"github.com/go-park-mail-ru/2023_2_Hamster/internal/common/logger"
)

func Init(db *sqlx.DB, logger logger.CustomLogger) *mux.Router {
authRepo := authRepository.userRepository(db)

authUse
}
5 changes: 4 additions & 1 deletion cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package main
import (
"github.com/go-park-mail-ru/2023_2_Hamster/internal/common/logger"
"github.com/go-park-mail-ru/2023_2_Hamster/internal/common/postgresql"
"github.com/go-park-mail-ru/2023_2_Hamster/cmd/api/init/app"
)

func main() {
ctx, cancel
log := logger.CreateCustomLogger()

db, err := postgresql.InitPostgresDB()
Expand All @@ -17,6 +19,7 @@ func main() {
log.Errorf("Error Closing database connection: %v", err)
}
}()


router := app.Init(db, log)
router, err :=
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/go-park-mail-ru/2023_2_Hamster

go 1.21.1
go 1.18.1

require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
Expand Down
7 changes: 4 additions & 3 deletions internal/pkg/auth/repository/postgresql/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ type AuthRepo struct {
db *sql.DB
}

func NewAuthRepo(db *sql.DB) *AuthRepo {
func userRepository(db *sql.DB) *AuthRepo {
return &AuthRepo{
db: db,
db: db,
logger: l,
}
}

Expand All @@ -27,5 +28,5 @@ func (r *AuthRepo) CreateUser() {
}

func (r *AuthRepo) CheckUser() {
panic("unimplemented")

}

0 comments on commit 5b715d1

Please sign in to comment.