forked from mtusi2026/mtusi2026lab2
feat(user): store users in Postgres with password hashes
This commit is contained in:
+4
-2
@@ -13,6 +13,7 @@ import (
|
||||
"mtusi2026-messenger/internal/config"
|
||||
"mtusi2026-messenger/internal/db"
|
||||
"mtusi2026-messenger/internal/logger"
|
||||
"mtusi2026-messenger/internal/postgres"
|
||||
"mtusi2026-messenger/internal/service"
|
||||
"mtusi2026-messenger/internal/store"
|
||||
)
|
||||
@@ -32,16 +33,17 @@ func Run() error {
|
||||
return err
|
||||
}
|
||||
|
||||
pool, err := db.New(context.Background(), dbURL)
|
||||
pool, err := postgres.New(context.Background(), dbURL)
|
||||
if err != nil {
|
||||
log.Error("connect to database", "error", err)
|
||||
return err
|
||||
}
|
||||
defer pool.Close()
|
||||
|
||||
queries := db.New(pool)
|
||||
memory := store.New()
|
||||
|
||||
userService := service.NewUserService(memory)
|
||||
userService := service.NewUserService(queries)
|
||||
chatService := service.NewChatService(memory)
|
||||
messageService := service.NewMessageService(memory)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user