Files
Erupe/server/channelserver/repo_scenario.go
Houmgaor 2738b19c32 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.
2026-02-21 13:27:08 +01:00

21 lines
547 B
Go

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")
}