Documentation
¶
Index ¶
- type ApproveUserResponse
- type CreateUserRequest
- type CreateUserResponse
- type DataExportMeta
- type DeleteAccountRequest
- type DeletedContentItem
- type EmailUpdateData
- type EmailUpdateRequest
- type EmailUpdateResponse
- type Mailer
- type MarkUserAsSpamResponse
- type PasswordUpdateData
- type PasswordUpdateRequest
- type PasswordUpdateResponse
- type PendingUser
- type ProfileData
- type ProfileHandler
- func (h *ProfileHandler) ChangePassword(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) DeleteAccount(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) ExportUserData(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) GetProfile(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) GetUserFields(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) UpdateCustomFields(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) UpdateEmail(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) UpdateName(w http.ResponseWriter, r *http.Request)
- func (h *ProfileHandler) VerifyEmailUpdate(w http.ResponseWriter, r *http.Request)
- type ProfileInfo
- type ProfilePictureHandler
- func (h *ProfilePictureHandler) AdminDeleteUserPicture(w http.ResponseWriter, r *http.Request)
- func (h *ProfilePictureHandler) AdminUploadUserPicture(w http.ResponseWriter, r *http.Request)
- func (h *ProfilePictureHandler) DeleteProfilePicture(w http.ResponseWriter, r *http.Request)
- func (h *ProfilePictureHandler) UploadProfilePicture(w http.ResponseWriter, r *http.Request)
- type ProfileResponse
- type ProfileResponseMeta
- type RejectUserResponse
- type RestoreContentResponse
- type RestoredContent
- type SoftDeleteContentRequest
- type SoftDeleteStore
- type SoftDeleteUserResponse
- type SoftDeletedContent
- type SuspendUserResponse
- type UnsuspendUserResponse
- type UpdateUserProfileRequest
- type UpdateUserProfileResponse
- type UserDetail
- type UserInList
- type UserManagementHandler
- func (h *UserManagementHandler) ApproveUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) CreateUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) GetAllUsers(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) GetPendingUsers(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) GetSoftDeletedContent(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) MarkUserAsSpam(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) RejectUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) RestoreContent(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) SoftDeleteUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) SuspendUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) UnsuspendUser(w http.ResponseWriter, r *http.Request)
- func (h *UserManagementHandler) UpdateUser(w http.ResponseWriter, r *http.Request)
- type UserStore
- type VerifyEmailUpdateData
- type VerifyEmailUpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApproveUserResponse ¶
type ApproveUserResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
}
ApproveUserResponse represents the response for approve user
type CreateUserRequest ¶
type CreateUserRequest struct {
Username string `json:"username"`
Name string `json:"name"`
Email string `json:"email"`
Role string `json:"role"`
CustomFields map[string]any `json:"customFields,omitempty"`
}
CreateUserRequest represents the request body for creating a user
type CreateUserResponse ¶
type CreateUserResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
Password string `json:"password"`
}
CreateUserResponse represents the response for creating a user
type DataExportMeta ¶
type DataExportMeta struct {
Timestamp string `json:"timestamp"`
}
DataExportMeta represents metadata in data export response
type DeleteAccountRequest ¶
type DeleteAccountRequest struct {
Confirmation string `json:"confirmation"`
}
DeleteAccountRequest represents a request to delete an account
type DeletedContentItem ¶
type DeletedContentItem struct {
ID int `json:"id"`
ContentType string `json:"contentType"`
ContentID int `json:"contentId"`
DeletedAt string `json:"deletedAt"`
DeletedBy string `json:"deletedBy"`
Reason string `json:"reason,omitempty"`
}
DeletedContentItem represents a soft deleted content item
type EmailUpdateData ¶
EmailUpdateData represents email update data in the response
type EmailUpdateRequest ¶
type EmailUpdateRequest struct {
NewEmail string `json:"newEmail"`
CurrentPassword string `json:"currentPassword"`
}
EmailUpdateRequest represents a request to update email
type EmailUpdateResponse ¶
type EmailUpdateResponse struct {
Data *EmailUpdateData `json:"data"`
Meta *ProfileResponseMeta `json:"meta"`
}
EmailUpdateResponse represents the response for email update
type Mailer ¶
type Mailer interface {
SendUserApprovedEmail(ctx context.Context, to, username string) error
SendUserRejectedEmail(ctx context.Context, to, username string) error
SendUserSuspendedEmail(ctx context.Context, to, username, reason string) error
SendUserUnsuspendedEmail(ctx context.Context, to, username string) error
SendUserSoftDeletedEmail(ctx context.Context, to, username, reason string) error
SendAccountCreatedEmail(ctx context.Context, to, username, plainPassword string) error
}
Mailer sends the account emails user management triggers. It carries exactly the sends the handlers perform; the core email service satisfies it structurally.
type MarkUserAsSpamResponse ¶
MarkUserAsSpamResponse represents the response for mark as spam
type PasswordUpdateData ¶
type PasswordUpdateData struct {
Message string `json:"message"`
}
PasswordUpdateData represents password update data in the response
type PasswordUpdateRequest ¶
type PasswordUpdateRequest struct {
CurrentPassword string `json:"currentPassword"`
NewPassword string `json:"newPassword"`
}
PasswordUpdateRequest represents a request to update password
type PasswordUpdateResponse ¶
type PasswordUpdateResponse struct {
Data *PasswordUpdateData `json:"data"`
Meta *ProfileResponseMeta `json:"meta"`
}
PasswordUpdateResponse represents the response for password update
type PendingUser ¶
type PendingUser struct {
ID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
ProfilePicture string `json:"profilePicture,omitempty"`
EmailVerified bool `json:"emailVerified"`
CreatedAt time.Time `json:"createdAt"`
}
PendingUser represents a pending user in the response
type ProfileData ¶
type ProfileData struct {
Profile *ProfileInfo `json:"profile"`
}
ProfileData represents profile data in the response
type ProfileHandler ¶
type ProfileHandler struct {
// contains filtered or unexported fields
}
ProfileHandler handles profile management HTTP requests
func NewProfileHandler ¶
func NewProfileHandler( profileService userdomain.ProfileServiceInterface, accountDeletionService userdomain.AccountDeletionServiceInterface, logger kernel.Logger, userFieldsProvider userFieldsProvider, profilePictureURLBuilder func(string) string, ) *ProfileHandler
NewProfileHandler creates a new profile handler
func (*ProfileHandler) ChangePassword ¶
func (h *ProfileHandler) ChangePassword(w http.ResponseWriter, r *http.Request)
ChangePassword handles PUT /api/profile/password
func (*ProfileHandler) DeleteAccount ¶
func (h *ProfileHandler) DeleteAccount(w http.ResponseWriter, r *http.Request)
DeleteAccount handles DELETE /api/profile/account
func (*ProfileHandler) ExportUserData ¶
func (h *ProfileHandler) ExportUserData(w http.ResponseWriter, r *http.Request)
ExportUserData handles GET /api/profile/export
func (*ProfileHandler) GetProfile ¶
func (h *ProfileHandler) GetProfile(w http.ResponseWriter, r *http.Request)
GetProfile handles GET /api/profile
func (*ProfileHandler) GetUserFields ¶
func (h *ProfileHandler) GetUserFields(w http.ResponseWriter, r *http.Request)
GetUserFields handles GET /api/profile/user-fields
func (*ProfileHandler) UpdateCustomFields ¶
func (h *ProfileHandler) UpdateCustomFields(w http.ResponseWriter, r *http.Request)
UpdateCustomFields handles PUT /api/profile/custom-fields
func (*ProfileHandler) UpdateEmail ¶
func (h *ProfileHandler) UpdateEmail(w http.ResponseWriter, r *http.Request)
UpdateEmail handles PUT /api/profile/email
func (*ProfileHandler) UpdateName ¶
func (h *ProfileHandler) UpdateName(w http.ResponseWriter, r *http.Request)
UpdateName handles PUT /api/profile/name
func (*ProfileHandler) VerifyEmailUpdate ¶
func (h *ProfileHandler) VerifyEmailUpdate(w http.ResponseWriter, r *http.Request)
VerifyEmailUpdate handles GET /api/profile/verify-email This endpoint does NOT require authentication - the verification token is sufficient
type ProfileInfo ¶
type ProfileInfo struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name,omitempty"`
Email string `json:"email"`
Role string `json:"role"`
ProfilePicture string `json:"profilePicture,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CustomFields map[string]any `json:"customFields,omitempty"`
}
ProfileInfo represents user profile information
type ProfilePictureHandler ¶
type ProfilePictureHandler struct {
// contains filtered or unexported fields
}
ProfilePictureHandler handles profile picture HTTP requests
func NewProfilePictureHandler ¶
func NewProfilePictureHandler( service *profilepicture.Service, userRepo UserStore, logger kernel.Logger, ) *ProfilePictureHandler
NewProfilePictureHandler creates a new profile picture handler
func (*ProfilePictureHandler) AdminDeleteUserPicture ¶
func (h *ProfilePictureHandler) AdminDeleteUserPicture(w http.ResponseWriter, r *http.Request)
AdminDeleteUserPicture handles DELETE /api/admin/users/{id}/picture
func (*ProfilePictureHandler) AdminUploadUserPicture ¶
func (h *ProfilePictureHandler) AdminUploadUserPicture(w http.ResponseWriter, r *http.Request)
AdminUploadUserPicture handles PUT /api/admin/users/{id}/picture
func (*ProfilePictureHandler) DeleteProfilePicture ¶
func (h *ProfilePictureHandler) DeleteProfilePicture(w http.ResponseWriter, r *http.Request)
DeleteProfilePicture handles DELETE /api/profile/picture
func (*ProfilePictureHandler) UploadProfilePicture ¶
func (h *ProfilePictureHandler) UploadProfilePicture(w http.ResponseWriter, r *http.Request)
UploadProfilePicture handles PUT /api/profile/picture
type ProfileResponse ¶
type ProfileResponse struct {
Data *ProfileData `json:"data"`
Meta *ProfileResponseMeta `json:"meta"`
}
ProfileResponse represents the response for profile information
type ProfileResponseMeta ¶
type ProfileResponseMeta struct {
Timestamp string `json:"timestamp"`
}
ProfileResponseMeta represents metadata in profile response
type RejectUserResponse ¶
type RejectUserResponse struct {
Message string `json:"message"`
Username string `json:"username"`
Email string `json:"email"`
}
RejectUserResponse represents the response for reject user
type RestoreContentResponse ¶
type RestoreContentResponse struct {
Message string `json:"message"`
Content *RestoredContent `json:"content"`
}
RestoreContentResponse represents the response for restore content
type RestoredContent ¶
RestoredContent represents restored content details
type SoftDeleteContentRequest ¶
type SoftDeleteContentRequest struct {
Confirmed bool `json:"confirmed"`
Reason string `json:"reason"`
}
SoftDeleteContentRequest represents the request for soft delete
type SoftDeleteStore ¶
type SoftDeleteStore interface {
GetSoftDeletedContentByUser(ctx context.Context, userID int) ([]*SoftDeletedContent, error)
GetSoftDeletedContentByID(ctx context.Context, id int) (*SoftDeletedContent, error)
RestoreContent(ctx context.Context, contentType string, contentID int) error
}
SoftDeleteStore is the soft-delete repository subset the user management handler needs. The core soft-delete repository satisfies it via the core-side adapter (null-type conversion lives there).
type SoftDeleteUserResponse ¶
type SoftDeleteUserResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
DeletedContentCount int `json:"deletedContentCount"`
}
SoftDeleteUserResponse represents the response for soft delete user
type SoftDeletedContent ¶
type SoftDeletedContent struct {
ID int
ContentType string
ContentID int
DeletedAt string
DeletedBy int
Reason string
HasReason bool
}
SoftDeletedContent mirrors the soft-deleted content record without database null types: the core adapter converts them at the boundary.
type SuspendUserResponse ¶
type SuspendUserResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
}
SuspendUserResponse represents the response for suspend user
type UnsuspendUserResponse ¶
type UnsuspendUserResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
}
UnsuspendUserResponse represents the response for unsuspend user
type UpdateUserProfileRequest ¶
type UpdateUserProfileRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Role string `json:"role"`
CustomFields map[string]any `json:"customFields,omitempty"`
}
UpdateUserProfileRequest represents the request body for updating a user profile
type UpdateUserProfileResponse ¶
type UpdateUserProfileResponse struct {
Message string `json:"message"`
User *UserDetail `json:"user"`
}
UpdateUserProfileResponse represents the response for updating a user profile
type UserDetail ¶
type UserDetail struct {
ID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Role string `json:"role,omitempty"`
Status string `json:"status"`
ProfilePicture string `json:"profilePicture,omitempty"`
CustomFields map[string]any `json:"customFields,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
UserDetail represents user details in responses
type UserInList ¶
type UserInList struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name,omitempty"`
Email string `json:"email"`
Status string `json:"status"`
Role string `json:"role"`
ProfilePicture string `json:"profilePicture,omitempty"`
CustomFields map[string]any `json:"customFields,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
UserInList represents a user in the list response
type UserManagementHandler ¶
type UserManagementHandler struct {
// contains filtered or unexported fields
}
UserManagementHandler handles user management HTTP requests
func NewUserManagementHandler ¶
func NewUserManagementHandler( userService *userdomain.UserManagementService, adminCreateService *userdomain.AdminCreateUserService, userRepo UserStore, softDeleteRepo SoftDeleteStore, emailService Mailer, logger kernel.Logger, profilePictureURLBuilder func(string) string, ) *UserManagementHandler
NewUserManagementHandler creates a new user management handler
func (*UserManagementHandler) ApproveUser ¶
func (h *UserManagementHandler) ApproveUser(w http.ResponseWriter, r *http.Request)
ApproveUser handles POST /api/admin/users/:id/approve
func (*UserManagementHandler) CreateUser ¶
func (h *UserManagementHandler) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser handles POST /api/admin/users
func (*UserManagementHandler) GetAllUsers ¶
func (h *UserManagementHandler) GetAllUsers(w http.ResponseWriter, r *http.Request)
GetAllUsers handles GET /api/admin/users
func (*UserManagementHandler) GetPendingUsers ¶
func (h *UserManagementHandler) GetPendingUsers(w http.ResponseWriter, r *http.Request)
GetPendingUsers handles GET /api/admin/pending-users
func (*UserManagementHandler) GetSoftDeletedContent ¶
func (h *UserManagementHandler) GetSoftDeletedContent(w http.ResponseWriter, r *http.Request)
GetSoftDeletedContent handles GET /api/admin/users/:id/deleted-content
func (*UserManagementHandler) MarkUserAsSpam ¶
func (h *UserManagementHandler) MarkUserAsSpam(w http.ResponseWriter, r *http.Request)
MarkUserAsSpam handles POST /api/admin/users/:id/mark-spam
func (*UserManagementHandler) RejectUser ¶
func (h *UserManagementHandler) RejectUser(w http.ResponseWriter, r *http.Request)
RejectUser handles POST /api/admin/users/:id/reject
func (*UserManagementHandler) RestoreContent ¶
func (h *UserManagementHandler) RestoreContent(w http.ResponseWriter, r *http.Request)
RestoreContent handles POST /api/admin/content/:id/restore
func (*UserManagementHandler) SoftDeleteUser ¶
func (h *UserManagementHandler) SoftDeleteUser(w http.ResponseWriter, r *http.Request)
SoftDeleteUser handles POST /api/admin/users/:id/soft-delete
func (*UserManagementHandler) SuspendUser ¶
func (h *UserManagementHandler) SuspendUser(w http.ResponseWriter, r *http.Request)
SuspendUser handles POST /api/admin/users/:id/suspend
func (*UserManagementHandler) UnsuspendUser ¶
func (h *UserManagementHandler) UnsuspendUser(w http.ResponseWriter, r *http.Request)
UnsuspendUser handles POST /api/admin/users/:id/unsuspend
func (*UserManagementHandler) UpdateUser ¶
func (h *UserManagementHandler) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser handles PUT /api/admin/users/:id
type VerifyEmailUpdateData ¶
VerifyEmailUpdateData represents email verification data in the response
type VerifyEmailUpdateResponse ¶
type VerifyEmailUpdateResponse struct {
Data *VerifyEmailUpdateData `json:"data"`
Meta *ProfileResponseMeta `json:"meta"`
}
VerifyEmailUpdateResponse represents the response for email verification