Player12
An open source football management simulator
Loading...
Searching...
No Matches
league_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/league.h"
16
22{
23 public:
28 explicit LeagueRepository(std::shared_ptr<DatabaseConnection> db_conn);
29
34 std::vector<League> loadAllLeagues() const;
35
40 void insertLeague(const League& league) const;
41
46 void insertLeagueWithId(const League& league) const;
47
52 void saveLeaguePoints(const League& league) const;
53
58 void loadLeaguePoints(League& league) const;
59
64 void saveTeamMemberships(const League& league) const;
65
69 void resetAllLeaguePoints() const;
70
71 private:
72 std::shared_ptr<DatabaseConnection> db_conn;
73 void loadTeamsForLeague(League& league) const;
74};
Repository class for managing League entities in the database.
Definition league_repository.h:22
void insertLeague(const League &league) const
Insert a new league into the database.
Definition league_repository.cpp:72
void resetAllLeaguePoints() const
Reset points for all leagues in the database.
Definition league_repository.cpp:172
void loadLeaguePoints(League &league) const
Load the points of teams for a specific league from the database.
Definition league_repository.cpp:139
void saveLeaguePoints(const League &league) const
Save the points of teams in a league to the database.
Definition league_repository.cpp:112
void saveTeamMemberships(const League &league) const
Persists the league membership (Teams.league_id) of its teams.
Definition league_repository.cpp:157
void loadTeamsForLeague(League &league) const
Definition league_repository.cpp:56
std::shared_ptr< DatabaseConnection > db_conn
Definition league_repository.h:72
void insertLeagueWithId(const League &league) const
Insert a league with a specific ID into the database.
Definition league_repository.cpp:83
std::vector< League > loadAllLeagues() const
Load all leagues from the database.
Definition league_repository.cpp:25
Represents a football league containing teams and a leaderboard.
Definition league.h:41