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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use crate::schema::*;
use chrono::NaiveDateTime;
#[derive(Identifiable, Queryable)]
pub struct Part {
pub id: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub pn: String,
pub mpn: String,
pub digikeypn: Option<String>,
pub descr: String,
pub ver: i32,
pub val: Option<String>,
pub mqty: i32,
}
#[derive(Eq, PartialEq, Debug, Insertable, AsChangeset)]
#[table_name = "parts"]
pub struct NewUpdatePart<'a> {
pub pn: &'a str,
pub mpn: &'a str,
pub descr: &'a str,
pub ver: &'a i32,
pub mqty: &'a i32,
}
#[derive(Identifiable, Queryable, Debug)]
pub struct PartsPart {
pub id: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub quantity: i32,
pub bom_ver: i32,
pub refdes: String,
pub nostuff: i32,
pub bom_part_id: i32,
pub part_id: i32,
}
#[derive(Eq, PartialEq, Debug, Insertable, AsChangeset)]
#[table_name = "parts_parts"]
pub struct NewPartsParts<'a> {
pub quantity: &'a i32,
pub bom_ver: &'a i32,
pub refdes: &'a str,
pub nostuff: &'a i32,
pub bom_part_id: &'a i32,
pub part_id: &'a i32,
}
#[derive(Identifiable, Queryable)]
#[table_name = "inventories"]
pub struct Inventory {
pub id: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub quantity: i32,
pub consumed: i32,
pub unit_price: Option<f32>,
pub notes: Option<String>,
pub part_ver: i32,
pub part_id: i32,
}
#[derive(Debug, Insertable, AsChangeset)]
#[table_name = "inventories"]
pub struct NewUpdateInventoryEntry<'a> {
pub quantity: &'a i32,
pub consumed: &'a i32,
pub unit_price: Option<&'a f32>,
pub notes: Option<&'a str>,
pub part_ver: &'a i32,
pub part_id: &'a i32,
}
#[derive(Identifiable, Queryable)]
#[table_name = "builds"]
pub struct Build {
pub id: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub estimated_completion: NaiveDateTime,
pub quantity: i32,
pub cost: Option<f32>,
pub complete: i32,
pub notes: Option<String>,
pub part_ver: i32,
pub part_id: i32,
}
#[derive(Debug, Insertable, AsChangeset)]
#[table_name = "builds"]
pub struct NewUpdateBuild<'a> {
pub quantity: &'a i32,
pub complete: &'a i32,
pub notes: Option<&'a str>,
pub part_ver: &'a i32,
pub part_id: &'a i32,
}