Documentation
¶
Index ¶
- Variables
- func InsertMockExercise(er usecases.ExerciseRepo) (*entities.Exercise, error)
- func InsertMockUser(ur usecases.UserRepo) (*entities.User, error)
- func StartMockTraining(tr usecases.TrainingRepo) (*entities.Training, error)
- type MockAuthRepo
- func (r *MockAuthRepo) AddResetPasswordRequest(ctx context.Context, emailaddress string, expiresAt time.Time) (*entities.ResetPwdReq, error)
- func (r *MockAuthRepo) ChangePassword(ctx context.Context, userID string, newPwd []byte) error
- func (r *MockAuthRepo) DeleteJWT(ctx context.Context, token *entities.UserToken) (int64, error)
- func (r *MockAuthRepo) DeleteRefreshToken(ctx context.Context, userID string) (n int64, err error)
- func (r *MockAuthRepo) DeleteRefreshTokenAndAllTokens(ctx context.Context, userID string) (n int64, err error)
- func (r *MockAuthRepo) GetRefreshToken(ctx context.Context, userID string) (*entities.RefreshToken, error)
- func (r *MockAuthRepo) GetUserByEmailAddress(ctx context.Context, emailAddress string) (*entities.AuthUser, error)
- func (r *MockAuthRepo) GetUserByID(ctx context.Context, id string) (*entities.AuthUser, error)
- func (r *MockAuthRepo) GetUserJWTs(ctx context.Context, userID string, expired entities.ExpireType) ([]entities.UserToken, error)
- func (r *MockAuthRepo) SaveJWT(ctx context.Context, userID string, device string, token string, ...) (*entities.UserToken, error)
- func (r *MockAuthRepo) SaveRefreshToken(ctx context.Context, userID string, token string, expiresAt time.Time) (*entities.RefreshToken, error)
- func (r *MockAuthRepo) UpdatePasswordForResetRequest(ctx context.Context, reqID string, pwdHash []byte) error
- type MockExerciseRepo
- func (er *MockExerciseRepo) CreateExercise(ctx context.Context, name string, description string, setUnit entities.SetUnit, ...) (*entities.Exercise, error)
- func (er *MockExerciseRepo) GetExerciseByID(ctx context.Context, id string) (*entities.Exercise, error)
- func (er *MockExerciseRepo) GetExercisesByName(ctx context.Context, name string) ([]entities.Exercise, error)
- func (er *MockExerciseRepo) UpdateExercise(ctx context.Context, ex *entities.Exercise) (*entities.Exercise, error)
- type MockMailer
- type MockTrainingRepo
- func (tr *MockTrainingRepo) AddSet(ctx context.Context, userID, teID string, set *entities.TrainingSet) (*entities.TrainingSet, error)
- func (tr *MockTrainingRepo) EndExercise(ctx context.Context, userID, id string, endTime time.Time) (*entities.TrainingExercise, error)
- func (tr *MockTrainingRepo) EndTraining(ctx context.Context, id string, endTime time.Time) (*entities.Training, error)
- func (tr *MockTrainingRepo) GetTrainingByID(ctx context.Context, id string) (*entities.Training, error)
- func (tr *MockTrainingRepo) GetTrainingExercises(ctx context.Context, id string) ([]entities.TrainingExercise, error)
- func (tr *MockTrainingRepo) GetUserTrainings(ctx context.Context, userID string, started bool) ([]entities.Training, error)
- func (tr *MockTrainingRepo) StartExercise(ctx context.Context, trID string, exercise *entities.TrainingExercise) (*entities.TrainingExercise, error)
- func (tr *MockTrainingRepo) StartTraining(ctx context.Context, userID string, startTime time.Time) (*entities.Training, error)
- type MockUserRepo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ExampleUserToken = entities.UserToken{ ID: "609bba6ffc79f3b3bdd9431f", UserID: UserID, Token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYwNzJkMzIwNjE0NDY0NDk4NGE1NGZhMSIsImNyZWF0ZWRBdCI6MTYyMDQ4Njg2MjkyOTA2NTUwMCwiciI6eyJ0b2tlbiI6IjRiYmI1NDZlLTM0MjEtNGI1Ni1iODI2LWQwYjY0OGM3YjUzYiJ9LCJleHAiOjE2MjA0ODcxNjIsImlhdCI6MTYyMDQ4Njg2Mn0.j8dSyoCoSiKOI1duK9eNAl2LFgHjV0fe8eB58IhxlvI", Device: "PostmanRuntime/7.26.10", CreatedAt: Now, ExpiresAt: Now.AddDate(1, 0, 0), } ExampleRefreshToken = entities.RefreshToken{ ID: "609bba6ffc79f3b3bdd9431e", UserID: UserID, Token: "4bbb546e-3421-4b56-b826-d0b648c7b53b", CreatedAt: Now, ExpiresAt: Now.AddDate(1, 0, 0), } ExampleResetPwdReq = entities.ResetPwdReq{ ID: "609ba7fedcc11ebd3051a816", EmailAddress: ExampleUser.EmailAddress, Status: entities.ResetPwdStatusNoActionYet, ExpiresAt: Now.Add(time.Minute * 15), CreatedAt: Now, } )
View Source
var ( UserID = "6072d3206144644984a54fa1" NonexistingUserID = UserID[:len(UserID)-1] + "a" NonexistingEmail = "notfound@example.com" Password = []byte("TheSecretestPasswordEver123$%^") PasswordHash = []byte("$2a$04$d0sgKcu9y.h8grIpktLj9OAdcv7pGy5CZ9aaz5zqPAkPyqlxLGF5W") Now = time.Now().UTC() )
View Source
var ( ExampleTraining = entities.Training{ ID: "607443ceb40d9ea8602803e7", UserID: UserID, StartTime: Now.Add(-2 * time.Hour), Exercises: []entities.TrainingExercise{ { ID: "607400d5bf81935a539bd698", ExerciseID: ExampleExercise.ID, StartTime: Now.Add(-115 * time.Minute), EndTime: Now, Sets: []entities.TrainingSet{ { ID: "60740f289ee8e963adb5412a", Time: Now.Add(-110 * time.Minute), Reps: 12, }, { ID: "60740f289ee8e963adb5412d", Time: Now.Add(-107 * time.Minute), Reps: 10, }, { ID: "60740f289ee8e963adb5412c", Time: Now.Add(-103 * time.Minute), Reps: 10, }, }, Comment: "too short breaks", }, { ID: "60740f289ee8e963adb5412b", ExerciseID: ExampleExercise.ID, StartTime: Now.Add(-115 * time.Minute), }, }, Comment: "too long, too heavy", } ExampleTrainingExercise = ExampleTraining.Exercises[0] ExampleTrainingSet = ExampleTrainingExercise.Sets[0] )
View Source
var ExampleExercise = entities.Exercise{ ID: "6072d3206144644984a54fa0", Name: "Deadlift", Description: "The deadlift is an exercise in which a loaded bar is lifted off the ground to the level of the hips.", SetUnit: entities.Weight, CreatedAt: Now, CreatedBy: UserID, }
View Source
var ( ExampleUser = entities.User{ ID: UserID, Username: "John Silver", EmailAddress: "johnsilver@email.com", CreatedAt: Now, } )
Functions ¶
func InsertMockExercise ¶
func InsertMockExercise(er usecases.ExerciseRepo) (*entities.Exercise, error)
func InsertMockUser ¶
InsertMockUser inserts mocked user to repository with use of the repo functionality
func StartMockTraining ¶
func StartMockTraining(tr usecases.TrainingRepo) (*entities.Training, error)
Types ¶
type MockAuthRepo ¶
type MockAuthRepo struct{}
func (*MockAuthRepo) AddResetPasswordRequest ¶
func (r *MockAuthRepo) AddResetPasswordRequest( ctx context.Context, emailaddress string, expiresAt time.Time) (*entities.ResetPwdReq, error)
func (*MockAuthRepo) ChangePassword ¶
func (*MockAuthRepo) DeleteRefreshToken ¶
func (*MockAuthRepo) DeleteRefreshTokenAndAllTokens ¶
func (*MockAuthRepo) GetRefreshToken ¶
func (r *MockAuthRepo) GetRefreshToken( ctx context.Context, userID string) (*entities.RefreshToken, error)
func (*MockAuthRepo) GetUserByEmailAddress ¶
func (*MockAuthRepo) GetUserByID ¶
func (*MockAuthRepo) GetUserJWTs ¶
func (r *MockAuthRepo) GetUserJWTs( ctx context.Context, userID string, expired entities.ExpireType, ) ([]entities.UserToken, error)
func (*MockAuthRepo) SaveRefreshToken ¶
func (r *MockAuthRepo) SaveRefreshToken( ctx context.Context, userID string, token string, expiresAt time.Time) (*entities.RefreshToken, error)
func (*MockAuthRepo) UpdatePasswordForResetRequest ¶
type MockExerciseRepo ¶
type MockExerciseRepo struct{}
func (*MockExerciseRepo) CreateExercise ¶
func (*MockExerciseRepo) GetExerciseByID ¶
func (*MockExerciseRepo) GetExercisesByName ¶
func (*MockExerciseRepo) UpdateExercise ¶
type MockMailer ¶
type MockMailer struct{}
func (*MockMailer) Close ¶
func (m *MockMailer) Close()
func (*MockMailer) Send ¶
func (m *MockMailer) Send(recipients []string, subject, data []byte)
type MockTrainingRepo ¶
type MockTrainingRepo struct { }
func (*MockTrainingRepo) AddSet ¶
func (tr *MockTrainingRepo) AddSet( ctx context.Context, userID, teID string, set *entities.TrainingSet) (*entities.TrainingSet, error)
func (*MockTrainingRepo) EndExercise ¶
func (tr *MockTrainingRepo) EndExercise( ctx context.Context, userID, id string, endTime time.Time) (*entities.TrainingExercise, error)
func (*MockTrainingRepo) EndTraining ¶
func (*MockTrainingRepo) GetTrainingByID ¶
func (*MockTrainingRepo) GetTrainingExercises ¶
func (tr *MockTrainingRepo) GetTrainingExercises( ctx context.Context, id string) ([]entities.TrainingExercise, error)
func (*MockTrainingRepo) GetUserTrainings ¶
func (*MockTrainingRepo) StartExercise ¶
func (tr *MockTrainingRepo) StartExercise( ctx context.Context, trID string, exercise *entities.TrainingExercise) (*entities.TrainingExercise, error)
type MockUserRepo ¶
type MockUserRepo struct { }
func (MockUserRepo) CreateUser ¶
func (MockUserRepo) GetUserByID ¶
Click to show internal directories.
Click to hide internal directories.