Files
next-learn/dashboard/starter-example/app/lib/definitions.ts
Delba de Oliveira 82f2fae791 Add starter example (#225)
* Duplicate starter

* Remove code for chapter 16

* Add code for chapter 15

* first 3 chapters

* Remove routes and actions

* chapter 3

* Chapters 12-13

* chapter 5

* Revert "Chapters 12-13"

This reverts commit b6da764d85.

* re-add Link to page

* chapter 5

* chapter 6

* Chapter 11 and 12

* chapter 7

* Revert

* Chapter 11

* Remove PPR flag

* chapter 8

* Chapter 9

* switch from pnpm to npm

* 💅

* Create pnpm-lock.yaml

* build errors

* Fix

* Fix

* Update next

* Update nextauth

---------

Co-authored-by: StephDietz <steph.dietz@vercel.com>
2023-10-26 12:49:57 -05:00

89 lines
1.8 KiB
TypeScript

// 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 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 InvoicesTable = {
id: string;
customer_id: string;
name: string;
email: string;
image_url: string;
date: string;
amount: number;
status: 'pending' | 'paid';
};
export type CustomersTable = {
id: string;
name: string;
email: string;
image_url: string;
total_invoices: number;
total_pending: number;
total_paid: number;
};
export type FormattedCustomersTable = {
id: string;
name: string;
email: string;
image_url: string;
total_invoices: 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';
};