Initial commit: Harat's Booking monorepo with deploy setup
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@harats/shared",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// ─── Enums ───────────────────────────────────────────
|
||||
|
||||
export enum Role {
|
||||
USER = 'USER',
|
||||
ADMIN = 'ADMIN',
|
||||
}
|
||||
|
||||
export enum ReservationStatus {
|
||||
PENDING = 'PENDING',
|
||||
CONFIRMED = 'CONFIRMED',
|
||||
CANCELLED = 'CANCELLED',
|
||||
COMPLETED = 'COMPLETED',
|
||||
}
|
||||
|
||||
export enum DishAvailability {
|
||||
AVAILABLE = 'AVAILABLE',
|
||||
STOPPED = 'STOPPED',
|
||||
}
|
||||
|
||||
// ─── User ────────────────────────────────────────────
|
||||
|
||||
export interface IUser {
|
||||
id: number;
|
||||
phone: string;
|
||||
name: string;
|
||||
surname?: string | null;
|
||||
email?: string | null;
|
||||
role: Role;
|
||||
cardLastFour?: string | null;
|
||||
cardExpiry?: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface IRegisterPayload {
|
||||
phone: string;
|
||||
password: string;
|
||||
name: string;
|
||||
surname?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export interface ILoginPayload {
|
||||
phone: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface IAuthResponse {
|
||||
user: IUser;
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
// ─── Pub ─────────────────────────────────────────────
|
||||
|
||||
export interface IPub {
|
||||
id: number;
|
||||
address: string;
|
||||
phone: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
// ─── Table ───────────────────────────────────────────
|
||||
|
||||
export interface ITable {
|
||||
id: number;
|
||||
pubId: number;
|
||||
number: number;
|
||||
capacity: number;
|
||||
posX: number;
|
||||
posY: number;
|
||||
width: number;
|
||||
height: number;
|
||||
shape: 'rect' | 'circle';
|
||||
zone?: string | null;
|
||||
}
|
||||
|
||||
export interface ITableAvailability extends ITable {
|
||||
isAvailable: boolean;
|
||||
}
|
||||
|
||||
// ─── Category ────────────────────────────────────────
|
||||
|
||||
export interface ICategory {
|
||||
id: number;
|
||||
title: string;
|
||||
}
|
||||
|
||||
// ─── Dish ────────────────────────────────────────────
|
||||
|
||||
export interface IDish {
|
||||
id: number;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
categoryId: number;
|
||||
category?: ICategory;
|
||||
grams?: number | null;
|
||||
price: number;
|
||||
photo?: string | null;
|
||||
availability: DishAvailability;
|
||||
}
|
||||
|
||||
// ─── Menu ────────────────────────────────────────────
|
||||
|
||||
export interface IMenuItem {
|
||||
id: number;
|
||||
pubId: number;
|
||||
dishId: number;
|
||||
dish: IDish;
|
||||
}
|
||||
|
||||
export interface ILunchMenuItem {
|
||||
id: number;
|
||||
pubId: number;
|
||||
dishId: number;
|
||||
dish: IDish;
|
||||
weekStart: string;
|
||||
weekEnd: string;
|
||||
}
|
||||
|
||||
// ─── Billboard ───────────────────────────────────────
|
||||
|
||||
export interface IBillboard {
|
||||
id: number;
|
||||
title: string;
|
||||
artist: string;
|
||||
pubId: number;
|
||||
datetime: string;
|
||||
poster?: string | null;
|
||||
}
|
||||
|
||||
// ─── Reservation ─────────────────────────────────────
|
||||
|
||||
export interface IReservationDish {
|
||||
id: number;
|
||||
dishId: number;
|
||||
dish?: IDish;
|
||||
quantity: number;
|
||||
priceAtOrder: number;
|
||||
}
|
||||
|
||||
export interface IReservation {
|
||||
id: number;
|
||||
userId: number;
|
||||
pubId: number;
|
||||
pub?: IPub;
|
||||
tableId: number;
|
||||
table?: ITable;
|
||||
date: string;
|
||||
time: string;
|
||||
numPeople: number;
|
||||
status: ReservationStatus;
|
||||
totalCost?: number | null;
|
||||
prepaid?: number | null;
|
||||
dishes: IReservationDish[];
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface ICreateReservation {
|
||||
pubId: number;
|
||||
tableId: number;
|
||||
date: string;
|
||||
time: string;
|
||||
numPeople: number;
|
||||
dishes?: { dishId: number; quantity: number }[];
|
||||
}
|
||||
|
||||
// ─── API Envelope ────────────────────────────────────
|
||||
|
||||
export interface IApiResponse<T = unknown> {
|
||||
success: boolean;
|
||||
data?: T;
|
||||
error?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface IPaginatedResponse<T> extends IApiResponse<T[]> {
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user