package handlers

import (
	"github.com/fiskerinc/cloud-services/services/depot/services"

	"github.com/fiskerinc/cloud-services/pkg/redis"
)

func TRexDel(id string) error {
	client := services.RedisClientPool().GetFromPool()
	defer client.Close()

	err := removeTRexSession(client, id)
	if err != nil {
		return err
	}

	return nil
}

func removeTRexSession(client redis.Client, id string) error {
	_, err := client.Execute("SREM", redis.CarSessionsKey(), id)
	return err
}
