feat: 添加了social的关注功能

This commit is contained in:
Leon
2025-12-19 19:03:42 +08:00
parent 7e97fc5026
commit d2f40acf4d
6 changed files with 340 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"feedsystem_video_go/internal/account"
"feedsystem_video_go/internal/feed"
"feedsystem_video_go/internal/middleware"
"feedsystem_video_go/internal/social"
"feedsystem_video_go/internal/video"
"github.com/gin-gonic/gin"
@@ -73,6 +74,19 @@ func SetRouter(db *gorm.DB) *gin.Engine {
protectedCommentGroup.POST("/publish", commentHandler.PublishComment)
protectedCommentGroup.POST("/delete", commentHandler.DeleteComment)
}
// social
socialRepository := social.NewSocialRepository(db)
socialService := social.NewSocialService(socialRepository, accountRepository)
socialHandler := social.NewSocialHandler(socialService)
socialGroup := r.Group("/social")
protectedSocialGroup := socialGroup.Group("")
protectedSocialGroup.Use(middleware.JWTAuth(accountRepository))
{
protectedSocialGroup.POST("/follow", socialHandler.Follow)
protectedSocialGroup.POST("/unfollow", socialHandler.Unfollow)
protectedSocialGroup.POST("/getAllFollowers", socialHandler.GetAllFollowers)
protectedSocialGroup.POST("/getAllVloggers", socialHandler.GetAllVloggers)
}
// feed
feedRepository := feed.NewFeedRepository(db)
feedService := feed.NewFeedService(feedRepository, likeRepository)