2020-06-01 21:34:52 +00:00
|
|
|
extern crate serde_json;
|
|
|
|
|
2021-01-01 22:39:36 +00:00
|
|
|
use super::schema::{body, character, entity, item, skill, skill_group};
|
2020-05-09 15:41:25 +00:00
|
|
|
|
2020-09-17 23:02:14 +00:00
|
|
|
#[derive(Debug, Insertable, PartialEq)]
|
|
|
|
#[table_name = "entity"]
|
|
|
|
pub struct Entity {
|
|
|
|
pub entity_id: i64,
|
2020-05-09 15:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable)]
|
|
|
|
#[table_name = "character"]
|
|
|
|
pub struct NewCharacter<'a> {
|
2020-09-17 23:02:14 +00:00
|
|
|
pub character_id: i64,
|
2020-05-09 15:41:25 +00:00
|
|
|
pub player_uuid: &'a str,
|
|
|
|
pub alias: &'a str,
|
2021-01-01 22:39:36 +00:00
|
|
|
pub waypoint: Option<String>,
|
2020-05-09 15:41:25 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 23:02:14 +00:00
|
|
|
#[derive(Identifiable, Queryable, Debug)]
|
2020-05-09 15:41:25 +00:00
|
|
|
#[primary_key(character_id)]
|
2020-09-17 23:02:14 +00:00
|
|
|
#[table_name = "character"]
|
|
|
|
pub struct Character {
|
|
|
|
pub character_id: i64,
|
|
|
|
pub player_uuid: String,
|
|
|
|
pub alias: String,
|
2021-01-01 22:39:36 +00:00
|
|
|
pub waypoint: Option<String>,
|
2020-05-09 15:41:25 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 23:02:14 +00:00
|
|
|
#[primary_key(item_id)]
|
|
|
|
#[table_name = "item"]
|
|
|
|
#[derive(Debug, Insertable, Queryable, AsChangeset)]
|
|
|
|
pub struct Item {
|
|
|
|
pub item_id: i64,
|
|
|
|
pub parent_container_item_id: i64,
|
|
|
|
pub item_definition_id: String,
|
|
|
|
pub stack_size: i32,
|
|
|
|
pub position: String,
|
2020-05-09 15:41:25 +00:00
|
|
|
}
|
2020-04-20 08:44:29 +00:00
|
|
|
|
2020-09-17 23:02:14 +00:00
|
|
|
#[derive(Associations, Identifiable, Insertable, Queryable, Debug)]
|
|
|
|
#[primary_key(body_id)]
|
|
|
|
#[table_name = "body"]
|
|
|
|
pub struct Body {
|
|
|
|
pub body_id: i64,
|
|
|
|
pub variant: String,
|
|
|
|
pub body_data: String,
|
2020-05-11 10:06:53 +00:00
|
|
|
}
|
2020-12-13 17:21:51 +00:00
|
|
|
|
|
|
|
#[derive(Associations, Identifiable, Insertable, Queryable, Debug)]
|
2021-01-13 08:11:31 +00:00
|
|
|
#[primary_key(entity_id, skill_type)]
|
2020-12-13 17:21:51 +00:00
|
|
|
#[table_name = "skill"]
|
|
|
|
pub struct Skill {
|
2021-01-13 08:11:31 +00:00
|
|
|
pub entity_id: i64,
|
2020-12-13 17:21:51 +00:00
|
|
|
pub skill_type: String,
|
|
|
|
pub level: Option<i32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Associations, Identifiable, Insertable, Queryable, Debug)]
|
2021-01-13 08:11:31 +00:00
|
|
|
#[primary_key(entity_id, skill_group_type)]
|
2020-12-13 17:21:51 +00:00
|
|
|
#[table_name = "skill_group"]
|
|
|
|
pub struct SkillGroup {
|
2021-01-13 08:11:31 +00:00
|
|
|
pub entity_id: i64,
|
2020-12-13 17:21:51 +00:00
|
|
|
pub skill_group_type: String,
|
|
|
|
pub exp: i32,
|
|
|
|
pub available_sp: i32,
|
2021-01-02 04:11:30 +00:00
|
|
|
pub earned_sp: i32,
|
2020-12-13 17:21:51 +00:00
|
|
|
}
|