added some more needed fields to the node entity

This commit is contained in:
Mika Bomm 2024-10-09 17:14:48 +02:00
parent 6e56ad5c7f
commit 190861da13
3 changed files with 19 additions and 7 deletions

2
.env
View file

@ -1,2 +1,2 @@
DATABASE_URL=postgres://apfel:apfel@localhostc:5432/apfel
DATABASE_URL=postgres://apfel:apfel@localhost:5432/apfel
TOKEN_SECRET=9b2cbd156a7a7e0e530acd780fdd16e8f37fa3fd8122c74a9b7e1ce6fc67980ed0e55572be4e382679a0c13d13f0a651d15e9e877bb579e957c899eb762b1bb4

View file

@ -17,7 +17,13 @@ pub struct Model {
#[sea_orm(column_type = "Float")]
pub temperature: f32,
#[sea_orm(column_type = "Double")]
pub battery: f64,
pub battery_minimum: f64,
#[sea_orm(column_type = "Double")]
pub battery_current: f64,
#[sea_orm(column_type = "Double")]
pub battery_maximum: f64,
#[sea_orm(column_type = "Double")]
pub voltage: f64,
pub uptime: i64,
pub group: Uuid,
}

View file

@ -36,7 +36,10 @@ impl MigrationTrait for Migration {
.col(double(Node::CoordLa))
.col(double(Node::CoordLo))
.col(float(Node::Temperature).default(-127))
.col(double(Node::Battery).default(-127))
.col(double(Node::BatteryMinimum).default(-127))
.col(double(Node::BatteryCurrent).default(-127))
.col(double(Node::BatteryMaximum).default(-127))
.col(double(Node::Voltage).default(-127))
.col(big_unsigned(Node::Uptime).default(0))
.col(uuid(Node::Group))
.foreign_key(
@ -71,13 +74,16 @@ impl MigrationTrait for Migration {
enum Node {
Table,
Id,
Name, //Default mac address, kann auch geändert werden über die API
Name,
Status,
CoordLa,
CoordLo,
Temperature,
Battery, //Measured in volts
Uptime,
Temperature, // def: -127
BatteryMinimum, // def: -127
BatteryCurrent, // def: -127
BatteryMaximum, // def: -127
Voltage, // def: -127
Uptime, // def: 0
Group,
}