Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
637 B
TypeScript
26 lines
637 B
TypeScript
import { run } from 'common/supabase/utils'
|
|
import { db } from './db'
|
|
|
|
// export type Stats = { [key in keyof Row<'daily_stats'>]: Row<'daily_stats'>[key][] }
|
|
|
|
export const getStats = async (startDate?: string) => {
|
|
const { data } = await run(
|
|
db
|
|
.from('daily_stats')
|
|
.select()
|
|
.order('start_date')
|
|
.gte('start_date', startDate ?? '2024-01-01')
|
|
)
|
|
return data
|
|
|
|
// if (data.length === 0) {
|
|
// return {} as Stats
|
|
// }
|
|
|
|
// const keys = Object.keys(data[0]) as (keyof Row<'daily_stats'>)[]
|
|
|
|
// return Object.fromEntries(
|
|
// keys.map((key) => [key, data.map((d) => d[key])])
|
|
// ) as Stats
|
|
}
|