all repos

onasty @ 2327475398df085c0194213fa8788d24d06ca4c4

a one-time notes service
8 files changed, 23 insertions(+), 23 deletions(-)
fix: typos (#22)

* refactor: make NoteSlugDTO type as string alias

* fix some typos
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: GitHub noreply@github.com
Committed at: 2024-09-26 22:48:37 +0300
Parent: 88565e9
M cmd/server/main.go
···
        75
        75
         		jwtTokenizer,

      
        76
        76
         		mailGunMailer,

      
        77
        77
         		cfg.JwtRefreshTokenTTL,

      
        78
        
        -		cfg.VerficationTokenTTL,

      
        
        78
        +		cfg.VerificationTokenTTL,

      
        79
        79
         		cfg.AppURL,

      
        80
        80
         	)

      
        81
        81
         

      
M e2e/e2e_test.go
···
        110
        110
         		e.jwtTokenizer,

      
        111
        111
         		e.mailer,

      
        112
        112
         		cfg.JwtRefreshTokenTTL,

      
        113
        
        -		cfg.VerficationTokenTTL,

      
        
        113
        +		cfg.VerificationTokenTTL,

      
        114
        114
         		cfg.AppURL,

      
        115
        115
         	)

      
        116
        116
         

      ···
        175
        175
         

      
        176
        176
         func (e *AppTestSuite) getConfig() *config.Config {

      
        177
        177
         	return &config.Config{ //nolint:exhaustruct

      
        178
        
        -		AppEnv:              "testing",

      
        179
        
        -		AppURL:              "",

      
        180
        
        -		ServerPort:          "3000",

      
        181
        
        -		PasswordSalt:        "salty-password",

      
        182
        
        -		JwtSigningKey:       "jwt-key",

      
        183
        
        -		JwtAccessTokenTTL:   time.Hour,

      
        184
        
        -		JwtRefreshTokenTTL:  24 * time.Hour,

      
        185
        
        -		VerficationTokenTTL: 24 * time.Hour,

      
        186
        
        -		LogShowLine:         os.Getenv("LOG_SHOW_LINE") == "true",

      
        187
        
        -		LogFormat:           "text",

      
        188
        
        -		LogLevel:            "debug",

      
        
        178
        +		AppEnv:               "testing",

      
        
        179
        +		AppURL:               "",

      
        
        180
        +		ServerPort:           "3000",

      
        
        181
        +		PasswordSalt:         "salty-password",

      
        
        182
        +		JwtSigningKey:        "jwt-key",

      
        
        183
        +		JwtAccessTokenTTL:    time.Hour,

      
        
        184
        +		JwtRefreshTokenTTL:   24 * time.Hour,

      
        
        185
        +		VerificationTokenTTL: 24 * time.Hour,

      
        
        186
        +		LogShowLine:          os.Getenv("LOG_SHOW_LINE") == "true",

      
        
        187
        +		LogFormat:            "text",

      
        
        188
        +		LogLevel:             "debug",

      
        189
        189
         	}

      
        190
        190
         }

      
M internal/config/config.go
···
        17
        17
         	JwtAccessTokenTTL  time.Duration

      
        18
        18
         	JwtRefreshTokenTTL time.Duration

      
        19
        19
         

      
        20
        
        -	MailgunFrom         string

      
        21
        
        -	MailgunDomain       string

      
        22
        
        -	MailgunAPIKey       string

      
        23
        
        -	VerficationTokenTTL time.Duration

      
        
        20
        +	MailgunFrom          string

      
        
        21
        +	MailgunDomain        string

      
        
        22
        +	MailgunAPIKey        string

      
        
        23
        +	VerificationTokenTTL time.Duration

      
        24
        24
         

      
        25
        25
         	LogLevel    string

      
        26
        26
         	LogFormat   string

      ···
        46
        46
         		MailgunFrom:   getenvOrDefault("MAILGUN_FROM", ""),

      
        47
        47
         		MailgunDomain: getenvOrDefault("MAILGUN_DOMAIN", ""),

      
        48
        48
         		MailgunAPIKey: getenvOrDefault("MAILGUN_API_KEY", ""),

      
        49
        
        -		VerficationTokenTTL: mustParseDurationOrPanic(

      
        
        49
        +		VerificationTokenTTL: mustParseDurationOrPanic(

      
        50
        50
         			getenvOrDefault("VERIFICATION_TOKEN_TTL", "24h"),

      
        51
        51
         		),

      
        52
        52
         

      
M internal/dtos/user.go
···
        17
        17
         }

      
        18
        18
         

      
        19
        19
         type ResetUserPasswordDTO struct {

      
        20
        
        -	// NOTE: probablbe userID shouldn't be here

      
        
        20
        +	// NOTE: probably userID shouldn't be here

      
        21
        21
         	UserID          uuid.UUID

      
        22
        22
         	CurrentPassword string

      
        23
        23
         	NewPassword     string

      
M internal/service/notesrv/notesrv.go
···
        10
        10
         )

      
        11
        11
         

      
        12
        12
         type NoteServicer interface {

      
        13
        
        -	// Create create note

      
        
        13
        +	// Create creates note

      
        14
        14
         	// if slug is empty it will be generated, otherwise used as is

      
        15
        15
         	// if userID is empty it means user isn't authorized so it will be used

      
        16
        16
         	Create(ctx context.Context, note dtos.CreateNoteDTO, userID uuid.UUID) (dtos.NoteSlugDTO, error)

      
M internal/service/usersrv/usersrv.go
···
        94
        94
         	}

      
        95
        95
         

      
        96
        96
         	// TODO: handle the error that might be returned

      
        97
        
        -	// i dont think that tehre's need to handle the error, just log it

      
        
        97
        +	// i dont think that there's need to handle the error, just log it

      
        98
        98
         	bgCtx, bgCancel := context.WithTimeout(context.Background(), 10*time.Second)

      
        99
        99
         	go u.sendVerificationEmail( //nolint:errcheck,contextcheck

      
        100
        100
         		bgCtx,

      
M internal/store/psql/userepo/userepo.go
···
        16
        16
         	Create(ctx context.Context, inp dtos.CreateUserDTO) (uuid.UUID, error)

      
        17
        17
         

      
        18
        18
         	// GetUserByCredentials returns user by email and password

      
        19
        
        -	// password should be hashed

      
        
        19
        +	// the password should be hashed

      
        20
        20
         	GetUserByCredentials(ctx context.Context, email, password string) (dtos.UserDTO, error)

      
        21
        21
         

      
        22
        22
         	GetUserIDByEmail(ctx context.Context, email string) (uuid.UUID, error)

      
M internal/transport/http/reqid/reqid.go
···
        25
        25
         			c.Request.Header.Add(headerRequestID, rid)

      
        26
        26
         		}

      
        27
        27
         

      
        28
        
        -		// set reqeust ID request context

      
        
        28
        +		// set request ID request context

      
        29
        29
         		ctx := context.WithValue(c.Request.Context(), RequestID, rid)

      
        30
        30
         		c.Request = c.Request.WithContext(ctx)

      
        31
        31