source: app/lib/definitions.ts@ f078223

nextjs
Last change on this file since f078223 was bac34a3, checked in by Vasilaki Tocili <vasilakigorgi@…>, 5 months ago

refactor: Move NextJS to root, remove everything else

  • Removed the Python backend and prototype CLI app since now they live

in the prototype branch

  • Moved the whole NextJS app to the root of the project, removing the

unnecessary stuff left from the course

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[78f20de]1// This file contains type definitions for your data.
2// It describes the shape of the data, and what data type each property should accept.
3// For simplicity of teaching, we're manually defining these types.
4// However, these types are generated automatically if you're using an ORM such as Prisma.
5export type User = {
6 id: string;
7 name: string;
8 email: string;
9 password: string;
10};
11
12export type Customer = {
13 id: string;
14 name: string;
15 email: string;
16 image_url: string;
17};
18
19export type Invoice = {
20 id: string;
21 customer_id: string;
22 amount: number;
23 date: string;
24 // In TypeScript, this is called a string union type.
25 // It means that the "status" property can only be one of the two strings: 'pending' or 'paid'.
26 status: 'pending' | 'paid';
27};
28
29export type Revenue = {
30 month: string;
31 revenue: number;
32};
33
34export type LatestInvoice = {
35 id: string;
36 name: string;
37 image_url: string;
38 email: string;
39 amount: string;
40};
41
42// The database returns a number for amount, but we later format it to a string with the formatCurrency function
43export type LatestInvoiceRaw = Omit<LatestInvoice, 'amount'> & {
44 amount: number;
45};
46
47export type InvoicesTable = {
48 id: string;
49 customer_id: string;
50 name: string;
51 email: string;
52 image_url: string;
53 date: string;
54 amount: number;
55 status: 'pending' | 'paid';
56};
57
58export type CustomersTableType = {
59 id: string;
60 name: string;
61 email: string;
62 image_url: string;
63 total_invoices: number;
64 total_pending: number;
65 total_paid: number;
66};
67
68export type FormattedCustomersTable = {
69 id: string;
70 name: string;
71 email: string;
72 image_url: string;
73 total_invoices: number;
74 total_pending: string;
75 total_paid: string;
76};
77
78export type CustomerField = {
79 id: string;
80 name: string;
81};
82
83export type InvoiceForm = {
84 id: string;
85 customer_id: string;
86 amount: number;
87 status: 'pending' | 'paid';
88};
Note: See TracBrowser for help on using the repository browser.