24 lines
587 B
Go
24 lines
587 B
Go
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)
|
|
}
|