From 5e651f1ca3d7922e0060e3e5cbecc5ca8a915875 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 22 Jul 2022 04:58:08 +0100 Subject: [PATCH] Add automatic type regeneration --- .eslintignore | 1 + package.json | 6 ++++- src/collections/Events.ts | 1 - src/payload-types.ts | 50 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/payload-types.ts diff --git a/.eslintignore b/.eslintignore index fef1498..bae01b3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist build +src/payload-types.ts \ No newline at end of file diff --git a/package.json b/package.json index 3c206ae..712f0bd 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,10 @@ "typescript": "^4.7.4" }, "lint-staged": { - "*.ts": "eslint --cache --fix" + "*.ts": [ + "eslint --cache --fix", + "yarn generate:types", + "git add src/payload-types.ts" + ] } } diff --git a/src/collections/Events.ts b/src/collections/Events.ts index e6bd586..8c508f2 100644 --- a/src/collections/Events.ts +++ b/src/collections/Events.ts @@ -92,7 +92,6 @@ const Events: CollectionConfig = { } ] } - ] }; diff --git a/src/payload-types.ts b/src/payload-types.ts new file mode 100644 index 0000000..ca641c2 --- /dev/null +++ b/src/payload-types.ts @@ -0,0 +1,50 @@ +/* tslint:disable */ +/** + * This file was automatically generated by Payload CMS. + * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, + * and re-run `payload generate:types` to regenerate this file. + */ + +export interface Config {} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + email?: string; + resetPasswordToken?: string; + resetPasswordExpiration?: string; + loginAttempts?: number; + lockUntil?: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "event-types". + */ +export interface EventType { + id: string; + name: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "events". + */ +export interface Event { + id: string; + name: string; + type: { + value: string | EventType; + relationTo: 'event-types'; + }; + startDate: string; + endDate?: string; + startTime: string; + endTime?: string; + createdAt: string; + updatedAt: string; +}