From ea672a9d916e1d1d1108f830d91d1d116f895c43 Mon Sep 17 00:00:00 2001 From: GarandPLG Date: Sun, 5 Oct 2025 19:26:36 +0200 Subject: [PATCH] dodanie typu geoPoint --- src/content.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/content.ts b/src/content.ts index 0d71d06..48ab9db 100644 --- a/src/content.ts +++ b/src/content.ts @@ -46,6 +46,8 @@ export function stringifyContent(collections: CollectionModel[], opts: GenerateO function stringifyField(field: CollectionField, collectionName: string) { let schema: string; + // TODO: + console.log(`${collectionName}: ${field.type}`); switch (field.type) { case "bool": schema = stringifyBoolField(field); @@ -80,6 +82,9 @@ export function stringifyContent(collections: CollectionModel[], opts: GenerateO case "url": schema = stringifyUrlField(field); break; + case "geoPoint": + schema = stringifyGeoPointField(field); + break; default: console.warn(`Unknown field type "${field.type}" for field "${field.name}". Using z.any() as fallback.`); schema = "z.any()"; @@ -154,6 +159,10 @@ export function stringifyContent(collections: CollectionModel[], opts: GenerateO return "z.string().url()"; } + function stringifyGeoPointField(_field: CollectionField) { + return "z.object({ lat: z.number().min(-90).max(90), lng: z.number().min(-180).max(180) })"; + } + function stringifySchemasEntry({ name }: CollectionModel) { return `["${name}", ${opts.nameRecordSchema(name)}]`; }