Cleanup
This commit is contained in:
@@ -27,10 +27,11 @@ type ConnectionInfo struct {
|
||||
SslMode string
|
||||
}
|
||||
|
||||
const Port = "9080"
|
||||
|
||||
const Port = "9080"
|
||||
const App_Name = "textsender_auth"
|
||||
|
||||
|
||||
func (ci ConnectionInfo) Parse() string {
|
||||
return fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=%s", ci.Username, ci.Password, ci.Host, ci.Port, ci.Database, ci.SslMode)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ func NewDatabase(connString string) (*Database, error) {
|
||||
}
|
||||
|
||||
// Test the connection with a short timeout
|
||||
|
||||
if err := pool.Ping(ctx); err != nil {
|
||||
pool.Close()
|
||||
return nil, fmt.Errorf("unable to ping database: %v", err)
|
||||
@@ -92,9 +91,7 @@ func (db *Database) ResetDatabase(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
statements := strings.Split(string(schemaContent), ";")
|
||||
|
||||
for _, stmt := range statements {
|
||||
for _, stmt := range strings.Split(string(schemaContent), ";") {
|
||||
stmt = strings.TrimSpace(stmt)
|
||||
if stmt == "" {
|
||||
continue
|
||||
|
||||
@@ -11,14 +11,6 @@ import (
|
||||
"git.kundeng.us/phoenix/textsender-models/pkg/user"
|
||||
)
|
||||
|
||||
/*
|
||||
type User struct {
|
||||
Id uuid.UUID `json:"id"`
|
||||
PhoneNumber string `json:"phone_number"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
*/
|
||||
|
||||
type UserStore interface {
|
||||
CreateUser(ctx context.Context, user *user.User) error
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
// "github.com/google/uuid"
|
||||
|
||||
"git.kundeng.us/phoenix/textsender-auth/internal/config"
|
||||
"git.kundeng.us/phoenix/textsender-models/pkg/token"
|
||||
@@ -37,7 +36,6 @@ func (t *TokenGenerator) GenerateToken(user user.User) (*token.Login, error) {
|
||||
|
||||
func (t *TokenGenerator) generateClaims(user user.User, role string, issuedAt time.Time, expiredAt time.Time) token.Claims {
|
||||
return token.Claims{
|
||||
// UserId: user.Id.String(),
|
||||
UserId: user.Id,
|
||||
Role: role,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
|
||||
Reference in New Issue
Block a user