Recommendation API

This commit is contained in:
2024-07-23 16:12:19 +08:00
parent 8429d72ad1
commit 2cf24c4724
7 changed files with 143 additions and 44 deletions

View File

@@ -4,12 +4,23 @@ import (
"context"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/models"
"github.com/rs/zerolog/log"
"time"
)
func ModifyPosterVoteCount(user models.Account, isUpvote bool, delta int) error {
if isUpvote {
user.TotalUpvote += delta
} else {
user.TotalDownvote += delta
}
return database.C.Save(&user).Error
}
func NotifyPosterAccount(user models.Account, title, body string, subtitle *string) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()