Commit 9a1441f6 authored by AlexandrValgamov's avatar AlexandrValgamov
Browse files

Widget | feat: add interfaces

parent b02804cd
Loading
Loading
Loading
Loading

src/interfaces/auth.ts

0 → 100644
+54 −0
Original line number Diff line number Diff line
interface UserBase {
  surname?: string;
  phone: string;
  birthday: string;
  typeCard: 'PLASTIC' | 'VIRTUAL';
  numberCard: string;
  email: string;
  codeCard?: string;
  isIncognita: 'true' | 'false';
}

interface UserWithFullName extends UserBase {
  isIncognita: 'false';
  firstName: string;
  lastName: string;
}

interface UserIncognito extends UserBase {
  isIncognita: 'true';
  firstName?: string;
  lastName?: string;
}

export type TUser = UserWithFullName | UserIncognito;

export interface IUserResponse {
  id: number | null;
  isIncognita?: string;
  phone: string;
  birthday: string;
  typeCard: string;
  numberCard: string;
  email: string;
  codeCard?: string;
  avatar: string;
  firstName?: string;
  lastName?: string;
  surname?: string;
}

export interface ILogin {
  phone: string;
}

export interface IGetUserResponse {
  success: boolean;
  user: IUserResponse;
}

export interface ILoginResponse {
  success: boolean;
  user: IUserResponse;
  accessToken: string;
}
+8 −0
Original line number Diff line number Diff line
import { IProductState } from './product';

export interface BasketState {
  [shop: string]: {
    items: IProductState[];
    totalPrice: number | null;
  };
}
+32 −0
Original line number Diff line number Diff line
import { type Shop } from './shops';

export interface MenuItem {
  icon: string;
  name: string;
  price: string;
  size?: string;
  slug: string;
}

export interface MenuList {
  id: number;
  items: MenuItem[];
  name: string;
}

export interface MenuCategory {
  id: number;
  category: string;
  icon: string;
  name: string;
  lists: MenuList[];
}

export interface Categories {
  [key: string]: MenuCategory;
}

export interface Catalog {
  categories: Categories;
  shop: Shop;
}
+6 −0
Original line number Diff line number Diff line
export * from './shops';
export * from './catalog';
export * from './basket';
export * from './recommendations';
export * from './product';
export * from './auth';
+58 −0
Original line number Diff line number Diff line
import { type Shop } from './shops';

export interface IAddon {
  name: string;
  price: string;
}

export interface IOption {
  name: string;
  price: string;
}

export interface IProductInfo {
  desc: string;
}

export interface INutritionalValue {
  name: string;
  unit: string;
  value: number;
}

export interface IModifications {
  addons: IAddon[];
  options: IOption[];
}

export interface IProduct {
  name: string;
  icon: string;
  slug: string;
  size: string;
  price: string;
  image: string;
  modifications: IModifications;
  info: IProductInfo;
  nutritionalValue: INutritionalValue[];
}

export interface IProductData {
  product: IProduct;
  shop: Shop;
}

export interface IProductState {
  name: string;
  icon: string;
  productSlug: string;
  addons: string[];
  modification?: string;
  count: number;
  cost: number;
}

export interface IFormState {
  addons: string[];
  modification?: string;
}
Loading