-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-models.ts
More file actions
74 lines (68 loc) · 1.63 KB
/
example-models.ts
File metadata and controls
74 lines (68 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Example TypeScript models for testing the Angular Form Generator extension
export interface User {
id?: number;
name: string;
email: string;
age: number;
isActive: boolean;
createdAt?: Date;
phoneNumber?: string;
website?: string;
bio?: string;
}
export class Product {
id?: number;
title: string = '';
description: string = '';
price: number = 0;
inStock: boolean = true;
category: string = '';
tags: string[] = [];
launchDate?: Date;
imageUrl?: string;
rating?: number;
constructor(data?: Partial<Product>) {
if (data) {
Object.assign(this, data);
}
}
}
export interface BlogPost {
id?: string;
title: string;
content: string;
author: string;
published: boolean;
publishedAt?: Date;
tags: string[];
viewCount: number;
featuredImage?: string;
excerpt?: string;
}
// Example of a more complex model for testing advanced features
export interface CustomerOrder {
orderId?: string;
customerName: string;
customerEmail: string;
orderDate: Date;
totalAmount: number;
status: 'pending' | 'confirmed' | 'shipped' | 'delivered' | 'cancelled';
shippingAddress: {
street: string;
city: string;
state: string;
zipCode: string;
country: string;
};
items: OrderItem[];
paymentMethod: 'credit_card' | 'debit_card' | 'paypal' | 'bank_transfer';
discountApplied?: number;
notes?: string;
}
export interface OrderItem {
productId: string;
productName: string;
quantity: number;
unitPrice: number;
totalPrice: number;
}