aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/models.rs b/src/models.rs
index ce28ac8..fb6122c 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -1,4 +1,6 @@
1use super::schema::members; 1use super::schema::{members, product};
2
3use bigdecimal::BigDecimal;
2use diesel::{Insertable, Queryable}; 4use diesel::{Insertable, Queryable};
3use serde::{Deserialize, Serialize}; 5use serde::{Deserialize, Serialize};
4 6
@@ -19,3 +21,21 @@ pub struct NewMember {
19 pub phone_number: String, 21 pub phone_number: String,
20 pub email_id: String, 22 pub email_id: String,
21} 23}
24
25#[derive(Queryable, Serialize)]
26pub struct Product {
27 pub id: i32,
28 pub name: String,
29 pub kind: Option<String>,
30 pub price: f32,
31 pub description: Option<String>,
32}
33
34#[derive(Insertable, Deserialize)]
35#[table_name = "product"]
36pub struct NewProduct {
37 pub name: String,
38 pub kind: Option<String>,
39 pub price: f32,
40 pub description: Option<String>,
41}