feat(privacy): add user privacy settings and account deletion system
Add privacy settings allowing users to control visibility of their followers, following, posts, and favorites lists with three visibility levels: everyone, following, and self. Also implement account deletion workflow with 30-day cooldown period. - Add PrivacySettings model with visibility levels - Add DTOs for privacy settings and account deletion - Add repository methods for privacy settings and deletion - Add service methods to check visibility permissions - Add handlers for get/update privacy settings and account deletion - Add new routes for privacy settings and account management - Add account cleanup service for hard-deleting expired accounts - Modify login to cancel deletion when user logs in BREAKING CHANGE: Users with pending_deletion status can no longer log in; logging in now automatically cancels deletion requests.
This commit is contained in:
@@ -187,6 +187,15 @@ func (r *Router) setupRoutes() {
|
||||
users.POST("/change-password/send-code", authMiddleware, r.userHandler.SendChangePasswordCode)
|
||||
users.POST("/change-password", authMiddleware, r.userHandler.ChangePassword)
|
||||
|
||||
// 隐私设置
|
||||
users.GET("/me/privacy", authMiddleware, r.userHandler.GetPrivacySettings)
|
||||
users.PUT("/me/privacy", authMiddleware, r.userHandler.UpdatePrivacySettings)
|
||||
|
||||
// 账号注销
|
||||
users.POST("/me/deactivate", authMiddleware, r.userHandler.RequestAccountDeletion)
|
||||
users.DELETE("/me/deactivate", authMiddleware, r.userHandler.CancelAccountDeletion)
|
||||
users.GET("/me/deletion-status", authMiddleware, r.userHandler.GetDeletionStatus)
|
||||
|
||||
// 当前用户角色
|
||||
if r.roleHandler != nil {
|
||||
users.GET("/me/roles", authMiddleware, r.roleHandler.GetMyRoles)
|
||||
|
||||
Reference in New Issue
Block a user