diff --git a/server/src/types.ts b/server/src/types.ts index 07533d61f..432b59b47 100644 --- a/server/src/types.ts +++ b/server/src/types.ts @@ -387,6 +387,10 @@ export interface Journey { status: 'draft' | 'active' | 'completed' | 'archived'; /** Draw the linked trips' GPX tracks on this journey's map (#2194). 0 by default. */ show_trip_tracks?: number; + /** The state the owner set by hand (#762); null follows the trip dates. */ + status_override?: 'draft' | 'live' | 'completed' | null; + /** Entries without a place take the spot of their first geotagged photo (#1003). 0 by default. */ + photo_location?: number; created_at: number; updated_at: number; } diff --git a/shared/src/place/place-hours.spec.ts b/shared/src/place/place-hours.spec.ts index 4c00d6332..15e65d778 100644 --- a/shared/src/place/place-hours.spec.ts +++ b/shared/src/place/place-hours.spec.ts @@ -1,8 +1,10 @@ -import { describe, expect, it } from 'vitest'; import { hasPlaceHours, parsePlaceHours, placeEmailField, placeOpeningHoursField } from './place-hours'; import { placeCreateRequestSchema, placeUpdateRequestSchema } from './place.schema'; -const WEEK = '[{"closed":false,"open":"09:00","close":"17:00"},{"closed":false},{"closed":false},{"closed":false},{"closed":false},{"closed":true},{"closed":true}]'; +import { describe, expect, it } from 'vitest'; + +const WEEK = + '[{"closed":false,"open":"09:00","close":"17:00"},{"closed":false},{"closed":false},{"closed":false},{"closed":false},{"closed":true},{"closed":true}]'; describe('place hours and e-mail (#2472)', () => { it('parses seven days and refuses anything else', () => { diff --git a/shared/src/place/place-hours.ts b/shared/src/place/place-hours.ts index 8e0704599..6d53ba3f2 100644 --- a/shared/src/place/place-hours.ts +++ b/shared/src/place/place-hours.ts @@ -36,14 +36,14 @@ export function parsePlaceHours(raw: unknown): PlaceOpeningHours | null { /** Whether a week says anything: a day that is closed or has a time. */ export function hasPlaceHours(hours: PlaceOpeningHours | null): boolean { - return !!hours && hours.some(d => d.closed || !!d.open || !!d.close); + return !!hours && hours.some((d) => d.closed || !!d.open || !!d.close); } /** The request field: the JSON text, empty or null to clear it. */ export const placeOpeningHoursField = z .string() .max(1000) - .refine(v => v === '' || parsePlaceHours(v) !== null, { message: 'opening_hours must be seven days, Monday first' }) + .refine((v) => v === '' || parsePlaceHours(v) !== null, { message: 'opening_hours must be seven days, Monday first' }) .nullable() .optional(); @@ -53,6 +53,6 @@ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; export const placeEmailField = z .string() .max(254) - .refine(v => v === '' || EMAIL.test(v.trim()), { message: 'email must be an e-mail address' }) + .refine((v) => v === '' || EMAIL.test(v.trim()), { message: 'email must be an e-mail address' }) .nullable() .optional(); diff --git a/shared/src/place/place.schema.ts b/shared/src/place/place.schema.ts index ff376f8e8..de4e2e596 100644 --- a/shared/src/place/place.schema.ts +++ b/shared/src/place/place.schema.ts @@ -1,6 +1,6 @@ import { tagSchema } from '../tag/tag.schema'; -import { PLACE_WEBSITE_MAX_LENGTH, normalizePlaceWebsite } from './place-website'; import { placeEmailField, placeOpeningHoursField } from './place-hours'; +import { PLACE_WEBSITE_MAX_LENGTH, normalizePlaceWebsite } from './place-website'; import { z } from 'zod'; diff --git a/shared/src/trip/trip.schema.ts b/shared/src/trip/trip.schema.ts index 38059fb2a..0e9b3c6c9 100644 --- a/shared/src/trip/trip.schema.ts +++ b/shared/src/trip/trip.schema.ts @@ -169,9 +169,11 @@ export type ActiveTripResponse = z.infer; * along for the card; title and date matching stays on the client. */ export const tripSearchResponseSchema = z.object({ - matches: z.array(z.object({ - trip_id: z.number(), - places: z.array(z.string()), - })), + matches: z.array( + z.object({ + trip_id: z.number(), + places: z.array(z.string()), + }), + ), }); export type TripSearchResponse = z.infer;