This commit is contained in:
phoenix
2025-11-01 17:27:26 -04:00
parent 25c283434d
commit 60241a2b16
4 changed files with 3 additions and 15 deletions
+2 -1
View File
@@ -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)
}
+1 -4
View File
@@ -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
-8
View File
@@ -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
-2
View File
@@ -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{