Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor backend #495

Merged
merged 17 commits into from
Dec 9, 2024
Merged

Refactor backend #495

merged 17 commits into from
Dec 9, 2024

Conversation

melihakpinar
Copy link
Contributor

@melihakpinar melihakpinar commented Dec 9, 2024

Overview

This PR implements several key features and improvements to enhance the user experience and functionality of our platform:

  1. User Profile System
  2. Post Scoring & Recommendation Logic
  3. Improved Post Management
  4. Enhanced Subforum Features

Key Changes

User Profile System

  • Implemented comprehensive /api/user/profile endpoint that returns:
    • Basic user info (username, avatar)
    • Activity metrics (post count, follower count)
    • Follow relationship status
    • Curated lists of popular and recent posts
  • Fixed setUserDetails endpoint to properly handle profile photo uploads
  • Added proper user type/tag information in API responses

Post Scoring & Feed Algorithms

  • Implemented sophisticated post scoring for different feed types:
    • For You: Posts are scored based on:
      • User tag match (+3 points)
      • Comment creator tag match (+2 points)
      • General engagement (+1 point per comment)
      • Like/dislike ratio
    • Popular: Posts are ranked by engagement:
      • Likes (+1 point)
      • Comments (+2 points)
      • Dislikes (+1 point)
    • Recent: Pure chronological order with engagement boost:
      • Base chronological sorting

Post Management Improvements

  • Added view count tracking for posts
  • Implemented proper date fields for posts and comments
  • Added admin privileges for content moderation
  • Enhanced image handling with UUID-based filenames

Subforum Enhancements

  • Added color field for visual customization
  • Implemented admin-only subforum management
  • Added proper validation and error handling

Technical Details

New Models & Repositories

  • Enhanced repository interfaces for:
    • Posts
    • Comments
    • Subforums
    • Likes/Dislikes
    • Follows

File Structure Improvements

  • Reorganized service layer for better separation of concerns
  • Consolidated related functionalities into appropriate services
  • Improved consistency in response formats

Security & Permissions

  • Added proper admin role checks for sensitive operations
  • Implemented user authentication validation
  • Added ownership verification for content modification

Impact

This PR significantly improves the platform's social features and content discovery mechanisms. The new scoring algorithms provide more relevant content to users while maintaining engagement through proper content organization and discovery.

@melihakpinar melihakpinar added Enhancement New feature or request Priority: High Requires taking action ASAP Dependent dependent to other issues Optimization Enhance efficiency through code and system optimization Backend Fix labels Dec 9, 2024
@melihakpinar melihakpinar merged commit 7f8192b into main Dec 9, 2024
@melihakpinar melihakpinar deleted the refactor-post-logic branch December 9, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Dependent dependent to other issues Enhancement New feature or request Fix Optimization Enhance efficiency through code and system optimization Priority: High Requires taking action ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant