All files / src/lib query-keys.ts

95.69% Statements 89/93
100% Branches 0/0
95.65% Functions 88/92
95.69% Lines 89/93

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276103x       1x 1x           40x   7x   7x   91x           522x   499x 10x   9x           2x   1x           200x   200x   506x 200x 200x 4x 200x   6x   6x   178x             279x   279x             9x   7x           17x   16x   7x   7x                     11x   10x   9x             19x   13x   32x   10x   11x   5x   5x   5x   25x   12x           13x   8x 9x               11x   11x   9x   5x   12x   12x               303x 288x             150x           9x 9x   92x 219x       171x   724x   180x   58x   337x                 143x       4x                             11x   95x   5x   5x         12x   8x   12x 6x   11x         4x   153x 102x       4x         4x   9x   5x   7x   6x   4x   5x   5x   3x          
export const queryKeys = {
	// Auth
	auth: {
		all: ["auth"] as const,
		session: () => [...queryKeys.auth.all, "session"] as const,
		roles: () => [...queryKeys.auth.all, "roles"] as const,
	},
 
	// Pro
	pro: {
		all: ["pro"] as const,
		me: () => [...queryKeys.pro.all, "me"] as const,
		profile: (proId: string) =>
			[...queryKeys.pro.all, "profile", proId] as const,
		stats: (proId: string) =>
			[...queryKeys.pro.all, "stats", proId] as const,
		whatsappRecipients: (proId: string) =>
			[...queryKeys.pro.all, "whatsappRecipients", proId] as const,
	},
 
	// Projects
	projects: {
		all: ["projects"] as const,
		lists: () => [...queryKeys.projects.all, "list"] as const,
		list: (proId: string) =>
			[...queryKeys.projects.lists(), proId] as const,
		details: () => [...queryKeys.projects.all, "detail"] as const,
		detail: (proId: string, projectId: string) =>
			[...queryKeys.projects.details(), proId, projectId] as const,
	},
 
	// Photos
	photos: {
		all: ["photos"] as const,
		lists: () => [...queryKeys.photos.all, "list"] as const,
		list: (proId: string, projectId: string) =>
			[...queryKeys.photos.lists(), proId, projectId] as const,
	},
 
	// Taxonomy (rarely changes, long cache time)
	taxonomy: {
		all: ["taxonomy"] as const,
		businessTypes: () => [...queryKeys.taxonomy.all, "businessTypes"] as const,
		customerSegments: () =>
			[...queryKeys.taxonomy.all, "customerSegments"] as const,
		serviceCategories: () =>
			[...queryKeys.taxonomy.all, "serviceCategories"] as const,
		materialTags: () => [...queryKeys.taxonomy.all, "materialTags"] as const,
		brands: () => [...queryKeys.taxonomy.all, "brands"] as const,
		roomTypes: () => [...queryKeys.taxonomy.all, "roomTypes"] as const,
		cities: () => [...queryKeys.taxonomy.all, "cities"] as const,
		zones: (cityId: string) =>
			[...queryKeys.taxonomy.all, "zones", cityId] as const,
		localities: (zoneId: string) =>
			[...queryKeys.taxonomy.all, "localities", zoneId] as const,
		localitiesByCity: (cityId: string) =>
			[...queryKeys.taxonomy.all, "localitiesByCity", cityId] as const,
	},
 
	// Team
	team: {
		all: ["team"] as const,
		members: (proId: string) =>
			[...queryKeys.team.all, "members", proId] as const,
		invitations: (proId: string) =>
			[...queryKeys.team.all, "invitations", proId] as const,
	},
 
	// Website
	website: {
		all: ["website"] as const,
		settings: (proId: string) =>
			[...queryKeys.website.all, "settings", proId] as const,
		templates: (proId: string) =>
			[...queryKeys.website.all, "templates", proId] as const,
	},
 
	// Blogs
	blogs: {
		all: ["blogs"] as const,
		lists: () => [...queryKeys.blogs.all, "list"] as const,
		list: (proId: string, filters?: { status?: string }) =>
			[...queryKeys.blogs.lists(), proId, filters] as const,
		detail: (proId: string, blogId: string) =>
			[...queryKeys.blogs.all, "detail", proId, blogId] as const,
		tags: (proId: string) =>
			[...queryKeys.blogs.all, "tags", proId] as const,
	},
 
	// Company Profile
	companyProfile: {
		all: ["companyProfile"] as const,
	},
 
	// Blog Images
	blogImages: {
		all: ["blogImages"] as const,
		lists: () => [...queryKeys.blogImages.all, "list"] as const,
		list: (proId: string, blogId: string) =>
			[...queryKeys.blogImages.lists(), proId, blogId] as const,
		pexelsSearch: (query: string, page: number) =>
			[...queryKeys.blogImages.all, "pexels", query, page] as const,
	},
 
	// CRM
	crm: {
		all: ["crm"] as const,
		stages: (proId: string) =>
			[...queryKeys.crm.all, "stages", proId] as const,
		sources: (proId: string) =>
			[...queryKeys.crm.all, "sources", proId] as const,
		kanban: (proId: string) =>
			[...queryKeys.crm.all, "kanban", proId] as const,
		lead: (proId: string, leadId: string) =>
			[...queryKeys.crm.all, "lead", proId, leadId] as const,
		activities: (proId: string, leadId: string) =>
			[...queryKeys.crm.all, "activities", proId, leadId] as const,
		documents: (proId: string, leadId: string) =>
			[...queryKeys.crm.all, "documents", proId, leadId] as const,
		reminders: (proId: string, leadId: string) =>
			[...queryKeys.crm.all, "reminders", proId, leadId] as const,
		reminderCounts: (proId: string) =>
			[...queryKeys.crm.all, "reminderCounts", proId] as const,
		analytics: (proId: string, period?: string) =>
			[...queryKeys.crm.all, "analytics", proId, period] as const,
		settings: (proId: string) =>
			[...queryKeys.crm.all, "settings", proId] as const,
	},
 
	// Notifications
	notifications: {
		all: ["notifications"] as const,
		lists: () => [...queryKeys.notifications.all, "list"] as const,
		list: (filters?: { category?: string; search?: string; page?: number; limit?: number }) =>
			[...queryKeys.notifications.lists(), filters] as const,
		unreadCount: () => [...queryKeys.notifications.all, "unreadCount"] as const,
		subscriptions: () =>
			[...queryKeys.notifications.all, "subscriptions"] as const,
	},
 
	// Social Drafts (Social Studio)
	socialDrafts: {
		all: ["socialDrafts"] as const,
		lists: () => [...queryKeys.socialDrafts.all, "list"] as const,
		list: (proId: string) =>
			[...queryKeys.socialDrafts.lists(), proId] as const,
		detail: (proId: string, draftId: string) =>
			[...queryKeys.socialDrafts.all, "detail", proId, draftId] as const,
		download: (proId: string, draftId: string) =>
			[...queryKeys.socialDrafts.all, "download", proId, draftId] as const,
		musicTracks: (proId: string) =>
			[...queryKeys.socialDrafts.all, "musicTracks", proId] as const,
		templates: (proId: string) =>
			[...queryKeys.socialDrafts.all, "templates", proId] as const,
		voiceoverPreviewScript: (proId: string, projectId: string) =>
			[...queryKeys.socialDrafts.all, "voiceoverPreviewScript", proId, projectId] as const,
	},
 
	// Settings
	settings: {
		all: ["settings"] as const,
		profile: () => [...queryKeys.settings.all, "profile"] as const,
		accounts: () => [...queryKeys.settings.all, "accounts"] as const,
	},
 
	// Onboarding
	onboarding: {
		all: ["onboarding"] as const,
		status: (proId: string) =>
			[...queryKeys.onboarding.all, "status", proId] as const,
	},
 
	// Admin
	admin: {
		all: ["admin"] as const,
		dashboard: () => [...queryKeys.admin.all, "dashboard"] as const,
		analytics: () => [...queryKeys.admin.all, "analytics"] as const,
		taxonomy: (type: string) =>
			[...queryKeys.admin.all, "taxonomy", type] as const,
		proLookup: () => [...queryKeys.admin.all, "proLookup"] as const,
		pros: {
			all: ["admin", "pros"] as const,
			list: (filters?: Record<string, string>) =>
				[...queryKeys.admin.pros.all, "list", filters] as const,
			detail: (proId: string) =>
				[...queryKeys.admin.pros.all, "detail", proId] as const,
			team: (proId: string) =>
				[...queryKeys.admin.pros.all, "team", proId] as const,
			stats: (proId: string) =>
				[...queryKeys.admin.pros.all, "stats", proId] as const,
			companyProfile: (proId: string) =>
				[
					...queryKeys.admin.pros.all,
					"companyProfile",
					proId,
				] as const,
		},
		projects: {
			all: ["admin", "projects"] as const,
			list: (filters?: Record<string, string>) =>
				[...queryKeys.admin.projects.all, "list", filters] as const,
		},
		roomCategories: {
			all: ["admin", "roomCategories"] as const,
			list: () => [...queryKeys.admin.roomCategories.all, "list"] as const,
			detail: (code: string) =>
				[...queryKeys.admin.roomCategories.all, "detail", code] as const,
			media: (code: string, sortBy?: string) =>
				[
					...queryKeys.admin.roomCategories.all,
					"media",
					code,
					sortBy,
				] as const,
		},
		// inquiries removed — CRM replaces pro/admin inquiry management
		users: {
			all: ["admin", "users"] as const,
			list: (filters?: Record<string, string>) =>
				[...queryKeys.admin.users.all, "list", filters] as const,
			detail: (userId: string) =>
				[...queryKeys.admin.users.all, "detail", userId] as const,
			sessions: (userId: string) =>
				[...queryKeys.admin.users.all, "sessions", userId] as const,
			accounts: (userId: string) =>
				[...queryKeys.admin.users.all, "accounts", userId] as const,
		},
		blogs: {
			all: ["admin", "blogs"] as const,
			list: (filters?: Record<string, string>) =>
				[...queryKeys.admin.blogs.all, "list", filters] as const,
			detail: (blogId: string) =>
				[...queryKeys.admin.blogs.all, "detail", blogId] as const,
			categories: () =>
				[...queryKeys.admin.blogs.all, "categories"] as const,
			tags: () => [...queryKeys.admin.blogs.all, "tags"] as const,
			suggestions: (filters?: Record<string, string>) =>
				[...queryKeys.admin.blogs.all, "suggestions", filters] as const,
		},
		communications: {
			all: ["admin", "communications"] as const,
			list: (filters?: Record<string, string | number>) =>
				[...queryKeys.admin.communications.all, "list", filters] as const,
		},
		socialStudioMusic: () => [...queryKeys.admin.all, "socialStudioMusic"] as const,
		socialStudioTemplates: () => [...queryKeys.admin.all, "socialStudioTemplates"] as const,
		feedback: {
			all: ["admin", "feedback"] as const,
			list: (filters?: Record<string, string | number>) =>
				[...queryKeys.admin.feedback.all, "list", filters] as const,
		},
		whatsapp: {
			all: ["admin", "whatsapp"] as const,
			stats: () =>
				[...queryKeys.admin.whatsapp.all, "stats"] as const,
			conversations: (filters?: Record<string, string>) =>
				[...queryKeys.admin.whatsapp.all, "conversations", filters] as const,
			conversation: (id: number) =>
				[...queryKeys.admin.whatsapp.all, "conversation", id] as const,
			templates: () =>
				[...queryKeys.admin.whatsapp.all, "templates"] as const,
			campaigns: (filters?: Record<string, string>) =>
				[...queryKeys.admin.whatsapp.all, "campaigns", filters] as const,
			campaign: (id: number) =>
				[...queryKeys.admin.whatsapp.all, "campaign", id] as const,
			campaignRecipients: (id: number) =>
				[...queryKeys.admin.whatsapp.all, "campaignRecipients", id] as const,
			contacts: (filters?: Record<string, string>) =>
				[...queryKeys.admin.whatsapp.all, "contacts", filters] as const,
			checkPhone: (phone: string) =>
				[...queryKeys.admin.whatsapp.all, "checkPhone", phone] as const,
		},
	},
 
} as const;