add user management functionality with OTP verification and consent handling, DI introduced

This commit is contained in:
2025-08-10 10:38:49 +03:00
parent 6a9061a3de
commit 5d80a68b44
30 changed files with 828 additions and 528 deletions

24
internal/db/database.go Normal file
View File

@ -0,0 +1,24 @@
package db
import (
"context"
"strconv"
"git.logidex.ru/fakz9/logidex-id/internal/config"
"github.com/jackc/pgx/v5/pgxpool"
)
func NewDatabasePool(cfg config.Config) *pgxpool.Pool {
ctx := context.Background()
connUrl := "postgresql://" + cfg.DB.User + ":" + cfg.DB.Password + "@" + cfg.DB.Host + ":" + strconv.Itoa(cfg.DB.Port) + "/" + cfg.DB.Dbname
pool, err := pgxpool.New(ctx, connUrl)
if err != nil {
panic("Failed to connect to database: " + err.Error())
}
err = pool.Ping(ctx)
if err != nil {
panic("Failed to ping database: " + err.Error())
}
return pool
}