mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-26 22:26:10 +00:00
* add database to project. Seed data. Update customerId to customer_id * seed customers table data * use database everywhere * refactor * fix ts lint errors * add type to invoice edit page * remove fetch-data file and fetch data directly in components * update lates invoices to use sql * in invoice table, search the database here with SQL * rename tsx files to ts and add node script to seed data * address rest of PR comments * move all data fetches to own file * add types to filter invoices function * remove unused param * prettier * update function names
32 lines
678 B
TypeScript
32 lines
678 B
TypeScript
// This file contains type definitions for you data.
|
|
// These describe the shape of the data, and what data type each property should accept.
|
|
|
|
export type User = {
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
password: string;
|
|
};
|
|
|
|
export type Customer = {
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
image_url: string;
|
|
};
|
|
|
|
export type Invoice = {
|
|
id: number;
|
|
customer_id: number;
|
|
amount: number;
|
|
// 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';
|
|
date: string;
|
|
};
|
|
|
|
export type Revenue = {
|
|
month: string;
|
|
revenue: number;
|
|
};
|