mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 01:23:13 +01:00
refactor(channelserver): extract StampRepository, DistributionRepository, and SessionRepository
Eliminate 18 direct s.server.db calls from handlers_items.go, handlers_distitem.go, and handlers_session.go by moving queries into dedicated repository types. New repositories: - StampRepository (7 methods, stamps table) - DistributionRepository (4 methods, distribution/distribution_items) - SessionRepository (4 methods, sign_sessions/servers) Also adds ClearTreasureHunt and InsertKillLog to GuildRepository, which already owns those tables for read operations.
This commit is contained in:
@@ -886,6 +886,18 @@ type ScoutedCharacter struct {
|
||||
ActorID uint32 `db:"actor_id"`
|
||||
}
|
||||
|
||||
// ClearTreasureHunt clears the treasure_hunt field for a character on logout.
|
||||
func (r *GuildRepository) ClearTreasureHunt(charID uint32) error {
|
||||
_, err := r.db.Exec(`UPDATE guild_characters SET treasure_hunt=NULL WHERE character_id=$1`, charID)
|
||||
return err
|
||||
}
|
||||
|
||||
// InsertKillLog records a monster kill log entry for a character.
|
||||
func (r *GuildRepository) InsertKillLog(charID uint32, monster int, quantity uint8, timestamp time.Time) error {
|
||||
_, err := r.db.Exec(`INSERT INTO kill_logs (character_id, monster, quantity, timestamp) VALUES ($1, $2, $3, $4)`, charID, monster, quantity, timestamp)
|
||||
return err
|
||||
}
|
||||
|
||||
// ListInvitedCharacters returns all characters with pending guild invitations.
|
||||
func (r *GuildRepository) ListInvitedCharacters(guildID uint32) ([]*ScoutedCharacter, error) {
|
||||
rows, err := r.db.Queryx(`
|
||||
|
||||
Reference in New Issue
Block a user