feat: 添加搜索收藏微服务
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user