|
1 | 1 | using LegendsViewer.Backend.Legends.WorldObjects; |
2 | 2 | using Microsoft.AspNetCore.Mvc; |
3 | | -using LegendsViewer.Backend.Legends.Interfaces; |
4 | 3 | using LegendsViewer.Backend.Legends.EventCollections; |
5 | | -using LegendsViewer.Backend.Legends.Events; |
| 4 | +using LegendsViewer.Backend.DataAccess.Repositories.Interfaces; |
6 | 5 |
|
7 | 6 | namespace LegendsViewer.Backend.Controllers; |
8 | 7 |
|
9 | | -public class DanceFormController(IWorld worldDataService) : WorldObjectGenericController<DanceForm>(worldDataService.DanceForms, worldDataService.GetDanceForm) |
| 8 | +public class DanceFormController(IWorldObjectRepository<DanceForm> repository) : WorldObjectGenericController<DanceForm>(repository) |
10 | 9 | { |
11 | 10 | } |
12 | 11 |
|
13 | | -public class MusicalFormController(IWorld worldDataService) : WorldObjectGenericController<MusicalForm>(worldDataService.MusicalForms, worldDataService.GetMusicalForm) |
| 12 | +public class MusicalFormController(IWorldObjectRepository<MusicalForm> repository) : WorldObjectGenericController<MusicalForm>(repository) |
14 | 13 | { |
15 | 14 | } |
16 | 15 |
|
17 | | -public class PoeticFormController(IWorld worldDataService) : WorldObjectGenericController<PoeticForm>(worldDataService.PoeticForms, worldDataService.GetPoeticForm) |
| 16 | +public class PoeticFormController(IWorldObjectRepository<PoeticForm> repository) : WorldObjectGenericController<PoeticForm>(repository) |
18 | 17 | { |
19 | 18 | } |
20 | 19 |
|
21 | | -public class WrittenContentController(IWorld worldDataService) : WorldObjectGenericController<WrittenContent>(worldDataService.WrittenContents, worldDataService.GetWrittenContent) |
| 20 | +public class WrittenContentController(IWorldObjectRepository<WrittenContent> repository) : WorldObjectGenericController<WrittenContent>(repository) |
22 | 21 | { |
23 | 22 | } |
24 | 23 |
|
25 | | -public class LandmassController(IWorld worldDataService) : WorldObjectGenericController<Landmass>(worldDataService.Landmasses, worldDataService.GetLandmass) |
| 24 | +public class LandmassController(IWorldObjectRepository<Landmass> repository) : WorldObjectGenericController<Landmass>(repository) |
26 | 25 | { |
27 | 26 | } |
28 | 27 |
|
29 | | -public class RiverController(IWorld worldDataService) : WorldObjectGenericController<River>(worldDataService.Rivers, worldDataService.GetRiver) |
| 28 | +public class RiverController(IWorldObjectRepository<River> repository) : WorldObjectGenericController<River>(repository) |
30 | 29 | { |
31 | 30 | } |
32 | 31 |
|
33 | | -public class SiteController(IWorld worldDataService) : WorldObjectGenericController<Site>(worldDataService.Sites, worldDataService.GetSite) |
| 32 | +public class SiteController(IWorldObjectRepository<Site> repository) : WorldObjectGenericController<Site>(repository) |
34 | 33 | { |
35 | 34 | } |
36 | 35 |
|
37 | | -public class RegionController(IWorld worldDataService) : WorldObjectGenericController<WorldRegion>(worldDataService.Regions, worldDataService.GetRegion) |
| 36 | +public class RegionController(IWorldObjectRepository<WorldRegion> repository) : WorldObjectGenericController<WorldRegion>(repository) |
38 | 37 | { |
39 | 38 | } |
40 | 39 |
|
41 | | -public class UndergroundRegionController(IWorld worldDataService) : WorldObjectGenericController<UndergroundRegion>(worldDataService.UndergroundRegions, worldDataService.GetUndergroundRegion) |
| 40 | +public class UndergroundRegionController(IWorldObjectRepository<UndergroundRegion> repository) : WorldObjectGenericController<UndergroundRegion>(repository) |
42 | 41 | { |
43 | 42 | } |
44 | 43 |
|
45 | | -public class ArtifactController(IWorld worldDataService) : WorldObjectGenericController<Artifact>(worldDataService.Artifacts, worldDataService.GetArtifact) |
| 44 | +public class ArtifactController(IWorldObjectRepository<Artifact> repository) : WorldObjectGenericController<Artifact>(repository) |
46 | 45 | { |
47 | 46 | } |
48 | 47 |
|
49 | | -public class EntityController(IWorld worldDataService) : WorldObjectGenericController<Entity>(worldDataService.Entities, worldDataService.GetEntity) |
| 48 | +public class EntityController(IWorldObjectRepository<Entity> repository) : WorldObjectGenericController<Entity>(repository) |
50 | 49 | { |
51 | 50 | [HttpGet("civs")] |
52 | 51 | [ProducesResponseType(StatusCodes.Status200OK)] |
53 | 52 | public ActionResult<List<Entity>> GetMainCivilizations() |
54 | 53 | { |
55 | | - return Ok(AllElements.Where(x => x.IsCiv || (x.EntityType == Legends.Enums.EntityType.Civilization && x.SiteHistory.Count > 0))); |
| 54 | + return Ok(Repository.GetAllElements().Where(x => x.IsCiv || (x.EntityType == Legends.Enums.EntityType.Civilization && x.SiteHistory.Count > 0))); |
56 | 55 | } |
57 | 56 | } |
58 | 57 |
|
59 | | -public class HistoricalFigureController(IWorld worldDataService) : WorldObjectGenericController<HistoricalFigure>(worldDataService.HistoricalFigures, worldDataService.GetHistoricalFigure) |
| 58 | +public class HistoricalFigureController(IWorldObjectRepository<HistoricalFigure> repository) : WorldObjectGenericController<HistoricalFigure>(repository) |
60 | 59 | { |
61 | 60 | } |
62 | 61 |
|
63 | | -public class MountainPeakController(IWorld worldDataService) : WorldObjectGenericController<MountainPeak>(worldDataService.MountainPeaks, worldDataService.GetMountainPeak) |
| 62 | +public class MountainPeakController(IWorldObjectRepository<MountainPeak> repository) : WorldObjectGenericController<MountainPeak>(repository) |
64 | 63 | { |
65 | 64 | } |
66 | 65 |
|
67 | | -public class StructureController(IWorld worldDataService) : WorldObjectGenericController<Structure>(worldDataService.Structures, worldDataService.GetStructure) |
| 66 | +public class StructureController(IWorldObjectRepository<Structure> repository) : WorldObjectGenericController<Structure>(repository) |
68 | 67 | { |
69 | 68 | } |
70 | 69 |
|
71 | | -public class ConstructionController(IWorld worldDataService) : WorldObjectGenericController<WorldConstruction>(worldDataService.WorldConstructions, worldDataService.GetWorldConstruction) |
| 70 | +public class ConstructionController(IWorldObjectRepository<WorldConstruction> repository) : WorldObjectGenericController<WorldConstruction>(repository) |
72 | 71 | { |
73 | 72 | } |
74 | 73 |
|
75 | | -public class EraController(IWorld worldDataService) : WorldObjectGenericController<Era>(worldDataService.Eras, worldDataService.GetEra) |
| 74 | +public class EraController(IWorldObjectRepository<Era> repository) : WorldObjectGenericController<Era>(repository) |
76 | 75 | { |
77 | 76 | } |
78 | 77 |
|
79 | 78 | // Warfare |
80 | 79 |
|
81 | | -public class WarController(IWorld worldDataService) : WorldObjectGenericController<War>(worldDataService.Wars, worldDataService.GetEventCollection<War>) |
| 80 | +public class WarController(IWorldObjectRepository<War> repository) : WorldObjectGenericController<War>(repository) |
82 | 81 | { |
83 | 82 | } |
84 | 83 |
|
85 | | -public class BattleController(IWorld worldDataService) : WorldObjectGenericController<Battle>(worldDataService.Battles, worldDataService.GetEventCollection<Battle>) |
| 84 | +public class BattleController(IWorldObjectRepository<Battle> repository) : WorldObjectGenericController<Battle>(repository) |
86 | 85 | { |
87 | 86 | } |
88 | 87 |
|
89 | | -public class DuelController(IWorld worldDataService) : WorldObjectGenericController<Duel>(worldDataService.Duels, worldDataService.GetEventCollection<Duel>) |
| 88 | +public class DuelController(IWorldObjectRepository<Duel> repository) : WorldObjectGenericController<Duel>(repository) |
90 | 89 | { |
91 | 90 | } |
92 | 91 |
|
93 | | -public class RaidController(IWorld worldDataService) : WorldObjectGenericController<Raid>(worldDataService.Raids, worldDataService.GetEventCollection<Raid>) |
| 92 | +public class RaidController(IWorldObjectRepository<Raid> repository) : WorldObjectGenericController<Raid>(repository) |
94 | 93 | { |
95 | 94 | } |
96 | 95 |
|
97 | | -public class SiteConqueredController(IWorld worldDataService) : WorldObjectGenericController<SiteConquered>(worldDataService.SiteConquerings, worldDataService.GetEventCollection<SiteConquered>) |
| 96 | +public class SiteConqueredController(IWorldObjectRepository<SiteConquered> repository) : WorldObjectGenericController<SiteConquered>(repository) |
98 | 97 | { |
99 | 98 | } |
100 | 99 |
|
101 | 100 | // Politcal Conflicts |
102 | 101 |
|
103 | | -public class InsurrectionController(IWorld worldDataService) : WorldObjectGenericController<Insurrection>(worldDataService.Insurrections, worldDataService.GetEventCollection<Insurrection>) |
| 102 | +public class InsurrectionController(IWorldObjectRepository<Insurrection> repository) : WorldObjectGenericController<Insurrection>(repository) |
104 | 103 | { |
105 | 104 | } |
106 | 105 |
|
107 | | -public class PersecutionController(IWorld worldDataService) : WorldObjectGenericController<Persecution>(worldDataService.Persecutions, worldDataService.GetEventCollection<Persecution>) |
| 106 | +public class PersecutionController(IWorldObjectRepository<Persecution> repository) : WorldObjectGenericController<Persecution>(repository) |
108 | 107 | { |
109 | 108 | } |
110 | 109 |
|
111 | | -public class PurgeController(IWorld worldDataService) : WorldObjectGenericController<Purge>(worldDataService.Purges, worldDataService.GetEventCollection<Purge>) |
| 110 | +public class PurgeController(IWorldObjectRepository<Purge> repository) : WorldObjectGenericController<Purge>(repository) |
112 | 111 | { |
113 | 112 | } |
114 | 113 |
|
115 | | -public class CoupController(IWorld worldDataService) : WorldObjectGenericController<EntityOverthrownCollection>(worldDataService.Coups, worldDataService.GetEventCollection<EntityOverthrownCollection>) |
| 114 | +public class CoupController(IWorldObjectRepository<EntityOverthrownCollection> repository) : WorldObjectGenericController<EntityOverthrownCollection>(repository) |
116 | 115 | { |
117 | 116 | } |
118 | 117 |
|
119 | | -public class BeastAttackController(IWorld worldDataService) : WorldObjectGenericController<BeastAttack>(worldDataService.BeastAttacks, worldDataService.GetEventCollection<BeastAttack>) |
| 118 | +public class BeastAttackController(IWorldObjectRepository<BeastAttack> repository) : WorldObjectGenericController<BeastAttack>(repository) |
120 | 119 | { |
121 | 120 | } |
122 | 121 |
|
123 | | -public class AbductionController(IWorld worldDataService) : WorldObjectGenericController<Abduction>(worldDataService.Abductions, worldDataService.GetEventCollection<Abduction>) |
| 122 | +public class AbductionController(IWorldObjectRepository<Abduction> repository) : WorldObjectGenericController<Abduction>(repository) |
124 | 123 | { |
125 | 124 | } |
126 | 125 |
|
127 | | -public class TheftController(IWorld worldDataService) : WorldObjectGenericController<Theft>(worldDataService.Thefts, worldDataService.GetEventCollection<Theft>) |
| 126 | +public class TheftController(IWorldObjectRepository<Theft> repository) : WorldObjectGenericController<Theft>(repository) |
128 | 127 | { |
129 | 128 | } |
130 | 129 |
|
131 | 130 | // Rituals |
132 | 131 |
|
133 | | -public class ProcessionController(IWorld worldDataService) : WorldObjectGenericController<ProcessionCollection>(worldDataService.Processions, worldDataService.GetEventCollection<ProcessionCollection>) |
| 132 | +public class ProcessionController(IWorldObjectRepository<ProcessionCollection> repository) : WorldObjectGenericController<ProcessionCollection>(repository) |
134 | 133 | { |
135 | 134 | } |
136 | 135 |
|
137 | | -public class PerformanceController(IWorld worldDataService) : WorldObjectGenericController<PerformanceCollection>(worldDataService.Performances, worldDataService.GetEventCollection<PerformanceCollection>) |
| 136 | +public class PerformanceController(IWorldObjectRepository<PerformanceCollection> repository) : WorldObjectGenericController<PerformanceCollection>(repository) |
138 | 137 | { |
139 | 138 | } |
140 | 139 |
|
141 | | -public class JourneyController(IWorld worldDataService) : WorldObjectGenericController<Journey>(worldDataService.Journeys, worldDataService.GetEventCollection<Journey>) |
| 140 | +public class JourneyController(IWorldObjectRepository<Journey> repository) : WorldObjectGenericController<Journey>(repository) |
142 | 141 | { |
143 | 142 | } |
144 | 143 |
|
145 | | -public class CompetitionController(IWorld worldDataService) : WorldObjectGenericController<CompetitionCollection>(worldDataService.Competitions, worldDataService.GetEventCollection<CompetitionCollection>) |
| 144 | +public class CompetitionController(IWorldObjectRepository<CompetitionCollection> repository) : WorldObjectGenericController<CompetitionCollection>(repository) |
146 | 145 | { |
147 | 146 | } |
148 | 147 |
|
149 | | -public class CeremonyController(IWorld worldDataService) : WorldObjectGenericController<CeremonyCollection>(worldDataService.Ceremonies, worldDataService.GetEventCollection<CeremonyCollection>) |
| 148 | +public class CeremonyController(IWorldObjectRepository<CeremonyCollection> repository) : WorldObjectGenericController<CeremonyCollection>(repository) |
150 | 149 | { |
151 | 150 | } |
152 | 151 |
|
153 | | -public class OccasionController(IWorld worldDataService) : WorldObjectGenericController<Occasion>(worldDataService.Occasions, worldDataService.GetEventCollection<Occasion>) |
| 152 | +public class OccasionController(IWorldObjectRepository<Occasion> repository) : WorldObjectGenericController<Occasion>(repository) |
154 | 153 | { |
155 | 154 | } |
0 commit comments