feat(create-turbo): apply official-starter transform

This commit is contained in:
Turbobot
2025-02-08 17:04:20 -08:00
committed by ryan
parent 91411a6083
commit 9be2282943
51 changed files with 14526 additions and 26 deletions
+14 -10
View File
@@ -1,27 +1,31 @@
import spacetime from "spacetime";
import { createClient } from '@/utils/supabase/server';
import RealtimeDayPage from "./realtime";
export default async function DayPage(
{ date }: { date: string }
{ params }: { params: { date: string } }
) {
const supabase = await createClient();
const date = (await params).date;
const { data: { user: user } } = await supabase.auth.getUser();
const { data: day } = await supabase
.from('days')
.select('*')
.select(`*,
hours(*,
category:categories(id,
code,
name,
color:colors(name, hexcode, inverse)
)
)
`)
.eq('date', date)
.eq('userId', user?.id)
.limit(1).single()
;
return !day ? <div>Loading...</div> : (
<>
<h1>{spacetime(day.date).format('{month} {date-ordinal}, {year}')}</h1>
<ul>
<li>{day.mood}</li>
<li>{day.comment}</li>
</ul>
</>
<RealtimeDayPage initialDay={day} />
);
}
@@ -0,0 +1,64 @@
'use client';
import { createClient } from "@/utils/supabase/client";
import { useEffect, useState } from "react";
import spacetime from "spacetime";
const supabase = createClient();
export default function RealtimeDayPage({ initialDay }) {
const [day, setDay] = useState(initialDay);
useEffect(() => {
if (initialDay && !day) {
setDay(initialDay);
}
}, [initialDay]);
useEffect(() => {
const daysChannel = supabase.channel('days')
.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'days' }, (payload) => {
setDay(payload.new);
}).subscribe();
const hoursChannel = supabase.channel('hours')
.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'hours' }, (payload) => {
const updatedHour = payload.new;
const prevHours = day.hours;
const newHours = prevHours.map((hour) => {
if (hour.id === updatedHour.id) {
return updatedHour;
}
return hour;
});
const newDay = { ...day, hours: newHours };
console.log(newDay);
setDay(newDay);
}).subscribe();
return () => {
daysChannel.unsubscribe();
hoursChannel.unsubscribe();
}
}, [supabase])
return (
<>
<h1>{spacetime(day.date).format('{month} {date-ordinal}, {year}')}</h1>
<ul>
<li>MOOD: {day.mood ?? "No mood set."}</li>
<li>COMMENT: {day.comment ?? "No comment yet."}</li>
</ul>
<ul>
{day.hours.map((hour) => (
<li key={hour.id}
className="p-2"
style={{
"backgroundColor": hour.category?.color?.hexcode,
"color": hour.category?.color?.inverse
}}>[{spacetime(hour.datetime).format('{time}')}] {hour.comment}</li>
))}
</ul>
</>
)
}
+2 -2
View File
@@ -14,8 +14,8 @@ const defaultUrl = process.env.VERCEL_URL
export const metadata = {
metadataBase: new URL(defaultUrl),
title: "Next.js and Supabase Starter Kit",
description: "The fastest way to build apps with Next.js and Supabase",
title: "Nazara",
description: "The all in one life tracking app.",
};
const geistSans = Geist({
+177
View File
@@ -0,0 +1,177 @@
/*
* ==========================================
* | GENERATED BY SUPAZOD |
* ==========================================
*/
import { z } from "zod";
import * as generated from "./schemas";
export type Json = z.infer<typeof generated.jsonSchema>;
export type PublicApikeyRowSchema = z.infer<
typeof generated.publicApikeyRowSchemaSchema
>;
export type PublicApikeyInsertSchema = z.infer<
typeof generated.publicApikeyInsertSchemaSchema
>;
export type PublicApikeyUpdateSchema = z.infer<
typeof generated.publicApikeyUpdateSchemaSchema
>;
export type PublicApikeyRelationshipsSchema = z.infer<
typeof generated.publicApikeyRelationshipsSchemaSchema
>;
export type PublicCategoriesRowSchema = z.infer<
typeof generated.publicCategoriesRowSchemaSchema
>;
export type PublicCategoriesInsertSchema = z.infer<
typeof generated.publicCategoriesInsertSchemaSchema
>;
export type PublicCategoriesUpdateSchema = z.infer<
typeof generated.publicCategoriesUpdateSchemaSchema
>;
export type PublicCategoriesRelationshipsSchema = z.infer<
typeof generated.publicCategoriesRelationshipsSchemaSchema
>;
export type PublicColorsRowSchema = z.infer<
typeof generated.publicColorsRowSchemaSchema
>;
export type PublicColorsInsertSchema = z.infer<
typeof generated.publicColorsInsertSchemaSchema
>;
export type PublicColorsUpdateSchema = z.infer<
typeof generated.publicColorsUpdateSchemaSchema
>;
export type PublicColorsRelationshipsSchema = z.infer<
typeof generated.publicColorsRelationshipsSchemaSchema
>;
export type PublicDaysRowSchema = z.infer<
typeof generated.publicDaysRowSchemaSchema
>;
export type PublicDaysInsertSchema = z.infer<
typeof generated.publicDaysInsertSchemaSchema
>;
export type PublicDaysUpdateSchema = z.infer<
typeof generated.publicDaysUpdateSchemaSchema
>;
export type PublicDaysRelationshipsSchema = z.infer<
typeof generated.publicDaysRelationshipsSchemaSchema
>;
export type PublicHoursRowSchema = z.infer<
typeof generated.publicHoursRowSchemaSchema
>;
export type PublicHoursInsertSchema = z.infer<
typeof generated.publicHoursInsertSchemaSchema
>;
export type PublicHoursUpdateSchema = z.infer<
typeof generated.publicHoursUpdateSchemaSchema
>;
export type PublicHoursRelationshipsSchema = z.infer<
typeof generated.publicHoursRelationshipsSchemaSchema
>;
export type PublicMeasurementsRowSchema = z.infer<
typeof generated.publicMeasurementsRowSchemaSchema
>;
export type PublicMeasurementsInsertSchema = z.infer<
typeof generated.publicMeasurementsInsertSchemaSchema
>;
export type PublicMeasurementsUpdateSchema = z.infer<
typeof generated.publicMeasurementsUpdateSchemaSchema
>;
export type PublicMeasurementsRelationshipsSchema = z.infer<
typeof generated.publicMeasurementsRelationshipsSchemaSchema
>;
export type PublicMetricsRowSchema = z.infer<
typeof generated.publicMetricsRowSchemaSchema
>;
export type PublicMetricsInsertSchema = z.infer<
typeof generated.publicMetricsInsertSchemaSchema
>;
export type PublicMetricsUpdateSchema = z.infer<
typeof generated.publicMetricsUpdateSchemaSchema
>;
export type PublicMetricsRelationshipsSchema = z.infer<
typeof generated.publicMetricsRelationshipsSchemaSchema
>;
export type PublicSbCategoriesRowSchema = z.infer<
typeof generated.publicSbCategoriesRowSchemaSchema
>;
export type PublicSbCategoriesInsertSchema = z.infer<
typeof generated.publicSbCategoriesInsertSchemaSchema
>;
export type PublicSbCategoriesUpdateSchema = z.infer<
typeof generated.publicSbCategoriesUpdateSchemaSchema
>;
export type PublicSbCategoriesRelationshipsSchema = z.infer<
typeof generated.publicSbCategoriesRelationshipsSchemaSchema
>;
export type PublicSbColorsRowSchema = z.infer<
typeof generated.publicSbColorsRowSchemaSchema
>;
export type PublicSbColorsInsertSchema = z.infer<
typeof generated.publicSbColorsInsertSchemaSchema
>;
export type PublicSbColorsUpdateSchema = z.infer<
typeof generated.publicSbColorsUpdateSchemaSchema
>;
export type PublicSbColorsRelationshipsSchema = z.infer<
typeof generated.publicSbColorsRelationshipsSchemaSchema
>;
export type PublicSbDaysRowSchema = z.infer<
typeof generated.publicSbDaysRowSchemaSchema
>;
export type PublicSbDaysInsertSchema = z.infer<
typeof generated.publicSbDaysInsertSchemaSchema
>;
export type PublicSbDaysUpdateSchema = z.infer<
typeof generated.publicSbDaysUpdateSchemaSchema
>;
export type PublicSbDaysRelationshipsSchema = z.infer<
typeof generated.publicSbDaysRelationshipsSchemaSchema
>;
export type PublicSbHoursRowSchema = z.infer<
typeof generated.publicSbHoursRowSchemaSchema
>;
export type PublicSbHoursInsertSchema = z.infer<
typeof generated.publicSbHoursInsertSchemaSchema
>;
export type PublicSbHoursUpdateSchema = z.infer<
typeof generated.publicSbHoursUpdateSchemaSchema
>;
export type PublicSbHoursRelationshipsSchema = z.infer<
typeof generated.publicSbHoursRelationshipsSchemaSchema
>;
export type PublicSbMeasurementsRowSchema = z.infer<
typeof generated.publicSbMeasurementsRowSchemaSchema
>;
export type PublicSbMeasurementsInsertSchema = z.infer<
typeof generated.publicSbMeasurementsInsertSchemaSchema
>;
export type PublicSbMeasurementsUpdateSchema = z.infer<
typeof generated.publicSbMeasurementsUpdateSchemaSchema
>;
export type PublicSbMeasurementsRelationshipsSchema = z.infer<
typeof generated.publicSbMeasurementsRelationshipsSchemaSchema
>;
export type PublicSbMetricsRowSchema = z.infer<
typeof generated.publicSbMetricsRowSchemaSchema
>;
export type PublicSbMetricsInsertSchema = z.infer<
typeof generated.publicSbMetricsInsertSchemaSchema
>;
export type PublicSbMetricsUpdateSchema = z.infer<
typeof generated.publicSbMetricsUpdateSchemaSchema
>;
export type PublicSbMetricsRelationshipsSchema = z.infer<
typeof generated.publicSbMetricsRelationshipsSchemaSchema
>;
export type PublicUserRowSchema = z.infer<
typeof generated.publicUserRowSchemaSchema
>;
export type PublicUserInsertSchema = z.infer<
typeof generated.publicUserInsertSchemaSchema
>;
export type PublicUserUpdateSchema = z.infer<
typeof generated.publicUserUpdateSchemaSchema
>;
export type PublicUserRelationshipsSchema = z.infer<
typeof generated.publicUserRelationshipsSchemaSchema
>;
+549
View File
@@ -0,0 +1,549 @@
/*
* ==========================================
* | GENERATED BY SUPAZOD |
* ==========================================
*/
import { z } from "zod";
import { Json } from "./types";
export const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
z
.union([
z.string(),
z.number(),
z.boolean(),
z.record(z.union([jsonSchema, z.undefined()])),
z.array(jsonSchema),
])
.nullable(),
);
export const publicApikeyRowSchemaSchema = z.object({
createdAt: z.string(),
id: z.string(),
keyHash: z.string(),
keyId: z.string(),
name: z.string(),
userId: z.string().nullable(),
});
export const publicApikeyInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
id: z.string(),
keyHash: z.string(),
keyId: z.string(),
name: z.string(),
userId: z.string().optional().nullable(),
});
export const publicApikeyUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
id: z.string().optional(),
keyHash: z.string().optional(),
keyId: z.string().optional(),
name: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicApikeyRelationshipsSchemaSchema = z.tuple([]);
export const publicCategoriesRowSchemaSchema = z.object({
code: z.number(),
colorId: z.string(),
createdAt: z.string(),
description: z.string().nullable(),
id: z.string(),
name: z.string(),
parentId: z.string().nullable(),
userId: z.string().nullable(),
});
export const publicCategoriesInsertSchemaSchema = z.object({
code: z.number(),
colorId: z.string(),
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
id: z.string(),
name: z.string(),
parentId: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicCategoriesUpdateSchemaSchema = z.object({
code: z.number().optional(),
colorId: z.string().optional(),
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
id: z.string().optional(),
name: z.string().optional(),
parentId: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicCategoriesRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("category_colorId_color_id_fk"),
columns: z.tuple([z.literal("colorId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("colors"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("category_parentId_category_id_fk"),
columns: z.tuple([z.literal("parentId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("categories"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicColorsRowSchemaSchema = z.object({
createdAt: z.string(),
hexcode: z.string(),
id: z.string(),
inverse: z.string().nullable(),
name: z.string(),
userId: z.string().nullable(),
});
export const publicColorsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
hexcode: z.string(),
id: z.string(),
inverse: z.string().optional().nullable(),
name: z.string(),
userId: z.string().optional().nullable(),
});
export const publicColorsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
hexcode: z.string().optional(),
id: z.string().optional(),
inverse: z.string().optional().nullable(),
name: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicColorsRelationshipsSchemaSchema = z.tuple([]);
export const publicDaysRowSchemaSchema = z.object({
comment: z.string().nullable(),
date: z.string(),
id: z.string(),
mood: z.number().nullable(),
userId: z.string().nullable(),
});
export const publicDaysInsertSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string(),
id: z.string(),
mood: z.number().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicDaysUpdateSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string().optional(),
id: z.string().optional(),
mood: z.number().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicDaysRelationshipsSchemaSchema = z.tuple([]);
export const publicHoursRowSchemaSchema = z.object({
categoryId: z.string().nullable(),
comment: z.string().nullable(),
createdAt: z.string(),
datetime: z.string().nullable(),
dayId: z.string(),
id: z.string(),
userId: z.string().nullable(),
});
export const publicHoursInsertSchemaSchema = z.object({
categoryId: z.string().optional().nullable(),
comment: z.string().optional().nullable(),
createdAt: z.string().optional(),
datetime: z.string().optional().nullable(),
dayId: z.string(),
id: z.string(),
userId: z.string().optional().nullable(),
});
export const publicHoursUpdateSchemaSchema = z.object({
categoryId: z.string().optional().nullable(),
comment: z.string().optional().nullable(),
createdAt: z.string().optional(),
datetime: z.string().optional().nullable(),
dayId: z.string().optional(),
id: z.string().optional(),
userId: z.string().optional().nullable(),
});
export const publicHoursRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("hour_categoryId_category_id_fk"),
columns: z.tuple([z.literal("categoryId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("categories"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("hour_dayId_day_id_fk"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicMeasurementsRowSchemaSchema = z.object({
createdAt: z.string(),
dayId: z.string(),
hourId: z.string().nullable(),
id: z.string(),
metricId: z.string(),
userId: z.string().nullable(),
value: z.string(),
});
export const publicMeasurementsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
dayId: z.string(),
hourId: z.string().optional().nullable(),
id: z.string(),
metricId: z.string(),
userId: z.string().optional().nullable(),
value: z.string(),
});
export const publicMeasurementsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
dayId: z.string().optional(),
hourId: z.string().optional().nullable(),
id: z.string().optional(),
metricId: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string().optional(),
});
export const publicMeasurementsRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("measurement_dayId_day_id_fk"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurement_hourId_hour_id_fk"),
columns: z.tuple([z.literal("hourId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("hours"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurement_metricId_metric_id_fk"),
columns: z.tuple([z.literal("metricId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("metrics"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicMetricsRowSchemaSchema = z.object({
createdAt: z.string(),
description: z.string().nullable(),
goal: z.number().nullable(),
icon: z.string(),
id: z.string(),
name: z.string(),
type: z.string(),
unit: z.string().nullable(),
userId: z.string().nullable(),
});
export const publicMetricsInsertSchemaSchema = z.object({
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string(),
id: z.string(),
name: z.string(),
type: z.string(),
unit: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicMetricsUpdateSchemaSchema = z.object({
createdAt: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string().optional(),
id: z.string().optional(),
name: z.string().optional(),
type: z.string().optional(),
unit: z.string().optional().nullable(),
userId: z.string().optional().nullable(),
});
export const publicMetricsRelationshipsSchemaSchema = z.tuple([]);
export const publicSbCategoriesRowSchemaSchema = z.object({
code: z.number(),
colorId: z.number(),
created_at: z.string(),
id: z.number(),
name: z.string(),
userId: z.string(),
});
export const publicSbCategoriesInsertSchemaSchema = z.object({
code: z.number(),
colorId: z.number(),
created_at: z.string().optional(),
id: z.number().optional(),
name: z.string(),
userId: z.string(),
});
export const publicSbCategoriesUpdateSchemaSchema = z.object({
code: z.number().optional(),
colorId: z.number().optional(),
created_at: z.string().optional(),
id: z.number().optional(),
name: z.string().optional(),
userId: z.string().optional(),
});
export const publicSbCategoriesRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("categories_colorId_fkey"),
columns: z.tuple([z.literal("colorId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_colors"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbColorsRowSchemaSchema = z.object({
hexcode: z.string(),
id: z.number(),
inverse: z.string(),
name: z.string(),
userId: z.string(),
});
export const publicSbColorsInsertSchemaSchema = z.object({
hexcode: z.string(),
id: z.number().optional(),
inverse: z.string(),
name: z.string(),
userId: z.string(),
});
export const publicSbColorsUpdateSchemaSchema = z.object({
hexcode: z.string().optional(),
id: z.number().optional(),
inverse: z.string().optional(),
name: z.string().optional(),
userId: z.string().optional(),
});
export const publicSbColorsRelationshipsSchemaSchema = z.tuple([]);
export const publicSbDaysRowSchemaSchema = z.object({
comment: z.string().nullable(),
date: z.string(),
id: z.number(),
mood: z.number().nullable(),
userId: z.string(),
});
export const publicSbDaysInsertSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string(),
id: z.number().optional(),
mood: z.number().optional().nullable(),
userId: z.string(),
});
export const publicSbDaysUpdateSchemaSchema = z.object({
comment: z.string().optional().nullable(),
date: z.string().optional(),
id: z.number().optional(),
mood: z.number().optional().nullable(),
userId: z.string().optional(),
});
export const publicSbDaysRelationshipsSchemaSchema = z.tuple([]);
export const publicSbHoursRowSchemaSchema = z.object({
categoryId: z.number().nullable(),
comment: z.string().nullable(),
datetime: z.string(),
dayId: z.number(),
id: z.number(),
userId: z.string().nullable(),
});
export const publicSbHoursInsertSchemaSchema = z.object({
categoryId: z.number().optional().nullable(),
comment: z.string().optional().nullable(),
datetime: z.string(),
dayId: z.number(),
id: z.number().optional(),
userId: z.string().optional().nullable(),
});
export const publicSbHoursUpdateSchemaSchema = z.object({
categoryId: z.number().optional().nullable(),
comment: z.string().optional().nullable(),
datetime: z.string().optional(),
dayId: z.number().optional(),
id: z.number().optional(),
userId: z.string().optional().nullable(),
});
export const publicSbHoursRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("hours_dayId_fkey"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbMeasurementsRowSchemaSchema = z.object({
created_at: z.string(),
dayId: z.number().nullable(),
hourId: z.number().nullable(),
id: z.number(),
metricId: z.number().nullable(),
type: z.string(),
userId: z.string().nullable(),
value: z.string(),
});
export const publicSbMeasurementsInsertSchemaSchema = z.object({
created_at: z.string().optional(),
dayId: z.number().optional().nullable(),
hourId: z.number().optional().nullable(),
id: z.number().optional(),
metricId: z.number().optional().nullable(),
type: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string(),
});
export const publicSbMeasurementsUpdateSchemaSchema = z.object({
created_at: z.string().optional(),
dayId: z.number().optional().nullable(),
hourId: z.number().optional().nullable(),
id: z.number().optional(),
metricId: z.number().optional().nullable(),
type: z.string().optional(),
userId: z.string().optional().nullable(),
value: z.string().optional(),
});
export const publicSbMeasurementsRelationshipsSchemaSchema = z.tuple([
z.object({
foreignKeyName: z.literal("measurements_dayId_fkey"),
columns: z.tuple([z.literal("dayId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_days"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurements_hourId_fkey"),
columns: z.tuple([z.literal("hourId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_hours"),
referencedColumns: z.tuple([z.literal("id")]),
}),
z.object({
foreignKeyName: z.literal("measurements_metricId_fkey"),
columns: z.tuple([z.literal("metricId")]),
isOneToOne: z.literal(false),
referencedRelation: z.literal("sb_metrics"),
referencedColumns: z.tuple([z.literal("id")]),
}),
]);
export const publicSbMetricsRowSchemaSchema = z.object({
created_at: z.string(),
description: z.string().nullable(),
goal: z.number().nullable(),
icon: z.string(),
id: z.number(),
name: z.string(),
type: z.string(),
unit: z.string().nullable(),
userId: z.string(),
});
export const publicSbMetricsInsertSchemaSchema = z.object({
created_at: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string(),
id: z.number().optional(),
name: z.string(),
type: z.string(),
unit: z.string().optional().nullable(),
userId: z.string(),
});
export const publicSbMetricsUpdateSchemaSchema = z.object({
created_at: z.string().optional(),
description: z.string().optional().nullable(),
goal: z.number().optional().nullable(),
icon: z.string().optional(),
id: z.number().optional(),
name: z.string().optional(),
type: z.string().optional(),
unit: z.string().optional().nullable(),
userId: z.string().optional(),
});
export const publicSbMetricsRelationshipsSchemaSchema = z.tuple([]);
export const publicUserRowSchemaSchema = z.object({
email: z.string(),
emailVerified: z.number().nullable(),
id: z.string(),
image: z.string().nullable(),
name: z.string(),
password: z.string().nullable(),
role: z.string().nullable(),
timezone: z.string(),
});
export const publicUserInsertSchemaSchema = z.object({
email: z.string(),
emailVerified: z.number().optional().nullable(),
id: z.string(),
image: z.string().optional().nullable(),
name: z.string(),
password: z.string().optional().nullable(),
role: z.string().optional().nullable(),
timezone: z.string().optional(),
});
export const publicUserUpdateSchemaSchema = z.object({
email: z.string().optional(),
emailVerified: z.number().optional().nullable(),
id: z.string().optional(),
image: z.string().optional().nullable(),
name: z.string().optional(),
password: z.string().optional().nullable(),
role: z.string().optional().nullable(),
timezone: z.string().optional(),
});
export const publicUserRelationshipsSchemaSchema = z.tuple([]);
+624
View File
@@ -0,0 +1,624 @@
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]
export type Database = {
public: {
Tables: {
apiKey: {
Row: {
createdAt: string
id: string
keyHash: string
keyId: string
name: string
userId: string | null
}
Insert: {
createdAt?: string
id: string
keyHash: string
keyId: string
name: string
userId?: string | null
}
Update: {
createdAt?: string
id?: string
keyHash?: string
keyId?: string
name?: string
userId?: string | null
}
Relationships: []
}
categories: {
Row: {
code: number
colorId: string
createdAt: string
description: string | null
id: string
name: string
parentId: string | null
userId: string | null
}
Insert: {
code: number
colorId: string
createdAt?: string
description?: string | null
id: string
name: string
parentId?: string | null
userId?: string | null
}
Update: {
code?: number
colorId?: string
createdAt?: string
description?: string | null
id?: string
name?: string
parentId?: string | null
userId?: string | null
}
Relationships: [
{
foreignKeyName: "category_colorId_color_id_fk"
columns: ["colorId"]
isOneToOne: false
referencedRelation: "colors"
referencedColumns: ["id"]
},
{
foreignKeyName: "category_parentId_category_id_fk"
columns: ["parentId"]
isOneToOne: false
referencedRelation: "categories"
referencedColumns: ["id"]
},
]
}
colors: {
Row: {
createdAt: string
hexcode: string
id: string
inverse: string | null
name: string
userId: string | null
}
Insert: {
createdAt?: string
hexcode: string
id: string
inverse?: string | null
name: string
userId?: string | null
}
Update: {
createdAt?: string
hexcode?: string
id?: string
inverse?: string | null
name?: string
userId?: string | null
}
Relationships: []
}
days: {
Row: {
comment: string | null
date: string
id: string
mood: number | null
userId: string | null
}
Insert: {
comment?: string | null
date: string
id: string
mood?: number | null
userId?: string | null
}
Update: {
comment?: string | null
date?: string
id?: string
mood?: number | null
userId?: string | null
}
Relationships: []
}
hours: {
Row: {
categoryId: string | null
comment: string | null
createdAt: string
datetime: string | null
dayId: string
id: string
userId: string | null
}
Insert: {
categoryId?: string | null
comment?: string | null
createdAt?: string
datetime?: string | null
dayId: string
id: string
userId?: string | null
}
Update: {
categoryId?: string | null
comment?: string | null
createdAt?: string
datetime?: string | null
dayId?: string
id?: string
userId?: string | null
}
Relationships: [
{
foreignKeyName: "hour_categoryId_category_id_fk"
columns: ["categoryId"]
isOneToOne: false
referencedRelation: "categories"
referencedColumns: ["id"]
},
{
foreignKeyName: "hour_dayId_day_id_fk"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "days"
referencedColumns: ["id"]
},
]
}
measurements: {
Row: {
createdAt: string
dayId: string
hourId: string | null
id: string
metricId: string
userId: string | null
value: string
}
Insert: {
createdAt?: string
dayId: string
hourId?: string | null
id: string
metricId: string
userId?: string | null
value: string
}
Update: {
createdAt?: string
dayId?: string
hourId?: string | null
id?: string
metricId?: string
userId?: string | null
value?: string
}
Relationships: [
{
foreignKeyName: "measurement_dayId_day_id_fk"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "days"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurement_hourId_hour_id_fk"
columns: ["hourId"]
isOneToOne: false
referencedRelation: "hours"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurement_metricId_metric_id_fk"
columns: ["metricId"]
isOneToOne: false
referencedRelation: "metrics"
referencedColumns: ["id"]
},
]
}
metrics: {
Row: {
createdAt: string
description: string | null
goal: number | null
icon: string
id: string
name: string
type: string
unit: string | null
userId: string | null
}
Insert: {
createdAt?: string
description?: string | null
goal?: number | null
icon: string
id: string
name: string
type: string
unit?: string | null
userId?: string | null
}
Update: {
createdAt?: string
description?: string | null
goal?: number | null
icon?: string
id?: string
name?: string
type?: string
unit?: string | null
userId?: string | null
}
Relationships: []
}
sb_categories: {
Row: {
code: number
colorId: number
created_at: string
id: number
name: string
userId: string
}
Insert: {
code: number
colorId: number
created_at?: string
id?: number
name: string
userId: string
}
Update: {
code?: number
colorId?: number
created_at?: string
id?: number
name?: string
userId?: string
}
Relationships: [
{
foreignKeyName: "categories_colorId_fkey"
columns: ["colorId"]
isOneToOne: false
referencedRelation: "sb_colors"
referencedColumns: ["id"]
},
]
}
sb_colors: {
Row: {
hexcode: string
id: number
inverse: string
name: string
userId: string
}
Insert: {
hexcode: string
id?: number
inverse: string
name: string
userId: string
}
Update: {
hexcode?: string
id?: number
inverse?: string
name?: string
userId?: string
}
Relationships: []
}
sb_days: {
Row: {
comment: string | null
date: string
id: number
mood: number | null
userId: string
}
Insert: {
comment?: string | null
date: string
id?: number
mood?: number | null
userId: string
}
Update: {
comment?: string | null
date?: string
id?: number
mood?: number | null
userId?: string
}
Relationships: []
}
sb_hours: {
Row: {
categoryId: number | null
comment: string | null
datetime: string
dayId: number
id: number
userId: string | null
}
Insert: {
categoryId?: number | null
comment?: string | null
datetime: string
dayId: number
id?: number
userId?: string | null
}
Update: {
categoryId?: number | null
comment?: string | null
datetime?: string
dayId?: number
id?: number
userId?: string | null
}
Relationships: [
{
foreignKeyName: "hours_dayId_fkey"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "sb_days"
referencedColumns: ["id"]
},
]
}
sb_measurements: {
Row: {
created_at: string
dayId: number | null
hourId: number | null
id: number
metricId: number | null
type: string
userId: string | null
value: string
}
Insert: {
created_at?: string
dayId?: number | null
hourId?: number | null
id?: number
metricId?: number | null
type?: string
userId?: string | null
value: string
}
Update: {
created_at?: string
dayId?: number | null
hourId?: number | null
id?: number
metricId?: number | null
type?: string
userId?: string | null
value?: string
}
Relationships: [
{
foreignKeyName: "measurements_dayId_fkey"
columns: ["dayId"]
isOneToOne: false
referencedRelation: "sb_days"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurements_hourId_fkey"
columns: ["hourId"]
isOneToOne: false
referencedRelation: "sb_hours"
referencedColumns: ["id"]
},
{
foreignKeyName: "measurements_metricId_fkey"
columns: ["metricId"]
isOneToOne: false
referencedRelation: "sb_metrics"
referencedColumns: ["id"]
},
]
}
sb_metrics: {
Row: {
created_at: string
description: string | null
goal: number | null
icon: string
id: number
name: string
type: string
unit: string | null
userId: string
}
Insert: {
created_at?: string
description?: string | null
goal?: number | null
icon: string
id?: number
name: string
type: string
unit?: string | null
userId: string
}
Update: {
created_at?: string
description?: string | null
goal?: number | null
icon?: string
id?: number
name?: string
type?: string
unit?: string | null
userId?: string
}
Relationships: []
}
user: {
Row: {
email: string
emailVerified: number | null
id: string
image: string | null
name: string
password: string | null
role: string | null
timezone: string
}
Insert: {
email: string
emailVerified?: number | null
id: string
image?: string | null
name: string
password?: string | null
role?: string | null
timezone?: string
}
Update: {
email?: string
emailVerified?: number | null
id?: string
image?: string | null
name?: string
password?: string | null
role?: string | null
timezone?: string
}
Relationships: []
}
}
Views: {
[_ in never]: never
}
Functions: {
[_ in never]: never
}
Enums: {
[_ in never]: never
}
CompositeTypes: {
[_ in never]: never
}
}
}
type PublicSchema = Database[Extract<keyof Database, "public">]
export type Tables<
PublicTableNameOrOptions extends
| keyof (PublicSchema["Tables"] & PublicSchema["Views"])
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
Row: infer R
}
? R
: never
: PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
PublicSchema["Views"])
? (PublicSchema["Tables"] &
PublicSchema["Views"])[PublicTableNameOrOptions] extends {
Row: infer R
}
? R
: never
: never
export type TablesInsert<
PublicTableNameOrOptions extends
| keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Insert: infer I
}
? I
: never
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
Insert: infer I
}
? I
: never
: never
export type TablesUpdate<
PublicTableNameOrOptions extends
| keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Update: infer U
}
? U
: never
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
Update: infer U
}
? U
: never
: never
export type Enums<
PublicEnumNameOrOptions extends
| keyof PublicSchema["Enums"]
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
: never = never,
> = PublicEnumNameOrOptions extends { schema: keyof Database }
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
: PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
? PublicSchema["Enums"][PublicEnumNameOrOptions]
: never
export type CompositeTypes<
PublicCompositeTypeNameOrOptions extends
| keyof PublicSchema["CompositeTypes"]
| { schema: keyof Database },
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
schema: keyof Database
}
? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
: never = never,
> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database }
? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
: PublicCompositeTypeNameOrOptions extends keyof PublicSchema["CompositeTypes"]
? PublicSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
: never
+3 -1
View File
@@ -22,13 +22,15 @@
"prettier": "^3.3.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"spacetime": "^7.7.0"
"spacetime": "^7.7.0",
"supabase": "^2.9.6"
},
"devDependencies": {
"@types/node": "22.10.2",
"@types/react": "^19.0.2",
"@types/react-dom": "19.0.2",
"postcss": "8.4.49",
"supazod": "^1.1.2",
"tailwind-merge": "^2.5.2",
"tailwindcss": "3.4.17",
"tailwindcss-animate": "^1.0.7",
+8
View File
@@ -0,0 +1,8 @@
# Supabase
.branches
.temp
# dotenvx
.env.keys
.env.local
.env.*.local
+281
View File
@@ -0,0 +1,281 @@
# For detailed configuration reference documentation, visit:
# https://supabase.com/docs/guides/local-development/cli/config
# A string used to distinguish different Supabase projects on the same host. Defaults to the
# working directory name when running `supabase init`.
project_id = "web"
[api]
enabled = true
# Port to use for the API URL.
port = 54321
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
# endpoints. `public` and `graphql_public` schemas are included by default.
schemas = ["public", "graphql_public"]
# Extra schemas to add to the search_path of every request.
extra_search_path = ["public", "extensions"]
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
# for accidental or malicious requests.
max_rows = 1000
[api.tls]
# Enable HTTPS endpoints locally using a self-signed certificate.
enabled = false
[db]
# Port to use for the local database URL.
port = 54322
# Port used by db diff command to initialize the shadow database.
shadow_port = 54320
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
# server_version;` on the remote database to check.
major_version = 15
[db.pooler]
enabled = false
# Port to use for the local connection pooler.
port = 54329
# Specifies when a server connection can be reused by other clients.
# Configure one of the supported pooler modes: `transaction`, `session`.
pool_mode = "transaction"
# How many server connections to allow per user/database pair.
default_pool_size = 20
# Maximum number of client connections allowed.
max_client_conn = 100
[db.seed]
# If enabled, seeds the database after migrations during a db reset.
enabled = true
# Specifies an ordered list of seed files to load during db reset.
# Supports glob patterns relative to supabase directory: "./seeds/*.sql"
sql_paths = ["./seed.sql"]
[realtime]
enabled = true
# Bind realtime via either IPv4 or IPv6. (default: IPv4)
# ip_version = "IPv6"
# The maximum length in bytes of HTTP request headers. (default: 4096)
# max_header_length = 4096
[studio]
enabled = true
# Port to use for Supabase Studio.
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://127.0.0.1"
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
enabled = true
# Port to use for the email testing server web interface.
port = 54324
# Uncomment to expose additional ports for testing user applications that send emails.
# smtp_port = 54325
# pop3_port = 54326
# admin_email = "admin@email.com"
# sender_name = "Admin"
[storage]
enabled = true
# The maximum file size allowed (e.g. "5MB", "500KB").
file_size_limit = "50MiB"
# Image transformation API is available to Supabase Pro plan.
# [storage.image_transformation]
# enabled = true
# Uncomment to configure local storage buckets
# [storage.buckets.images]
# public = false
# file_size_limit = "50MiB"
# allowed_mime_types = ["image/png", "image/jpeg"]
# objects_path = "./images"
[auth]
enabled = true
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
# in emails.
site_url = "http://127.0.0.1:3000"
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
additional_redirect_urls = ["https://127.0.0.1:3000"]
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
jwt_expiry = 3600
# If disabled, the refresh token will never expire.
enable_refresh_token_rotation = true
# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
# Requires enable_refresh_token_rotation = true.
refresh_token_reuse_interval = 10
# Allow/disallow new user signups to your project.
enable_signup = true
# Allow/disallow anonymous sign-ins to your project.
enable_anonymous_sign_ins = false
# Allow/disallow testing manual linking of accounts
enable_manual_linking = false
# Passwords shorter than this value will be rejected as weak. Minimum 6, recommended 8 or more.
minimum_password_length = 6
# Passwords that do not meet the following requirements will be rejected as weak. Supported values
# are: `letters_digits`, `lower_upper_letters_digits`, `lower_upper_letters_digits_symbols`
password_requirements = ""
[auth.email]
# Allow/disallow new user signups via email to your project.
enable_signup = true
# If enabled, a user will be required to confirm any email change on both the old, and new email
# addresses. If disabled, only the new email is required to confirm.
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# If enabled, users will need to reauthenticate or have logged in recently to change their password.
secure_password_change = false
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
max_frequency = "1s"
# Number of characters used in the email OTP.
otp_length = 6
# Number of seconds before the email OTP expires (defaults to 1 hour).
otp_expiry = 3600
# Use a production-ready SMTP server
# [auth.email.smtp]
# enabled = true
# host = "smtp.sendgrid.net"
# port = 587
# user = "apikey"
# pass = "env(SENDGRID_API_KEY)"
# admin_email = "admin@email.com"
# sender_name = "Admin"
# Uncomment to customize email template
# [auth.email.template.invite]
# subject = "You have been invited"
# content_path = "./supabase/templates/invite.html"
[auth.sms]
# Allow/disallow new user signups via SMS to your project.
enable_signup = false
# If enabled, users need to confirm their phone number before signing in.
enable_confirmations = false
# Template for sending OTP to users
template = "Your code is {{ .Code }}"
# Controls the minimum amount of time that must pass before sending another sms otp.
max_frequency = "5s"
# Use pre-defined map of phone number to OTP for testing.
# [auth.sms.test_otp]
# 4152127777 = "123456"
# Configure logged in session timeouts.
# [auth.sessions]
# Force log out after the specified duration.
# timebox = "24h"
# Force log out if the user has been inactive longer than the specified duration.
# inactivity_timeout = "8h"
# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
# [auth.hook.custom_access_token]
# enabled = true
# uri = "pg-functions://<database>/<schema>/<hook_name>"
# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
[auth.sms.twilio]
enabled = false
account_sid = ""
message_service_sid = ""
# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
# Multi-factor-authentication is available to Supabase Pro plan.
[auth.mfa]
# Control how many MFA factors can be enrolled at once per user.
max_enrolled_factors = 10
# Control MFA via App Authenticator (TOTP)
[auth.mfa.totp]
enroll_enabled = false
verify_enabled = false
# Configure MFA via Phone Messaging
[auth.mfa.phone]
enroll_enabled = false
verify_enabled = false
otp_length = 6
template = "Your code is {{ .Code }}"
max_frequency = "5s"
# Configure MFA via WebAuthn
# [auth.mfa.web_authn]
# enroll_enabled = true
# verify_enabled = true
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
[auth.external.apple]
enabled = false
client_id = ""
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
# Overrides the default auth redirectUrl.
redirect_uri = ""
# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
# or any other third-party OIDC providers.
url = ""
# If enabled, the nonce check will be skipped. Required for local sign in with Google auth.
skip_nonce_check = false
# Use Firebase Auth as a third-party provider alongside Supabase Auth.
[auth.third_party.firebase]
enabled = false
# project_id = "my-firebase-project"
# Use Auth0 as a third-party provider alongside Supabase Auth.
[auth.third_party.auth0]
enabled = false
# tenant = "my-auth0-tenant"
# tenant_region = "us"
# Use AWS Cognito (Amplify) as a third-party provider alongside Supabase Auth.
[auth.third_party.aws_cognito]
enabled = false
# user_pool_id = "my-user-pool-id"
# user_pool_region = "us-east-1"
[edge_runtime]
enabled = true
# Configure one of the supported request policies: `oneshot`, `per_worker`.
# Use `oneshot` for hot reload, or `per_worker` for load testing.
policy = "oneshot"
# Port to attach the Chrome inspector for debugging edge functions.
inspector_port = 8083
# Use these configurations to customize your Edge Function.
# [functions.MY_FUNCTION_NAME]
# enabled = true
# verify_jwt = true
# import_map = "./functions/MY_FUNCTION_NAME/deno.json"
# Uncomment to specify a custom file path to the entrypoint.
# Supported file extensions are: .ts, .js, .mjs, .jsx, .tsx
# entrypoint = "./functions/MY_FUNCTION_NAME/index.ts"
# Specifies static files to be bundled with the function. Supports glob patterns.
# For example, if you want to serve static HTML pages in your function:
# static_files = [ "./functions/MY_FUNCTION_NAME/*.html" ]
[analytics]
enabled = true
port = 54327
# Configure one of the supported backends: `postgres`, `bigquery`.
backend = "postgres"
# Experimental features may be deprecated any time
[experimental]
# Configures Postgres storage engine to use OrioleDB (S3)
orioledb_version = ""
# Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
s3_host = "env(S3_HOST)"
# Configures S3 bucket region, eg. us-east-1
s3_region = "env(S3_REGION)"
# Configures AWS_ACCESS_KEY_ID for S3 bucket
s3_access_key = "env(S3_ACCESS_KEY)"
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
s3_secret_key = "env(S3_SECRET_KEY)"