Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GetUserResponse ¶
type GetUserResponse struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
AvatarUrl *string `json:"avatar_url"`
Email string `json:"email"`
LinkedAccounts *[]repository.GetLinkedAccountsRow `json:"linked_accounts"`
MfaEnabled bool `json:"mfa_enabled"`
HasPassword bool `json:"has_password"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(config *config.Config, validator *validation.Validator, repo Repository, storage storage.Storage, logger *zerolog.Logger) *Handler
func (*Handler) DeleteInfo ¶
func (h *Handler) DeleteInfo(w http.ResponseWriter, r *http.Request)
func (*Handler) UpdateInfo ¶
func (h *Handler) UpdateInfo(w http.ResponseWriter, r *http.Request)
func (*Handler) UploadAvatar ¶
func (h *Handler) UploadAvatar(w http.ResponseWriter, r *http.Request)
UploadAvatar handles avatar image uploads
type Repository ¶
type Repository interface {
GetUserByEmail(ctx context.Context, email string) (repository.GetUserByEmailRow, error)
GetUserByID(ctx context.Context, id uuid.UUID) (repository.GetUserByIdRow, error)
CreateUser(ctx context.Context, params repository.CreateUserParams) (repository.User, error)
CreateUserWithDefaults(ctx context.Context, params repository.CreateUserParams) (repository.User, error)
FindORCreateOAuthUser(ctx context.Context, user goth.User, provider string) (repository.GetUserByEmailRow, error)
UpdateUser(ctx context.Context, params repository.UpdateUserParams) (repository.User, error)
DeleteUser(ctx context.Context, id uuid.UUID) error
GetMFASecret(ctx context.Context, userID uuid.UUID) ([]byte, error)
EnableMFA(ctx context.Context, id uuid.UUID) error
StoreMFASecret(ctx context.Context, params repository.StoreMFASecretParams) error
DisableMFA(ctx context.Context, userID uuid.UUID) error
GetLinkedAccounts(ctx context.Context, id uuid.UUID) ([]repository.GetLinkedAccountsRow, error)
AddLinkedAccounts(ctx context.Context, params repository.AddLinkedAccountParams) error
}
Repository defines the interface for user data operations
func NewRepository ¶
func NewRepository(db *pgxpool.Pool, queries *repository.Queries, storage storage.Storage) Repository
NewRepository creates a new user repository
Click to show internal directories.
Click to hide internal directories.