feat: 添加搜索收藏微服务

This commit is contained in:
zetaloop
2026-04-24 13:24:58 +08:00
parent 91fdd2a498
commit 53d0e791b4
58 changed files with 6239 additions and 57 deletions
@@ -0,0 +1,23 @@
package favorites
import (
"strconv"
"time"
"juwan-backend/app/search/api/internal/types"
"juwan-backend/app/search/rpc/searchservice"
)
func toAPIFavorite(f *searchservice.Favorites) types.Favorite {
return types.Favorite{
Id: strconv.FormatInt(f.GetId(), 10),
UserId: strconv.FormatInt(f.GetUserId(), 10),
TargetType: f.GetTargetType(),
TargetId: strconv.FormatInt(f.GetTargetId(), 10),
CreatedAt: time.Unix(f.GetCreatedAt(), 0).Format(time.RFC3339),
}
}
func parseSnowflakeID(value string) (int64, error) {
return strconv.ParseInt(value, 10, 64)
}