From b79c957779eb0ff2ca6d18ae3b9a0fd9ebd229c4 Mon Sep 17 00:00:00 2001 From: RustamRu Date: Sun, 8 Dec 2024 09:55:13 +0300 Subject: [PATCH] add order form page models, reorder landing models (#8) --- src/models/index.ts | 4 +--- src/models/landing/car.ts | 18 ++++++++++++++++++ src/models/landing/customer.ts | 1 + src/models/landing/index.ts | 5 +++++ src/models/landing/order.ts | 23 +++++++++++++++++++++++ src/models/{ => landing}/review.ts | 0 src/models/landing/washing.ts | 5 +++++ src/models/order.ts | 5 ----- 8 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/models/landing/car.ts create mode 100644 src/models/landing/customer.ts create mode 100644 src/models/landing/order.ts rename src/models/{ => landing}/review.ts (100%) create mode 100644 src/models/landing/washing.ts delete mode 100644 src/models/order.ts diff --git a/src/models/index.ts b/src/models/index.ts index ddf5c34..13c310b 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,3 +1 @@ -export * from './i18n'; -export * as Order from './order'; -export * as Review from './review'; \ No newline at end of file +export * from './i18n'; \ No newline at end of file diff --git a/src/models/landing/car.ts b/src/models/landing/car.ts new file mode 100644 index 0000000..9058a85 --- /dev/null +++ b/src/models/landing/car.ts @@ -0,0 +1,18 @@ +export type RegistrationNumber = string; // А012ВЕ + +export type Color = string; // #000000 + +export const enum BodyStyle { + UNKNOWN = 0, + SEDAN = 1, + HATCHBACK = 2, + CROSSOVER = 3, + SUV = 4, + STATION_WAGON = 5, + COUPE = 6, + MINIVAN = 7, + PICKUP = 8, + LIFTBACK = 9, + SPORTS_CAR = 10, + OTHER = 99 +} \ No newline at end of file diff --git a/src/models/landing/customer.ts b/src/models/landing/customer.ts new file mode 100644 index 0000000..f98cf1a --- /dev/null +++ b/src/models/landing/customer.ts @@ -0,0 +1 @@ +export type PhoneNumber = string; // +79876543210 \ No newline at end of file diff --git a/src/models/landing/index.ts b/src/models/landing/index.ts index 11add84..c2ff256 100644 --- a/src/models/landing/index.ts +++ b/src/models/landing/index.ts @@ -1 +1,6 @@ +export * as Car from './car'; +export * as Customer from './customer'; +export * as Washing from './washing'; +export * as Order from './order'; // import: Car, Customer, Washing +export * as Review from './review'; export * from './stubs'; \ No newline at end of file diff --git a/src/models/landing/order.ts b/src/models/landing/order.ts new file mode 100644 index 0000000..d286a90 --- /dev/null +++ b/src/models/landing/order.ts @@ -0,0 +1,23 @@ +import { Car, Customer, Washing } from "."; + +export type Id = string; + +export type Create = { + customer: { + phone: Customer.PhoneNumber, + }; + car: { + number: Car.RegistrationNumber, + body: Car.BodyStyle, + color: Car.Color, + }, + washing: { + location: Washing.Location + begin: Washing.AvailableBeginDateTime, + end: Washing.AvailableEndDateTime, + } +}; + +export type View = { + id: Id; +}; \ No newline at end of file diff --git a/src/models/review.ts b/src/models/landing/review.ts similarity index 100% rename from src/models/review.ts rename to src/models/landing/review.ts diff --git a/src/models/landing/washing.ts b/src/models/landing/washing.ts new file mode 100644 index 0000000..c61c638 --- /dev/null +++ b/src/models/landing/washing.ts @@ -0,0 +1,5 @@ +export type Location = string; // ? + +export type AvailableBeginDateTime = string; // YYYY-MM-DDThh:mm + +export type AvailableEndDateTime = string; // YYYY-MM-DDThh:mm \ No newline at end of file diff --git a/src/models/order.ts b/src/models/order.ts deleted file mode 100644 index 5cd62d9..0000000 --- a/src/models/order.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type Id = string; - -export type View = { - id: Id; -}; \ No newline at end of file