mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 10:31:13 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
80
src-old/lib/queryKeys.ts
Normal file
80
src-old/lib/queryKeys.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Centralized query key definitions for TanStack Query
|
||||
*
|
||||
* This ensures consistent query keys across the application
|
||||
* and makes cache invalidation easier to manage.
|
||||
*/
|
||||
|
||||
export const queryKeys = {
|
||||
// User-related queries
|
||||
userRoles: (userId?: string) => ['user-roles', userId] as const,
|
||||
userPermissions: (userId?: string) => ['user-permissions', userId] as const,
|
||||
|
||||
// Moderation queue queries
|
||||
moderationQueue: (config: Record<string, any>) => ['moderation-queue', config] as const,
|
||||
moderationStats: () => ['moderation-stats'] as const,
|
||||
|
||||
// Homepage queries
|
||||
homepage: {
|
||||
trendingParks: () => ['homepage', 'trending-parks'] as const,
|
||||
trendingRides: () => ['homepage', 'trending-rides'] as const,
|
||||
recentParks: () => ['homepage', 'recent-parks'] as const,
|
||||
recentRides: () => ['homepage', 'recent-rides'] as const,
|
||||
recentChanges: () => ['homepage', 'recent-changes'] as const,
|
||||
recentlyOpenedParks: () => ['homepage', 'recently-opened-parks'] as const,
|
||||
recentlyOpenedRides: () => ['homepage', 'recently-opened-rides'] as const,
|
||||
highestRatedParks: () => ['homepage', 'highest-rated-parks'] as const,
|
||||
highestRatedRides: () => ['homepage', 'highest-rated-rides'] as const,
|
||||
openingSoonParks: () => ['homepage', 'opening-soon-parks'] as const,
|
||||
openingSoonRides: () => ['homepage', 'opening-soon-rides'] as const,
|
||||
closingSoonParks: () => ['homepage', 'closing-soon-parks'] as const,
|
||||
closingSoonRides: () => ['homepage', 'closing-soon-rides'] as const,
|
||||
recentlyClosedParks: () => ['homepage', 'recently-closed-parks'] as const,
|
||||
recentlyClosedRides: () => ['homepage', 'recently-closed-rides'] as const,
|
||||
featuredParks: {
|
||||
topRated: () => ['homepage', 'featured-parks', 'top-rated'] as const,
|
||||
mostRides: () => ['homepage', 'featured-parks', 'most-rides'] as const,
|
||||
},
|
||||
},
|
||||
|
||||
// Parks queries
|
||||
parks: {
|
||||
all: () => ['parks', 'all'] as const,
|
||||
detail: (slug: string) => ['parks', 'detail', slug] as const,
|
||||
rides: (parkId: string) => ['parks', 'rides', parkId] as const,
|
||||
},
|
||||
|
||||
// Rides queries
|
||||
rides: {
|
||||
all: () => ['rides', 'all'] as const,
|
||||
detail: (parkSlug: string, rideSlug: string) => ['rides', 'detail', parkSlug, rideSlug] as const,
|
||||
similar: (parkId: string, category: string, currentId: string) =>
|
||||
['rides', 'similar', parkId, category, currentId] as const,
|
||||
},
|
||||
|
||||
// Reviews queries
|
||||
reviews: {
|
||||
entity: (entityType: 'park' | 'ride', entityId: string) =>
|
||||
['reviews', entityType, entityId] as const,
|
||||
user: (userId: string, filter: string, sortBy: string) =>
|
||||
['reviews', 'user', userId, filter, sortBy] as const,
|
||||
},
|
||||
|
||||
// Photos queries
|
||||
photos: {
|
||||
entity: (entityType: string, entityId: string) =>
|
||||
['photos', entityType, entityId] as const,
|
||||
count: (entityType: string, entityId: string) =>
|
||||
['photos', 'count', entityType, entityId] as const,
|
||||
},
|
||||
|
||||
// Search queries
|
||||
search: {
|
||||
global: (query: string) => ['search', 'global', query] as const,
|
||||
},
|
||||
|
||||
// Lists queries
|
||||
lists: {
|
||||
items: (listId: string) => ['list-items', listId] as const,
|
||||
},
|
||||
} as const;
|
||||
Reference in New Issue
Block a user