package utils import ( "git.anthrove.art/Anthrove/gorse-playground/pkg/models" "github.com/anthrove/openapi-e621-go" "strconv" ) func ConvertE6ToGorse(userId string, posts []openapi.Post) ([]models.GorseItem, []models.GorseFavorite, error) { faves := make([]models.GorseFavorite, 0) items := make([]models.GorseItem, 0) for _, post := range posts { tags := make([]string, 0) tags = append(tags, post.Tags.Artist...) tags = append(tags, post.Tags.Character...) tags = append(tags, post.Tags.Contributor...) tags = append(tags, post.Tags.Copyright...) tags = append(tags, post.Tags.General...) tags = append(tags, post.Tags.Invalid...) tags = append(tags, post.Tags.Lore...) tags = append(tags, post.Tags.Meta...) tags = append(tags, post.Tags.Species...) items = append(items, models.GorseItem{ Comment: post.Description, IsHidden: post.Flags.Deleted, ItemId: strconv.Itoa(int(post.Id)), Labels: tags, Timestamp: post.CreatedAt.String(), }) faves = append(faves, models.GorseFavorite{ Comment: post.Description, FeedbackType: "like", ItemId: strconv.Itoa(int(post.Id)), UserId: userId, }) } return items, faves, nil }