refactor(channelserver): extract Goocoo, Diva, Misc, Scenario, and Mercenary repositories

Move remaining raw s.server.db.* queries from handler files into
dedicated repository structs, completing the repository extraction
effort. Also adds SaveCharacterData and SaveHouseData to
CharacterRepository.

Fixes guild_hunts query to select both cats_used and start columns
to match the existing two-column Scan call. Adds slot index
validation in GoocooRepository to prevent SQL injection via
fmt.Sprintf.
This commit is contained in:
Houmgaor
2026-02-21 13:27:08 +01:00
parent f17cb96b52
commit 2738b19c32
13 changed files with 235 additions and 30 deletions

View File

@@ -0,0 +1,20 @@
package channelserver
import (
"github.com/jmoiron/sqlx"
)
// ScenarioRepository centralizes all database access for the scenario_counter table.
type ScenarioRepository struct {
db *sqlx.DB
}
// NewScenarioRepository creates a new ScenarioRepository.
func NewScenarioRepository(db *sqlx.DB) *ScenarioRepository {
return &ScenarioRepository{db: db}
}
// GetCounters returns all scenario counters.
func (r *ScenarioRepository) GetCounters() (*sqlx.Rows, error) {
return r.db.Queryx("SELECT scenario_id, category_id FROM scenario_counter")
}