Player12
An open source football management simulator
Loading...
Searching...
No Matches
competition_repository.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <memory>
12#include <vector>
13
15#include "model/discipline.h"
17
23{
24 public:
25 explicit CompetitionRepository(std::shared_ptr<DatabaseConnection> db_conn);
26
28 void saveSeasonHistory(const std::vector<SeasonHistoryEntry>& entries) const;
29
31 std::vector<SeasonHistoryEntry> loadSeasonHistory() const;
32
35
37 PlayerSeasonTable loadPlayerSeasonStats(uint16_t season) const;
38
40 std::vector<PlayerSeasonStats> loadPlayerCareer(PlayerID player_id) const;
41
43 void saveDiscipline(const std::vector<DisciplinaryRecord>& records) const;
44
45 std::vector<DisciplinaryRecord> loadDiscipline() const;
46
47 private:
48 std::shared_ptr<DatabaseConnection> db_conn;
49};
Persists season history and per-player season statistics.
Definition competition_repository.h:23
void savePlayerSeasonStats(const PlayerSeasonTable &table) const
Inserts or replaces the given player season rows.
Definition competition_repository.cpp:135
std::shared_ptr< DatabaseConnection > db_conn
Definition competition_repository.h:48
std::vector< PlayerSeasonStats > loadPlayerCareer(PlayerID player_id) const
Loads every season row of a player (career history).
Definition competition_repository.cpp:184
PlayerSeasonTable loadPlayerSeasonStats(uint16_t season) const
Loads the player season rows of one season.
Definition competition_repository.cpp:165
std::vector< SeasonHistoryEntry > loadSeasonHistory() const
Loads all history rows ordered by season then competition.
Definition competition_repository.cpp:105
void saveDiscipline(const std::vector< DisciplinaryRecord > &records) const
Replaces all stored disciplinary records.
Definition competition_repository.cpp:198
void saveSeasonHistory(const std::vector< SeasonHistoryEntry > &entries) const
Inserts or replaces history rows (season, type, competition).
Definition competition_repository.cpp:73
std::vector< DisciplinaryRecord > loadDiscipline() const
Definition competition_repository.cpp:224
std::string_view table
Definition runtime_editor_validation.cpp:44
std::map< PlayerSeasonKey, PlayerSeasonStats > PlayerSeasonTable
Definition season_history.h:80
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21