Add notification settings, account deletion, photo reporting, and pending-user photos
Addresses user bug reports: settings pages needed real notification preferences and account deletion, admin needed a way to flag a specific photo independent of deleting it, and the pending-approval users list needed to surface applicant photos for review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -170,3 +170,34 @@ func (h *ProfileHandler) CheckIn(c *gin.Context) {
|
||||
}
|
||||
utils.Success(c, http.StatusOK, "", result)
|
||||
}
|
||||
|
||||
// UpdateNotificationSettings PATCH /profile/notifications
|
||||
func (h *ProfileHandler) UpdateNotificationSettings(c *gin.Context) {
|
||||
user, ok := currentUser(c)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
var req dto.UpdateNotificationSettingsRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
utils.Fail(c, http.StatusBadRequest, "ورودی نامعتبر است", err.Error())
|
||||
return
|
||||
}
|
||||
if err := h.profileService.UpdateNotificationSettings(user, req); err != nil {
|
||||
utils.Fail(c, http.StatusInternalServerError, "خطا در ذخیرهی تنظیمات اعلان", nil)
|
||||
return
|
||||
}
|
||||
utils.Success(c, http.StatusOK, "تنظیمات اعلان ذخیره شد", nil)
|
||||
}
|
||||
|
||||
// DeleteAccount DELETE /profile/me — غیرفعال کردن (soft delete) حساب کاربر
|
||||
func (h *ProfileHandler) DeleteAccount(c *gin.Context) {
|
||||
user, ok := currentUser(c)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if err := h.profileService.DeleteAccount(user); err != nil {
|
||||
utils.Fail(c, http.StatusInternalServerError, "خطا در حذف حساب", nil)
|
||||
return
|
||||
}
|
||||
utils.Success(c, http.StatusOK, "حساب کاربری غیرفعال شد", nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user