Skip to content

Commit

Permalink
Merge branch 'main' into refactor/notes
Browse files Browse the repository at this point in the history
  • Loading branch information
olexsmir committed Sep 26, 2024
2 parents bdf20c8 + 2327475 commit a41cb54
Showing 8 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ func run(ctx context.Context) error {
jwtTokenizer,
mailGunMailer,
cfg.JwtRefreshTokenTTL,
cfg.VerficationTokenTTL,
cfg.VerificationTokenTTL,
cfg.AppURL,
)

24 changes: 12 additions & 12 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ func (e *AppTestSuite) initDeps() {
e.jwtTokenizer,
e.mailer,
cfg.JwtRefreshTokenTTL,
cfg.VerficationTokenTTL,
cfg.VerificationTokenTTL,
cfg.AppURL,
)

@@ -175,16 +175,16 @@ func (e *AppTestSuite) prepPostgres() (*psqlutil.DB, stopDBFunc, error) {

func (e *AppTestSuite) getConfig() *config.Config {
return &config.Config{ //nolint:exhaustruct
AppEnv: "testing",
AppURL: "",
ServerPort: "3000",
PasswordSalt: "salty-password",
JwtSigningKey: "jwt-key",
JwtAccessTokenTTL: time.Hour,
JwtRefreshTokenTTL: 24 * time.Hour,
VerficationTokenTTL: 24 * time.Hour,
LogShowLine: os.Getenv("LOG_SHOW_LINE") == "true",
LogFormat: "text",
LogLevel: "debug",
AppEnv: "testing",
AppURL: "",
ServerPort: "3000",
PasswordSalt: "salty-password",
JwtSigningKey: "jwt-key",
JwtAccessTokenTTL: time.Hour,
JwtRefreshTokenTTL: 24 * time.Hour,
VerificationTokenTTL: 24 * time.Hour,
LogShowLine: os.Getenv("LOG_SHOW_LINE") == "true",
LogFormat: "text",
LogLevel: "debug",
}
}
10 changes: 5 additions & 5 deletions internal/config/config.go
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@ type Config struct {
JwtAccessTokenTTL time.Duration
JwtRefreshTokenTTL time.Duration

MailgunFrom string
MailgunDomain string
MailgunAPIKey string
VerficationTokenTTL time.Duration
MailgunFrom string
MailgunDomain string
MailgunAPIKey string
VerificationTokenTTL time.Duration

LogLevel string
LogFormat string
@@ -46,7 +46,7 @@ func NewConfig() *Config {
MailgunFrom: getenvOrDefault("MAILGUN_FROM", ""),
MailgunDomain: getenvOrDefault("MAILGUN_DOMAIN", ""),
MailgunAPIKey: getenvOrDefault("MAILGUN_API_KEY", ""),
VerficationTokenTTL: mustParseDurationOrPanic(
VerificationTokenTTL: mustParseDurationOrPanic(
getenvOrDefault("VERIFICATION_TOKEN_TTL", "24h"),
),

2 changes: 1 addition & 1 deletion internal/dtos/user.go
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ type UserDTO struct {
}

type ResetUserPasswordDTO struct {
// NOTE: probablbe userID shouldn't be here
// NOTE: probably userID shouldn't be here
UserID uuid.UUID
CurrentPassword string
NewPassword string
2 changes: 1 addition & 1 deletion internal/service/notesrv/notesrv.go
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import (
)

type NoteServicer interface {
// Create create note
// Create creates note
// if slug is empty it will be generated, otherwise used as is
// if userID is empty it means user isn't authorized so it will be used
Create(ctx context.Context, note dtos.CreateNoteDTO, userID uuid.UUID) (dtos.NoteSlugDTO, error)
2 changes: 1 addition & 1 deletion internal/service/usersrv/usersrv.go
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ func (u *UserSrv) SignUp(ctx context.Context, inp dtos.CreateUserDTO) (uuid.UUID
}

// TODO: handle the error that might be returned
// i dont think that tehre's need to handle the error, just log it
// i dont think that there's need to handle the error, just log it
bgCtx, bgCancel := context.WithTimeout(context.Background(), 10*time.Second)
go u.sendVerificationEmail( //nolint:errcheck,contextcheck
bgCtx,
2 changes: 1 addition & 1 deletion internal/store/psql/userepo/userepo.go
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ type UserStorer interface {
Create(ctx context.Context, inp dtos.CreateUserDTO) (uuid.UUID, error)

// GetUserByCredentials returns user by email and password
// password should be hashed
// the password should be hashed
GetUserByCredentials(ctx context.Context, email, password string) (dtos.UserDTO, error)

GetUserIDByEmail(ctx context.Context, email string) (uuid.UUID, error)
2 changes: 1 addition & 1 deletion internal/transport/http/reqid/reqid.go
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ func Middleware() gin.HandlerFunc {
c.Request.Header.Add(headerRequestID, rid)
}

// set reqeust ID request context
// set request ID request context
ctx := context.WithValue(c.Request.Context(), RequestID, rid)
c.Request = c.Request.WithContext(ctx)

0 comments on commit a41cb54

Please sign in to comment.