- update: proto files to move common stuff into common proto files
- update: made changes for new proto paths - add: skills to character table - add: load and send skills to client from db - add: chat proto
This commit is contained in:
@@ -11,6 +11,7 @@ pub struct Character {
|
||||
pub name: String,
|
||||
pub inventory: serde_json::Value,
|
||||
pub stats: serde_json::Value,
|
||||
pub skills: serde_json::Value,
|
||||
pub looks: serde_json::Value,
|
||||
pub position: serde_json::Value,
|
||||
pub created_at: chrono::NaiveDateTime,
|
||||
@@ -39,7 +40,7 @@ impl CharacterRepository {
|
||||
|
||||
// Fetch from database
|
||||
let character = sqlx::query_as::<_, Character>(
|
||||
"SELECT id, user_id, name, inventory, stats, looks, position, \
|
||||
"SELECT id, user_id, name, inventory, stats, skills, looks, position, \
|
||||
created_at, updated_at, extract(epoch from (deleted_at - now()))::BIGINT as deleted_at, is_active \
|
||||
FROM characters WHERE id = $1 AND is_active = true",
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use serde_json::Value::Null;
|
||||
use crate::grpc::{Character, CharacterRequest, CharacterListRequest, CharacterListResponse, CreateCharacterRequest, CreateCharacterResponse, DeleteCharacterRequest, DeleteCharacterResponse, Empty};
|
||||
use crate::grpc::{Character, CharacterRequest, CharacterListRequest, CharacterListResponse, CreateCharacterRequest, CreateCharacterResponse, DeleteCharacterRequest, DeleteCharacterResponse};
|
||||
use crate::grpc::character_service_server::CharacterService;
|
||||
use crate::grpc::database_service::MyDatabaseService;
|
||||
use tonic::{Request, Response, Status};
|
||||
@@ -29,6 +29,7 @@ impl CharacterService for MyDatabaseService {
|
||||
name: character.name,
|
||||
inventory: character.inventory.to_string(),
|
||||
stats: character.stats.to_string(),
|
||||
skills: character.skills.to_string(),
|
||||
looks: character.looks.to_string(),
|
||||
position: character.position.to_string(),
|
||||
created_at: character.created_at.to_string(),
|
||||
@@ -66,6 +67,7 @@ impl CharacterService for MyDatabaseService {
|
||||
name: character.name,
|
||||
inventory: character.inventory.to_string(),
|
||||
stats: character.stats.to_string(),
|
||||
skills: character.skills.to_string(),
|
||||
looks: character.looks.to_string(),
|
||||
position: character.position.to_string(),
|
||||
created_at: character.created_at.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user