refactor: sql queries related to privacy-accounting;
chore: regenerated swagger; feat: utilizing new 410 error when user is banned/unavailable/deleted
This commit is contained in:
@@ -120,8 +120,12 @@ func (ctrl *ProfileController) getProfileByUsername(c *gin.Context) {
|
||||
response, err := ctrl.ps.GetProfileByUsername(cinfo, username); if err != nil {
|
||||
if errors.Is(err, errs.ErrNotFound) {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "Profile not found"})
|
||||
} else if errors.Is(err, errs.ErrUnauthorized) {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{"error": "Profile avaiable to authrorized users only"})
|
||||
} else if errors.Is(err, errs.ErrForbidden) {
|
||||
c.JSON(http.StatusForbidden, gin.H{"error": "Access restricted by profile's privacy settings"})
|
||||
} else if errors.Is(err, errs.ErrGone) {
|
||||
c.JSON(http.StatusGone, gin.H{"error": "Profile no longer available"})
|
||||
} else {
|
||||
c.Status(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user