mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
## Context Related to FE-2557 Part of shifting manually written dashboard queries into packages/pg-meta where - pg-meta can be code owners of - we can write tests for the queries This PR just shifts all the `.sql.ts` files that we previously created into packages/pg-meta There's still other areas where we need to shift over as well which I'll address in subsequent PRs ## Notable changes - `getTableRowsCountSql` -> Opted to shift `formatFilterValue` logic out before calling this method (ref `table-rows-count-query`) - `getDeleteOldCronJobRunDetailsByCtidSql` -> Opted to shift `validatePageNumber` logic out before calling this method (ref `CronJobsTab.useCleanupActions`)
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import { sqlKeys } from '../sql/keys'
|
|
|
|
export const databaseCronJobsKeys = {
|
|
create: () => ['cron-jobs', 'create'] as const,
|
|
delete: () => ['cron-jobs', 'delete'] as const,
|
|
alter: () => ['cronjobs', 'alter'] as const,
|
|
job: (projectRef: string | undefined, identifier: number | string | undefined) =>
|
|
['projects', projectRef, 'cron-jobs', identifier] as const,
|
|
listInfinite: (projectRef: string | undefined, searchTerm: string | undefined) =>
|
|
['projects', projectRef, 'cron-jobs', { searchTerm }] as const,
|
|
listInfiniteMinimal: (projectRef: string | undefined, searchTerm: string | undefined) =>
|
|
['projects', projectRef, 'cron-jobs-mininal', { searchTerm }] as const,
|
|
count: (projectRef: string | undefined) =>
|
|
['projects', projectRef, 'cron-jobs', 'count'] as const,
|
|
run: (projectRef: string | undefined, jobId: number) => [
|
|
'projects',
|
|
projectRef,
|
|
'cron-jobs',
|
|
jobId,
|
|
'run',
|
|
],
|
|
runsInfinite: (projectRef: string | undefined, jobId: number, options?: object) => [
|
|
'projects',
|
|
projectRef,
|
|
'cron-jobs',
|
|
jobId,
|
|
options,
|
|
],
|
|
timezone: (projectRef: string | undefined) => ['database-cron-timezone', projectRef] as const,
|
|
}
|
|
|
|
export const getJobRunDetailsPageCountKey = (projectRef: string | undefined) =>
|
|
sqlKeys.query(projectRef, ['cron-job-run-details', 'page-count'])
|
|
|
|
export const getDeleteOldCronJobRunDetailsByCtidKey = (
|
|
projectRef: string | undefined,
|
|
interval: string,
|
|
startPage: number
|
|
) => sqlKeys.query(projectRef, ['cron-job-run-details', 'delete-batch', interval, startPage])
|
|
|
|
export const getScheduleDeleteCronJobRunDetailsKey = (
|
|
projectRef: string | undefined,
|
|
interval: string
|
|
) => sqlKeys.query(projectRef, ['cron-job-run-details', 'schedule', interval])
|