From fad286b29af63aabab27f837512b0d51751dd700 Mon Sep 17 00:00:00 2001 From: sivertlv Date: Thu, 29 Oct 2026 17:31:10 +0100 Subject: [PATCH] Add backend filtering for search and map venues --- apps/backend/src/schema/schema.ts | 374 +++++++++++++++--- apps/frontend/src/components/NearbyVenues.tsx | 8 +- apps/frontend/src/components/SearchBox.tsx | 123 ++++-- .../frontend/src/components/SearchFilters.tsx | 194 +++++++++ apps/frontend/src/lib/search-filters.ts | 59 +++ apps/frontend/src/routes/index.tsx | 53 ++- apps/frontend/src/types/search.ts | 12 + packages/db/src/index.ts | 2 +- 8 files changed, 727 insertions(+), 98 deletions(-) create mode 100644 apps/frontend/src/components/SearchFilters.tsx create mode 100644 apps/frontend/src/lib/search-filters.ts diff --git a/apps/backend/src/schema/schema.ts b/apps/backend/src/schema/schema.ts index 3224e61..4a55898 100644 --- a/apps/backend/src/schema/schema.ts +++ b/apps/backend/src/schema/schema.ts @@ -1,11 +1,8 @@ -import { prisma } from '@t09-project-2/db' +import { GlassSize, Prisma, prisma } from '@t09-project-2/db' import type { OpeningHours, PriceSighting } from '@t09-project-2/db' import { builder } from '../builder.js' -import { - latestPriceSightings, - latestUnlimitedSighting, -} from './price-sightings.js' +import { latestPriceSightings } from './price-sightings.js' import type { VenueWithPriceSightings } from './price-sightings.js' builder.prismaObject('Venue', { @@ -71,6 +68,16 @@ const priceSightingRef = builder.prismaObject('PriceSighting', { }), }) +const glassSizeRef = builder.enumType('GlassSize', { + values: { + PINT: { value: GlassSize.PINT }, + HALF_LITER: { value: GlassSize.HALF_LITER }, + QUARTER_LITER: { value: GlassSize.QUARTER_LITER }, + BOX: { value: GlassSize.BOX }, + OTHER: { value: GlassSize.OTHER }, + }, +}) + type SearchResultItem = { id: string cityId: string | null @@ -78,9 +85,12 @@ type SearchResultItem = { name: string lat: number lon: number + distanceKm: number | null address: string | null openingHours: OpeningHours[] | null latestPriceSighting: PriceSighting | null + averageRating: number | null + reviewCount: number } const searchResultRef = builder @@ -93,6 +103,7 @@ const searchResultRef = builder name: t.exposeString('name'), lat: t.exposeFloat('lat'), lon: t.exposeFloat('lon'), + distanceKm: t.exposeFloat('distanceKm', { nullable: true }), address: t.exposeString('address', { nullable: true }), openingHours: t.expose('openingHours', { type: [openingHoursRef], @@ -102,6 +113,8 @@ const searchResultRef = builder type: priceSightingRef, nullable: true, }), + averageRating: t.exposeFloat('averageRating', { nullable: true }), + reviewCount: t.exposeInt('reviewCount'), }), }) @@ -113,6 +126,161 @@ function applyLatestPriceSightings(venues: VenueWithPriceSightings[]) { } } +type SearchVenueRow = { + id: string + distance_km: number | null + average_rating: number | null + review_count: number + price_sighting_id: string | null +} + +type VenueFilters = { + term: string | null + lat: number | null + lon: number | null + maxDistanceKm: number | null + minPrice: number | null + maxPrice: number | null + sizes: GlassSize[] + minRating: number | null +} + +type VenueQueryOptions = { + orderByDistance?: boolean + limit?: number | null +} + +/** + * Applies every venue filter in Postgres so the client never has to download + * and filter the full data set. Price filters look at the latest regular + * (unrestricted) sighting for each serving size, which is also the price the + * result cards display. + */ +async function findFilteredVenues( + filters: VenueFilters, + options: VenueQueryOptions = {}, +) { + const sizes = [...new Set(filters.sizes)] + const minPrice = + filters.minPrice != null && filters.minPrice >= 0 ? filters.minPrice : null + const maxPrice = + filters.maxPrice != null && filters.maxPrice >= 0 ? filters.maxPrice : null + const minRating = + filters.minRating == null + ? null + : Math.min(5, Math.max(0, filters.minRating)) + + const hasPriceFilter = + sizes.length > 0 || minPrice != null || maxPrice != null + + const conditions: Prisma.Sql[] = [] + + if (filters.term) { + const contains = `%${filters.term}%` + + conditions.push( + Prisma.sql`(v.name ILIKE ${contains} OR v.address ILIKE ${contains})`, + ) + } + + if ( + filters.lat != null && + filters.lon != null && + filters.maxDistanceKm != null + ) { + const maxDistanceMeters = Math.max(0, filters.maxDistanceKm) * 1000 + + conditions.push( + Prisma.sql`haversine_distance(${filters.lat}::double precision, ${filters.lon}::double precision, v.lat, v.lon) <= ${maxDistanceMeters}::double precision`, + ) + } + + if (minRating != null) { + conditions.push(Prisma.sql`ratings.average_rating >= ${minRating}`) + } + + const priceConditions: Prisma.Sql[] = [] + + if (sizes.length > 0) { + priceConditions.push(Prisma.sql`lp.size::text IN (${Prisma.join(sizes)})`) + } + + if (minPrice != null) { + priceConditions.push(Prisma.sql`lp.price >= ${minPrice}`) + } + + if (maxPrice != null) { + priceConditions.push(Prisma.sql`lp.price <= ${maxPrice}`) + } + + if (hasPriceFilter) { + conditions.push(Prisma.sql`matching_prices.id IS NOT NULL`) + } + + const matchingPriceWhere = + priceConditions.length > 0 + ? Prisma.sql`WHERE ${Prisma.join(priceConditions, ' AND ')}` + : Prisma.empty + + const distanceExpression = + filters.lat != null && filters.lon != null + ? Prisma.sql`haversine_distance(${filters.lat}::double precision, ${filters.lon}::double precision, v.lat, v.lon) / 1000` + : Prisma.sql`NULL::double precision` + + const orderBy = + options.orderByDistance && filters.lat != null && filters.lon != null + ? Prisma.sql`distance_km ASC, v.name ASC` + : Prisma.sql`v.name ASC` + const limit = options.limit == null ? null : Math.max(0, options.limit) + + return prisma.$queryRaw(Prisma.sql` + WITH latest_regular_prices AS ( + SELECT DISTINCT ON (ps.venue_id, ps.size, ps.size_ml) + ps.id, + ps.venue_id, + ps.size, + ps.size_ml, + ps.price, + ps.time_sighted + FROM price_sighting ps + WHERE cardinality(ps.limitation) = 0 + ORDER BY ps.venue_id, ps.size, ps.size_ml, ps.time_sighted DESC + ), + matching_prices AS ( + SELECT DISTINCT ON (lp.venue_id) + lp.venue_id, + lp.id + FROM latest_regular_prices lp + ${matchingPriceWhere} + ORDER BY lp.venue_id, lp.time_sighted DESC + ), + ratings AS ( + SELECT + r.venue_id, + AVG(r.rating)::double precision AS average_rating, + COUNT(*)::integer AS review_count + FROM review r + GROUP BY r.venue_id + ) + SELECT + v.id, + ${distanceExpression} AS distance_km, + ratings.average_rating, + COALESCE(ratings.review_count, 0) AS review_count, + matching_prices.id AS price_sighting_id + FROM venue v + LEFT JOIN ratings ON ratings.venue_id = v.id + LEFT JOIN matching_prices ON matching_prices.venue_id = v.id + ${ + conditions.length > 0 + ? Prisma.sql`WHERE ${Prisma.join(conditions, ' AND ')}` + : Prisma.empty + } + ORDER BY ${orderBy} + LIMIT ${limit}::integer + `) +} + builder.queryType({ fields: (t) => ({ venue: t.prismaField({ @@ -128,40 +296,50 @@ builder.queryType({ description: 'Only return venues within this distance in kilometres of lat/lon.', }), + minPrice: t.arg.float({ + description: + 'Only return venues with a latest regular price of at least this amount (NOK).', + }), + maxPrice: t.arg.float({ + description: + 'Only return venues with a latest regular price of at most this amount (NOK).', + }), + sizes: t.arg({ + type: [glassSizeRef], + description: + 'Only return venues with a latest regular price for at least one of these serving sizes.', + }), + minRating: t.arg.float({ + description: + 'Only return venues whose average review rating is at least this value.', + }), }, resolve: async (query, _parent, args) => { - if (args.lat == null || args.lon == null) { - const venues = await prisma.venue.findMany({ ...query }) - - applyLatestPriceSightings(venues as VenueWithPriceSightings[]) - - return venues - } - - // haversine_distance returns metres. A null radius/limit means "no - // restriction"; Postgres treats LIMIT NULL as no limit. - const maxDistanceMeters = - args.maxDistanceKm == null - ? null - : Math.max(0, args.maxDistanceKm) * 1000 - const limit = args.limit == null ? null : Math.max(0, args.limit) - - const nearest = await prisma.$queryRaw<{ id: string }[]>` - SELECT id FROM venue - WHERE ${maxDistanceMeters}::double precision IS NULL - OR haversine_distance(${args.lat}, ${args.lon}, lat, lon) <= ${maxDistanceMeters}::double precision - ORDER BY haversine_distance(${args.lat}, ${args.lon}, lat, lon), name - LIMIT ${limit}::integer - ` + const rows = await findFilteredVenues( + { + term: null, + lat: args.lat ?? null, + lon: args.lon ?? null, + maxDistanceKm: args.maxDistanceKm ?? null, + minPrice: args.minPrice ?? null, + maxPrice: args.maxPrice ?? null, + sizes: args.sizes ?? [], + minRating: args.minRating ?? null, + }, + { + orderByDistance: args.lat != null && args.lon != null, + limit: args.limit, + }, + ) const venues = await prisma.venue.findMany({ ...query, - where: { id: { in: nearest.map((venue) => venue.id) } }, + where: { id: { in: rows.map((row) => row.id) } }, }) const byId = new Map(venues.map((venue) => [venue.id, venue] as const)) - const sorted = nearest.flatMap((row) => { + const sorted = rows.flatMap((row) => { const venue = byId.get(row.id) return venue ? [venue] : [] }) @@ -191,42 +369,115 @@ builder.queryType({ type: [searchResultRef], args: { term: t.arg.string({ required: true }), + lat: t.arg.float({ + description: + 'Latitude used to calculate distance to each venue and to filter by distance.', + }), + lon: t.arg.float({ + description: + 'Longitude used to calculate distance to each venue and to filter by distance.', + }), + maxDistanceKm: t.arg.float({ + description: + 'Only return venues within this many kilometres of lat/lon.', + }), + minPrice: t.arg.float({ + description: + 'Only return venues with a latest regular price of at least this amount (NOK).', + }), + maxPrice: t.arg.float({ + description: + 'Only return venues with a latest regular price of at most this amount (NOK).', + }), + sizes: t.arg({ + type: [glassSizeRef], + description: + 'Only return venues with a latest regular price for at least one of these serving sizes.', + }), + minRating: t.arg.float({ + description: + 'Only return venues whose average review rating is at least this value.', + }), }, resolve: async (_parent, args) => { - const contains = { - contains: args.term, - mode: 'insensitive' as const, - } - - const [venues, cities] = await Promise.all([ - prisma.venue.findMany({ - where: { - OR: [{ name: contains }, { address: contains }], - }, - include: { - openingHours: true, - pricesSighted: true, - }, - orderBy: { name: 'asc' }, - }), - prisma.city.findMany({ - where: { name: contains }, - orderBy: { name: 'asc' }, + const sizes = args.sizes ?? [] + const hasVenueFilters = + sizes.length > 0 || + args.minPrice != null || + args.maxPrice != null || + args.minRating != null || + (args.lat != null && args.lon != null && args.maxDistanceKm != null) + + const [rows, cities] = await Promise.all([ + findFilteredVenues({ + term: args.term, + lat: args.lat ?? null, + lon: args.lon ?? null, + maxDistanceKm: args.maxDistanceKm ?? null, + minPrice: args.minPrice ?? null, + maxPrice: args.maxPrice ?? null, + sizes, + minRating: args.minRating ?? null, }), + hasVenueFilters + ? Promise.resolve([]) + : prisma.city.findMany({ + where: { + name: { + contains: args.term, + mode: 'insensitive', + }, + }, + orderBy: { name: 'asc' }, + }), ]) + const venues = + rows.length === 0 + ? [] + : await prisma.venue.findMany({ + where: { id: { in: rows.map((row) => row.id) } }, + include: { + openingHours: true, + pricesSighted: true, + }, + }) + + const venuesById = new Map( + venues.map((venue) => [venue.id, venue] as const), + ) + + const venueResults = rows.flatMap((row) => { + const venue = venuesById.get(row.id) + + if (!venue) return [] + + const latestPriceSighting = row.price_sighting_id + ? (venue.pricesSighted.find( + (sighting) => sighting.id === row.price_sighting_id, + ) ?? null) + : null + + return [ + { + id: venue.id, + cityId: venue.cityId, + type: 'venue' as const, + name: venue.name, + lat: venue.lat, + lon: venue.lon, + distanceKm: row.distance_km, + address: venue.address, + openingHours: venue.openingHours, + latestPriceSighting, + averageRating: row.average_rating, + reviewCount: row.review_count, + }, + ] + }) + return [ - ...venues.map((venue) => ({ - id: venue.id, - cityId: venue.cityId, - type: 'venue' as const, - name: venue.name, - lat: venue.lat, - lon: venue.lon, - address: venue.address, - openingHours: venue.openingHours, - latestPriceSighting: latestUnlimitedSighting(venue.pricesSighted), - })), + ...venueResults, ...cities.map((city) => ({ id: city.id, cityId: null, @@ -234,9 +485,12 @@ builder.queryType({ name: city.name, lat: city.centreLat, lon: city.centreLon, + distanceKm: null, address: null, openingHours: null, latestPriceSighting: null, + averageRating: null, + reviewCount: 0, })), ] }, diff --git a/apps/frontend/src/components/NearbyVenues.tsx b/apps/frontend/src/components/NearbyVenues.tsx index 43642f7..5948bd9 100644 --- a/apps/frontend/src/components/NearbyVenues.tsx +++ b/apps/frontend/src/components/NearbyVenues.tsx @@ -11,6 +11,7 @@ interface NearbyVenuesProps { locationError: string | null isLoading: boolean isError: boolean + maxDistanceKm?: number onRefresh: () => void } @@ -65,6 +66,7 @@ export default function NearbyVenues({ locationError, isLoading, isError, + maxDistanceKm = 10, onRefresh, }: NearbyVenuesProps) { return ( @@ -72,7 +74,9 @@ export default function NearbyVenues({

Nearby pubs

-

Within 10 km

+

+ Within {maxDistanceKm} km +

+ - {result.name} - - {typeLabel(result)} + + + {result.name} + + {typeLabel(result)} + + + {result.averageRating != null && ( + + + {result.averageRating.toFixed(1)} + + ({result.reviewCount ?? 0}) + + + )} {result.address && ( {result.address} )} - {result.latestPriceSighting && ( - - {formatPrice(result.latestPriceSighting)} + {(result.latestPriceSighting || + result.distanceKm != null) && ( + + {result.latestPriceSighting && ( + {formatPrice(result.latestPriceSighting)} + )} + {result.distanceKm != null && ( + {formatDistance(result.distanceKm)} away + )} )} diff --git a/apps/frontend/src/components/SearchFilters.tsx b/apps/frontend/src/components/SearchFilters.tsx new file mode 100644 index 0000000..249ae5e --- /dev/null +++ b/apps/frontend/src/components/SearchFilters.tsx @@ -0,0 +1,194 @@ +import { useId } from 'react' +import type { Dispatch, KeyboardEvent, SetStateAction } from 'react' + +import { countActiveFilters, EMPTY_SEARCH_FILTERS } from '../lib/search-filters' +import type { Coordinates } from '../lib/location' +import type { + GlassSize, + SearchFilters as SearchFilterValues, +} from '../types/search' + +const DISTANCE_OPTIONS_KM = [1, 2, 5, 10, 25] +const RATING_OPTIONS = [3, 3.5, 4, 4.5] + +const SIZE_OPTIONS: { value: GlassSize; label: string }[] = [ + { value: 'PINT', label: 'Pint' }, + { value: 'HALF_LITER', label: 'Half litre' }, + { value: 'QUARTER_LITER', label: 'Quarter litre' }, + { value: 'BOX', label: 'Box' }, + { value: 'OTHER', label: 'Other' }, +] + +const fieldClassName = + 'mt-1 w-full rounded-lg border border-[var(--line)] bg-[var(--surface-strong)] px-2.5 py-1.5 text-sm text-[var(--sea-ink)] outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)' + +const labelClassName = 'block text-xs font-semibold text-[var(--sea-ink-soft)]' + +function blockNegativeKey(event: KeyboardEvent) { + if (event.key === '-') { + event.preventDefault() + } +} + +interface SearchFiltersProps { + filters: SearchFilterValues + coordinates: Coordinates | null + onChange: Dispatch> +} + +export default function SearchFilters({ + filters, + coordinates, + onChange, +}: SearchFiltersProps) { + const distanceId = useId() + const activeCount = countActiveFilters(filters, coordinates != null) + + function updateFilters(patch: Partial) { + onChange((current) => ({ ...current, ...patch })) + } + + function updatePrice(field: 'minPrice' | 'maxPrice', value: string) { + const sanitized = + value.startsWith('-') || (value !== '' && Number(value) < 0) ? '' : value + + updateFilters( + field === 'minPrice' ? { minPrice: sanitized } : { maxPrice: sanitized }, + ) + } + + function toggleSize(size: GlassSize) { + onChange((current) => ({ + ...current, + sizes: current.sizes.includes(size) + ? current.sizes.filter((currentSize) => currentSize !== size) + : [...current.sizes, size], + })) + } + + return ( +
+
+
+

Filters

+

Filter pubs

+

+ Applies to the map, nearby pubs and search results. +

+
+ +
+ +
+
+ + + {!coordinates && ( +

+ Allow location access to filter by distance. +

+ )} +
+ + + + + + + +
+ Serving size +
+ {SIZE_OPTIONS.map((option) => ( + + ))} +
+
+
+
+ ) +} diff --git a/apps/frontend/src/lib/search-filters.ts b/apps/frontend/src/lib/search-filters.ts new file mode 100644 index 0000000..3d19acc --- /dev/null +++ b/apps/frontend/src/lib/search-filters.ts @@ -0,0 +1,59 @@ +import type { Coordinates } from './location' +import type { SearchFilters } from '../types/search' + +export const EMPTY_SEARCH_FILTERS: SearchFilters = { + maxDistanceKm: null, + minPrice: '', + maxPrice: '', + sizes: [], + minRating: null, +} + +export function parsePrice(value: string): number | null { + if (value.trim() === '') return null + + const price = Number(value) + + return Number.isFinite(price) && price >= 0 ? price : null +} + +/** Builds the GraphQL variables shared by search and nearby-venue queries. */ +export function searchFilterVariables( + filters: SearchFilters, + coordinates: Coordinates | null, +) { + const values: Record = {} + const minPrice = parsePrice(filters.minPrice) + const maxPrice = parsePrice(filters.maxPrice) + + if (coordinates) { + values.lat = coordinates.lat + values.lon = coordinates.lon + } + + if (coordinates && filters.maxDistanceKm != null) { + values.maxDistanceKm = filters.maxDistanceKm + } + + if (minPrice != null) values.minPrice = minPrice + if (maxPrice != null) values.maxPrice = maxPrice + if (filters.sizes.length > 0) values.sizes = filters.sizes + if (filters.minRating != null) values.minRating = filters.minRating + + return values +} + +export function countActiveFilters( + filters: SearchFilters, + hasLocation: boolean, +) { + const minPrice = parsePrice(filters.minPrice) + const maxPrice = parsePrice(filters.maxPrice) + + return ( + (hasLocation && filters.maxDistanceKm != null ? 1 : 0) + + (minPrice != null || maxPrice != null ? 1 : 0) + + (filters.sizes.length > 0 ? 1 : 0) + + (filters.minRating != null ? 1 : 0) + ) +} diff --git a/apps/frontend/src/routes/index.tsx b/apps/frontend/src/routes/index.tsx index 6754b0d..fc7104b 100644 --- a/apps/frontend/src/routes/index.tsx +++ b/apps/frontend/src/routes/index.tsx @@ -1,13 +1,12 @@ -import { useQuery } from '@tanstack/react-query' +import { keepPreviousData, useQuery } from '@tanstack/react-query' import { createFileRoute } from '@tanstack/react-router' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import Map from '../components/Map' import MockLocationNotice from '#/components/MockLocationNotice' import NearbyVenues from '#/components/NearbyVenues' -import type { SearchResult } from '#/types/search' -import type { NearbyVenue, VenuePriceSighting } from '#/types/venue' import SearchBox from '#/components/SearchBox' +import SearchFilters from '#/components/SearchFilters' import { graphqlFetch } from '#/graphql/client' import { MOCK_LOCATION, @@ -17,6 +16,15 @@ import { usesMockLocation, } from '#/lib/location' import type { Coordinates } from '#/lib/location' +import { + EMPTY_SEARCH_FILTERS, + searchFilterVariables, +} from '#/lib/search-filters' +import type { + SearchFilters as SearchFilterValues, + SearchResult, +} from '#/types/search' +import type { NearbyVenue, VenuePriceSighting } from '#/types/venue' export const Route = createFileRoute('/')({ component: App }) @@ -29,12 +37,20 @@ const NEARBY_QUERY = ` $lon: Float! $limit: Int! $maxDistanceKm: Float! + $minPrice: Float + $maxPrice: Float + $sizes: [GlassSize!] + $minRating: Float ) { venue( lat: $lat lon: $lon limit: $limit maxDistanceKm: $maxDistanceKm + minPrice: $minPrice + maxPrice: $maxPrice + sizes: $sizes + minRating: $minRating ) { id name @@ -104,6 +120,8 @@ function toSearchResult(venue: NearbyVenue): SearchResult { function App() { const [coordinates, setCoordinates] = useState(null) + const [searchFilters, setSearchFilters] = + useState(EMPTY_SEARCH_FILTERS) const [locating, setLocating] = useState(true) const [locationError, setLocationError] = useState(null) const [usingMockLocation, setUsingMockLocation] = useState(false) @@ -153,16 +171,23 @@ function App() { void refreshLocation() }, [refreshLocation]) + const nearbyMaxDistanceKm = + searchFilters.maxDistanceKm ?? NEARBY_MAX_DISTANCE_KM + const nearbyVariables = useMemo( + () => ({ + ...searchFilterVariables(searchFilters, coordinates), + limit: NEARBY_LIMIT, + maxDistanceKm: nearbyMaxDistanceKm, + }), + [searchFilters, coordinates, nearbyMaxDistanceKm], + ) + const { data, isFetching, isError } = useQuery({ - queryKey: ['nearbyVenues', coordinates?.lat, coordinates?.lon], + queryKey: ['nearbyVenues', nearbyVariables], queryFn: () => - graphqlFetch<{ venue: NearbyVenue[] }>(NEARBY_QUERY, { - lat: coordinates!.lat, - lon: coordinates!.lon, - limit: NEARBY_LIMIT, - maxDistanceKm: NEARBY_MAX_DISTANCE_KM, - }), + graphqlFetch<{ venue: NearbyVenue[] }>(NEARBY_QUERY, nearbyVariables), enabled: coordinates != null, + placeholderData: keepPreviousData, staleTime: 5 * 60 * 1000, retry: 1, }) @@ -182,13 +207,18 @@ function App() {
{usingMockLocation && }
- + +
diff --git a/apps/frontend/src/types/search.ts b/apps/frontend/src/types/search.ts index c543255..e3370f3 100644 --- a/apps/frontend/src/types/search.ts +++ b/apps/frontend/src/types/search.ts @@ -1,3 +1,14 @@ +export type GlassSize = + 'PINT' | 'HALF_LITER' | 'QUARTER_LITER' | 'BOX' | 'OTHER' + +export interface SearchFilters { + maxDistanceKm: number | null + minPrice: string + maxPrice: string + sizes: GlassSize[] + minRating: number | null +} + export interface SearchOpeningHours { days: string[] opening: string @@ -21,6 +32,7 @@ export interface SearchResult { name: string lat: number lon: number + distanceKm?: number | null address: string | null openingHours: SearchOpeningHours[] | null latestPriceSighting: SearchPriceSighting | null diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts index 50c3291..c4e320c 100644 --- a/packages/db/src/index.ts +++ b/packages/db/src/index.ts @@ -1,6 +1,6 @@ export { getDatabaseUrl } from './database-url.js' export { prisma } from './client.js' -export { PrismaClient } from './generated/prisma/client.js' +export { GlassSize, Prisma, PrismaClient } from './generated/prisma/client.js' export type { OpeningHours, PriceSighting } from './generated/prisma/client.js' export type { default as PrismaTypes } from './generated/pothos-types.js' export { getDatamodel } from './generated/pothos-types.js'