mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-29 12:02:56 +02:00
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:
20
server/channelserver/repo_scenario.go
Normal file
20
server/channelserver/repo_scenario.go
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user