forked from admin/runners-calendar
feat: add registration and authentication
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
export interface RaceRow {
|
||||
id: string;
|
||||
slug: string;
|
||||
owner_user_id: string | null;
|
||||
race_date: string | Date;
|
||||
title: string;
|
||||
distance_km: string;
|
||||
@@ -24,6 +26,7 @@ export interface RaceRow {
|
||||
/** API shape (camelCase). */
|
||||
export interface RaceDto {
|
||||
id: string;
|
||||
slug: string;
|
||||
date: string;
|
||||
title: string;
|
||||
distanceKm: number;
|
||||
@@ -61,6 +64,7 @@ function raceDateToApiValue(value: string | Date): string {
|
||||
export function rowToDto(row: RaceRow): RaceDto {
|
||||
return {
|
||||
id: row.id,
|
||||
slug: row.slug,
|
||||
date: raceDateToApiValue(row.race_date),
|
||||
title: row.title,
|
||||
distanceKm: parseFloat(row.distance_km),
|
||||
@@ -81,6 +85,7 @@ export function rowToDto(row: RaceRow): RaceDto {
|
||||
|
||||
/** Map incoming camelCase body fields to snake_case column names. */
|
||||
const FIELD_MAP: Record<string, string> = {
|
||||
slug: "slug",
|
||||
date: "race_date",
|
||||
title: "title",
|
||||
distanceKm: "distance_km",
|
||||
|
||||
Reference in New Issue
Block a user