Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Feb 26, 2024
1 parent 9a9c34d commit 914d209
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 18 deletions.
6 changes: 2 additions & 4 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ require (
github.com/huandu/go-assert v1.1.6
github.com/mcnijman/go-emailaddress v1.1.1
github.com/mitchellh/mapstructure v1.5.0
github.com/resend/resend-go/v2 v2.5.0
github.com/spf13/viper v1.18.2
github.com/swaggo/swag v1.16.3
golang.org/x/crypto v0.19.0
golang.org/x/text v0.14.0
gorm.io/driver/postgres v1.5.6
gorm.io/gorm v1.25.7
Expand All @@ -24,13 +26,9 @@ require (
require (
github.com/awnumar/memcall v0.2.0 // indirect
github.com/awnumar/memguard v0.22.4 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pquerna/otp v1.4.0 // indirect
github.com/resend/resend-go/v2 v2.5.0 // indirect
github.com/tinylib/msgp v1.1.8 // indirect
golang.org/x/term v0.17.0 // indirect
)

require (
Expand Down
6 changes: 0 additions & 6 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ github.com/awnumar/memcall v0.2.0 h1:sRaogqExTOOkkNwO9pzJsL8jrOV29UuUW7teRMfbqtI
github.com/awnumar/memcall v0.2.0/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGaWsWsoJo=
github.com/awnumar/memguard v0.22.4 h1:1PLgKcgGPeExPHL8dCOWGVjIbQUBgJv9OL0F/yE1PqQ=
github.com/awnumar/memguard v0.22.4/go.mod h1:+APmZGThMBWjnMlKiSM1X7MVpbIVewen2MTkqWkA/zE=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand Down Expand Up @@ -102,8 +100,6 @@ github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/otp v1.4.0 h1:wZvl1TIVxKRThZIBiwOOHOGP/1+nZyWBil9Y2XNEDzg=
github.com/pquerna/otp v1.4.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/resend/resend-go/v2 v2.5.0 h1:XzTtzQ9YB2LlGHWjS5AVyUqV9cVbDU+6Z4XgCKsJh4g=
github.com/resend/resend-go/v2 v2.5.0/go.mod h1:ihnxc7wPpSgans8RV8d8dIF4hYWVsqMK5KxXAr9LIos=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
Expand Down Expand Up @@ -186,8 +182,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand Down
2 changes: 1 addition & 1 deletion backend/src/config/resend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ func readResendSettings() (*ResendSettings, error) {
return &ResendSettings{
APIKey: secretAPIKey,
}, nil
}
}
1 change: 0 additions & 1 deletion backend/src/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func Init(db *gorm.DB, settings config.Settings) *fiber.App {
authMiddleware := middleware.NewAuthAuthMiddlewareService(db, validate, settings.Auth)
emailService := auth.NewEmailService()


apiv1 := app.Group("/api/v1")
apiv1.Use(authMiddleware.Authenticate)

Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ type AuthServiceInterface interface {
type AuthService struct {
DB *gorm.DB
Validate *validator.Validate
Email *auth.EmailService
Email *auth.EmailService
}

func NewAuthService(db *gorm.DB, validate *validator.Validate, email *auth.EmailService) *AuthService {
return &AuthService{
DB: db,
Validate: validate,
Email: email,
Email: email,
}
}

Expand Down
7 changes: 3 additions & 4 deletions backend/src/transactions/password_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

func SavePasswordResetToken(db *gorm.DB, userID uuid.UUID, token string) *errors.Error {
passwordReset := models.PasswordReset{
UserID: userID,
Token: token,
UserID: userID,
Token: token,
ExpiresAt: time.Now().Add(time.Hour * 24).UTC(),
}

Expand Down Expand Up @@ -43,7 +43,6 @@ func GetPasswordResetToken(db *gorm.DB, token string) (*models.PasswordReset, *e
return &passwordReset, nil
}


func GetActivePasswordResetTokenByUserID(db *gorm.DB, userID uuid.UUID) (*models.PasswordReset, *errors.Error) {
passwordReset := models.PasswordReset{}
if err := db.Where("user_id = ? AND expires_at > ?", userID, time.Now().UTC()).First(&passwordReset).Error; err != nil {
Expand All @@ -54,4 +53,4 @@ func GetActivePasswordResetTokenByUserID(db *gorm.DB, userID uuid.UUID) (*models
}

return &passwordReset, nil
}
}

0 comments on commit 914d209

Please sign in to comment.