134 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			134 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /* Copyright (C) 2024 Manuel Bustillo*/
 | |
| 
 | |
| // This file contains type definitions for your data.
 | |
| // It describes the shape of the data, and what data type each property should accept.
 | |
| // For simplicity of teaching, we're manually defining these types.
 | |
| // However, these types are generated automatically if you're using an ORM such as Prisma.
 | |
| export type User = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   email: string;
 | |
|   password: string;
 | |
| };
 | |
| 
 | |
| export type Customer = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   email: string;
 | |
|   image_url: string;
 | |
| };
 | |
| 
 | |
| export type GuestStatus = 'considered' | 'invited' | 'confirmed' | 'declined' | 'tentative';
 | |
| export type Guest = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   group_name?: string;
 | |
|   color?: string;
 | |
|   status?: GuestStatus
 | |
| }
 | |
| 
 | |
| export type Expense = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   amount: number;
 | |
|   pricingType: 'fixed' | 'per person';
 | |
| };
 | |
| 
 | |
| export type TableArrangement = {
 | |
|   id: string;
 | |
|   number: number;
 | |
|   name: string;
 | |
|   guests?: Guest[];
 | |
|   discomfort?: number
 | |
| }
 | |
| 
 | |
| export type Group = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   guest_count: number;
 | |
|   icon: string;
 | |
|   children: Group[];
 | |
|   color?: string;
 | |
|   attendance?: AttendanceSummary
 | |
| };
 | |
| 
 | |
| export type AttendanceSummary = {
 | |
|   considered: number;
 | |
|   invited: number;
 | |
|   confirmed: number;
 | |
|   declined: number;
 | |
|   tentative: number;
 | |
|   total: number;
 | |
| }
 | |
| 
 | |
| export type Invoice = {
 | |
|   id: string;
 | |
|   customer_id: string;
 | |
|   amount: number;
 | |
|   date: string;
 | |
|   // In TypeScript, this is called a string union type.
 | |
|   // It means that the "status" property can only be one of the two strings: 'pending' or 'paid'.
 | |
|   status: 'pending' | 'paid';
 | |
| };
 | |
| 
 | |
| export type Revenue = {
 | |
|   month: string;
 | |
|   revenue: number;
 | |
| };
 | |
| 
 | |
| export type LatestInvoice = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   image_url: string;
 | |
|   email: string;
 | |
|   amount: string;
 | |
| };
 | |
| 
 | |
| // The database returns a number for amount, but we later format it to a string with the formatCurrency function
 | |
| export type LatestInvoiceRaw = Omit<LatestInvoice, 'amount'> & {
 | |
|   amount: number;
 | |
| };
 | |
| 
 | |
| export type guestsTable = {
 | |
|   id: string;
 | |
|   customer_id: string;
 | |
|   name: string;
 | |
|   email: string;
 | |
|   image_url: string;
 | |
|   date: string;
 | |
|   amount: number;
 | |
|   status: 'pending' | 'paid';
 | |
| };
 | |
| 
 | |
| export type CustomersTableType = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   email: string;
 | |
|   image_url: string;
 | |
|   total_guests: number;
 | |
|   total_pending: number;
 | |
|   total_paid: number;
 | |
| };
 | |
| 
 | |
| export type FormattedCustomersTable = {
 | |
|   id: string;
 | |
|   name: string;
 | |
|   email: string;
 | |
|   image_url: string;
 | |
|   total_guests: number;
 | |
|   total_pending: string;
 | |
|   total_paid: string;
 | |
| };
 | |
| 
 | |
| export type CustomerField = {
 | |
|   id: string;
 | |
|   name: string;
 | |
| };
 | |
| 
 | |
| export type InvoiceForm = {
 | |
|   id: string;
 | |
|   customer_id: string;
 | |
|   amount: number;
 | |
|   status: 'pending' | 'paid';
 | |
| };
 |