2020-10-24 17:45:59 -06:00
|
|
|
use thiserror::Error;
|
|
|
|
|
2019-10-05 17:37:49 -07:00
|
|
|
use crate::entity::account::*;
|
|
|
|
use crate::entity::character::*;
|
2019-12-09 23:11:27 -08:00
|
|
|
use crate::entity::item::*;
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
|
|
|
|
// TODO: better granularity?
|
|
|
|
//#[derive(Error, Debug)]
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
#[error("")]
|
|
|
|
pub enum GatewayError {
|
|
|
|
Error,
|
|
|
|
PgError(#[from] sqlx::Error)
|
|
|
|
}
|
|
|
|
|
2020-06-02 18:51:18 -06:00
|
|
|
#[async_trait::async_trait]
|
|
|
|
pub trait EntityGateway: Send + Sync + Clone {
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn create_user(&mut self, _user: NewUserAccountEntity) -> Result<UserAccountEntity, GatewayError> {
|
2020-03-30 19:28:49 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn get_user_by_id(&self, _id: UserAccountId) -> Result<UserAccountEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn get_user_by_name(&self, _username: String) -> Result<UserAccountEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn save_user(&mut self, _user: &UserAccountEntity) -> Result<(), GatewayError> {
|
2020-03-30 19:28:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn create_user_settings(&mut self, _settings: NewUserSettingsEntity) -> Result<UserSettingsEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn get_user_settings_by_user(&self, _user: &UserAccountEntity) -> Result<UserSettingsEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn save_user_settings(&mut self, _settings: &UserSettingsEntity) -> Result<(), GatewayError> {
|
2020-03-30 19:28:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn create_character(&mut self, _char: NewCharacterEntity) -> Result<CharacterEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-03 17:23:39 -06:00
|
|
|
// TODO: just make this a vec sorted by slot order?
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn get_characters_by_user(&self, _user: &UserAccountEntity) -> Result<[Option<CharacterEntity>; 4], GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn save_character(&mut self, _char: &CharacterEntity) -> Result<(), GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn get_guild_card_data_by_user(&self, _user: &UserAccountEntity) -> Result<GuildCardDataEntity, GatewayError> {
|
2019-10-05 17:37:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
2019-12-09 23:11:27 -08:00
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn create_item(&mut self, _item: NewItemEntity) -> Result<ItemEntity, GatewayError> {
|
2020-03-30 19:28:49 -07:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-31 10:50:14 -06:00
|
|
|
async fn change_item(&mut self, _id: &ItemEntityId, _item: &ItemDetail) -> Result<(), GatewayError> {
|
2019-12-09 23:11:27 -08:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn change_item_location(&mut self, _item_id: &ItemEntityId, _item_location: ItemLocation) -> Result<(), GatewayError> {
|
2020-07-19 14:14:07 -06:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn feed_mag(&mut self, _mag_item_id: &ItemEntityId, _tool_item_id: &ItemEntityId) -> Result<(), GatewayError> {
|
2020-08-31 23:44:39 -06:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn change_mag_owner(&mut self, _mag_item_id: &ItemEntityId, _character: &CharacterEntity) -> Result<(), GatewayError> {
|
2020-09-02 22:03:45 -06:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-24 17:45:59 -06:00
|
|
|
async fn use_mag_cell(&mut self, _mag_item_id: &ItemEntityId, _mag_cell_id: &ItemEntityId) -> Result<(), GatewayError> {
|
2020-09-07 08:02:12 -06:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-10-29 19:34:09 -06:00
|
|
|
async fn get_items_by_character(&self, _char_id: &CharacterEntityId) -> Result<Vec<ItemEntity>, GatewayError> {
|
2019-12-09 23:11:27 -08:00
|
|
|
unimplemented!();
|
|
|
|
}
|
2019-10-05 17:37:49 -07:00
|
|
|
}
|