Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

remove unused repository methods

Dave Earley03ac11c2f87e
diff --git a/backend/app/Repository/Eloquent/EventRepository.php b/backend/app/Repository/Eloquent/EventRepository.php
index 86e62b710..6ed407fee 100644
--- a/backend/app/Repository/Eloquent/EventRepository.php
+++ b/backend/app/Repository/Eloquent/EventRepository.php
@@ -46,65 +46,4 @@ class EventRepository extends BaseRepository implements EventRepositoryInterface
page: $params->page,
);
}
-
- public function getAvailableTicketQuantities(int $eventId): Collection
- {
- $reserved = OrderStatus::RESERVED->name;
-
- $query = <<<SQL
- WITH reserved_quantities AS (
- SELECT order_items.ticket_id,
- order_items.ticket_price_id,
- SUM(order_items.quantity) AS quantity_reserved
- FROM orders
- INNER JOIN order_items ON order_items.order_id = orders.id
- WHERE orders.event_id = :eventId
- AND orders.status = :reserved
- AND orders.reserved_until > NOW()
- AND orders.deleted_at IS NULL
- GROUP BY order_items.ticket_id, order_items.ticket_price_id
- ),
- capacity_reserved AS (
- SELECT ticket_capacity_assignments.ticket_id,
- ticket_capacity_assignments.capacity_assignment_id,
- SUM(order_items.quantity) AS quantity_reserved
- FROM orders
- INNER JOIN order_items ON order_items.order_id = orders.id
- INNER JOIN ticket_capacity_assignments ON order_items.ticket_id = ticket_capacity_assignments.ticket_id
- WHERE orders.event_id = :eventId
- AND orders.status = :reserved
- AND orders.reserved_until > NOW()
- AND orders.deleted_at IS NULL
- GROUP BY ticket_capacity_assignments.ticket_id, ticket_capacity_assignments.capacity_assignment_id
- ),
- min_capacity AS (
- SELECT ticket_capacity_assignments.ticket_id,
- MIN(capacity_assignments.capacity - capacity_assignments.used_capacity - COALESCE(capacity_reserved.quantity_reserved, 0)) AS remaining_capacity
- FROM ticket_capacity_assignments
- INNER JOIN capacity_assignments ON ticket_capacity_assignments.capacity_assignment_id = capacity_assignments.id
- LEFT JOIN capacity_reserved ON ticket_capacity_assignments.ticket_id = capacity_reserved.ticket_id
- AND ticket_capacity_assignments.capacity_assignment_id = capacity_reserved.capacity_assignment_id
- WHERE capacity_assignments.deleted_at IS NULL
- GROUP BY ticket_capacity_assignments.ticket_id
- )
- SELECT
- tickets.id AS ticket_id,
- ticket_prices.id AS price_id,
- tickets.title AS ticket_title,
- ticket_prices.label AS price_label,
- LEAST(
- ticket_prices.initial_quantity_available - ticket_prices.quantity_sold - COALESCE(reserved_quantities.quantity_reserved, 0),
- COALESCE(min_capacity.remaining_capacity, ticket_prices.initial_quantity_available - ticket_prices.quantity_sold - COALESCE(reserved_quantities.quantity_reserved, 0))
- ) AS quantity_available
- FROM ticket_prices
- INNER JOIN tickets ON ticket_prices.ticket_id = tickets.id
- LEFT JOIN reserved_quantities ON ticket_prices.id = reserved_quantities.ticket_price_id
- LEFT JOIN min_capacity ON tickets.id = min_capacity.ticket_id
- WHERE tickets.event_id = :eventId
- AND tickets.deleted_at IS NULL
- AND ticket_prices.deleted_at IS NULL
- ORDER BY ticket_prices.id;
-SQL;
- return collect($this->db->select($query, ['eventId' => $eventId, 'reserved' => $reserved]));
- }
}
diff --git a/backend/app/Repository/Eloquent/OrderRepository.php b/backend/app/Repository/Eloquent/OrderRepository.php
index ca3c729fb..43cec9058 100644
--- a/backend/app/Repository/Eloquent/OrderRepository.php
+++ b/backend/app/Repository/Eloquent/OrderRepository.php
@@ -87,27 +87,6 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
return $this->findFirstByField('short_id', $orderShortId);
}
- public function getReservedQuantityForTicketPrice(int $ticketId, int $ticketPriceId): int
- {
- $query = <<<SQL
- SELECT COALESCE(SUM(order_items.quantity), 0) as reserved_quantity
- FROM orders
- INNER JOIN order_items ON orders.id = order_items.order_id
- WHERE order_items.ticket_id = :ticketId AND order_items.ticket_price_id = :ticketPriceId
- AND orders.status = 'RESERVED'
- AND current_timestamp < orders.reserved_until
- AND orders.deleted_at IS NULL
- AND order_items.deleted_at IS NULL
- SQL;
-
- $result = $this->db->selectOne($query, [
- 'ticketId' => $ticketId,
- 'ticketPriceId' => $ticketPriceId,
- ]);
-
- return (int)$result->reserved_quantity;
- }
-
public function getDomainObject(): string
{
return OrderDomainObject::class;
diff --git a/backend/app/Repository/Interfaces/EventRepositoryInterface.php b/backend/app/Repository/Interfaces/EventRepositoryInterface.php
index e77e035fa..e353cecd7 100644
--- a/backend/app/Repository/Interfaces/EventRepositoryInterface.php
+++ b/backend/app/Repository/Interfaces/EventRepositoryInterface.php
@@ -15,7 +15,5 @@ use HiEvents\Repository\Eloquent\BaseRepository;
*/
interface EventRepositoryInterface extends RepositoryInterface
{
- public function getAvailableTicketQuantities(int $eventId): Collection;
-
public function findEvents(array $where, QueryParamsDTO $params): LengthAwarePaginator;
}
diff --git a/backend/app/Repository/Interfaces/OrderRepositoryInterface.php b/backend/app/Repository/Interfaces/OrderRepositoryInterface.php
index 199c8d8a1..d7abbbdba 100644
--- a/backend/app/Repository/Interfaces/OrderRepositoryInterface.php
+++ b/backend/app/Repository/Interfaces/OrderRepositoryInterface.php
@@ -24,6 +24,4 @@ interface OrderRepositoryInterface extends RepositoryInterface
public function addOrderItem(array $data): OrderItemDomainObject;
public function findByShortId(string $orderShortId): ?OrderDomainObject;
-
- public function getReservedQuantityForTicketPrice(int $ticketId, int $ticketPriceId): int;
}