- update: default skills are set by the character service, not the database service
This commit is contained in:
@@ -72,21 +72,20 @@ impl CharacterRepository {
|
||||
user_id: i32,
|
||||
name: &str,
|
||||
inventory: serde_json::Value,
|
||||
skills: serde_json::Value,
|
||||
stats: serde_json::Value,
|
||||
looks: serde_json::Value,
|
||||
position: serde_json::Value,
|
||||
) -> Result<i32, sqlx::Error> {
|
||||
let default_skills = "[{\"id\": 11, \"level\": 1}, {\"id\": 12, \"level\": 1}, {\"id\": 16, \"level\": 1}, {\"id\": 19, \"level\": 1}, {\"id\": 20, \"level\": 1}, {\"id\": 21, \"level\": 1}, {\"id\": 26, \"level\": 1}, {\"id\": 41, \"level\": 1}, {\"id\": 42, \"level\": 1}, {\"id\": 43, \"level\": 1}, {\"id\": 46, \"level\": 1}, {\"id\": 47, \"level\": 1}, {\"id\": 48, \"level\": 1}, {\"id\": 49, \"level\": 1}, {\"id\": 50, \"level\": 1}]";
|
||||
let result = sqlx::query(
|
||||
"INSERT INTO characters (user_id, name, money, inventory, stats, skills, looks, position, created_at, updated_at, is_active) \
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, NOW(), NOW(), true) RETURNING id",
|
||||
"INSERT INTO characters (user_id, name, inventory, stats, skills, looks, position, created_at, updated_at, is_active) \
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, NOW(), NOW(), true) RETURNING id",
|
||||
)
|
||||
.bind(user_id)
|
||||
.bind(name)
|
||||
.bind(0)
|
||||
.bind(inventory)
|
||||
.bind(stats)
|
||||
.bind(default_skills)
|
||||
.bind(skills)
|
||||
.bind(looks)
|
||||
.bind(position)
|
||||
.fetch_one(&self.pool)
|
||||
|
||||
@@ -103,6 +103,7 @@ impl CharacterDbService for MyDatabaseService {
|
||||
req.user_id,
|
||||
&req.name,
|
||||
serde_json::from_str(&req.inventory).unwrap_or_default(),
|
||||
serde_json::from_str(&req.skills).unwrap_or_default(),
|
||||
serde_json::from_str(&req.stats).unwrap_or_default(),
|
||||
serde_json::from_str(&req.looks).unwrap_or_default(),
|
||||
serde_json::from_str(&req.position).unwrap_or_default(),
|
||||
|
||||
Reference in New Issue
Block a user