diff options
Diffstat (limited to 'backend/src/models.rs')
-rw-r--r-- | backend/src/models.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/backend/src/models.rs b/backend/src/models.rs index a104209..bf531ad 100644 --- a/backend/src/models.rs +++ b/backend/src/models.rs | |||
@@ -35,6 +35,8 @@ pub struct Product { | |||
35 | pub kind: Option<String>, | 35 | pub kind: Option<String>, |
36 | pub price: f32, | 36 | pub price: f32, |
37 | pub description: Option<String>, | 37 | pub description: Option<String>, |
38 | pub src: Option<String>, | ||
39 | pub ios_src: Option<String>, | ||
38 | } | 40 | } |
39 | 41 | ||
40 | #[derive(Insertable, Deserialize)] | 42 | #[derive(Insertable, Deserialize)] |
@@ -48,6 +50,12 @@ pub struct NewProduct { | |||
48 | 50 | ||
49 | #[serde(skip_serializing_if = "Option::is_none")] | 51 | #[serde(skip_serializing_if = "Option::is_none")] |
50 | pub description: Option<String>, | 52 | pub description: Option<String>, |
53 | |||
54 | #[serde(skip_serializing_if = "Option::is_none")] | ||
55 | pub src: Option<String>, | ||
56 | |||
57 | #[serde(skip_serializing_if = "Option::is_none")] | ||
58 | pub ios_src: Option<String>, | ||
51 | } | 59 | } |
52 | 60 | ||
53 | #[derive(Deserialize)] | 61 | #[derive(Deserialize)] |
@@ -63,6 +71,7 @@ pub struct UpdateProduct { | |||
63 | pub struct CartItem { | 71 | pub struct CartItem { |
64 | pub cart_id: i32, | 72 | pub cart_id: i32, |
65 | pub product_id: i32, | 73 | pub product_id: i32, |
74 | pub quantity: Option<i32>, | ||
66 | } | 75 | } |
67 | 76 | ||
68 | #[derive(Insertable, Deserialize)] | 77 | #[derive(Insertable, Deserialize)] |
@@ -70,6 +79,7 @@ pub struct CartItem { | |||
70 | pub struct AddCartItem { | 79 | pub struct AddCartItem { |
71 | pub cart_id: i32, | 80 | pub cart_id: i32, |
72 | pub product_id: i32, | 81 | pub product_id: i32, |
82 | pub quantity: Option<i32>, | ||
73 | } | 83 | } |
74 | 84 | ||
75 | /* Rating */ | 85 | /* Rating */ |
@@ -95,3 +105,21 @@ pub struct AddRating { | |||
95 | pub product_id: i32, | 105 | pub product_id: i32, |
96 | pub customer_id: i32, | 106 | pub customer_id: i32, |
97 | } | 107 | } |
108 | |||
109 | /* Transaction */ | ||
110 | #[derive(Queryable, Serialize)] | ||
111 | pub struct Transaction { | ||
112 | pub id: i32, | ||
113 | pub payment_type: String, | ||
114 | pub amount: f32, | ||
115 | pub customer_id: Option<i32>, | ||
116 | pub order_date: NaiveDate, | ||
117 | } | ||
118 | |||
119 | #[derive(Insertable, Deserialize)] | ||
120 | #[table_name = "transaction"] | ||
121 | pub struct AddTransaction { | ||
122 | pub payment_type: String, | ||
123 | pub amount: f32, | ||
124 | pub customer_id: Option<i32>, | ||
125 | } | ||