AppServiceProvider.php 10.2 KB
Newer Older
1
2
3
4
5
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
6
use Source\Authorization\AuthorizerServiceProvider;
7
use Source\Gateways\Saml\SamlRepositoryServiceProvider;
8
use Source\Gateways\Doors\DoorsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
9
use Source\Gateways\Users\UsersRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
10
use Source\UseCases\Door\Commands\CommandServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
11
use Source\Gateways\Groups\GroupsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
12
use Source\Gateways\Tokens\TokensRepositoryServiceProvider;
13
use Source\Gateways\Entries\EntriesRepositoryServiceProvider;
14
use Source\UseCases\Door\Access\AccessUseCaseServiceProvider;
15
use Source\Gateways\Attempts\AttemptsRepositoryServiceProvider;
16
use Source\Gateways\DoorUser\DoorUserRepositoryServiceProvider;
17
use Source\UseCases\Doors\GetDoor\GetDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
18
use Source\UseCases\Users\GetUser\GetUserUseCaseServiceProvider;
19
use Source\Gateways\DoorGroup\DoorGroupRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
20
use Source\Gateways\GroupUser\GroupUserRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
21
use Source\Gateways\Overrides\OverridesRepositoryServiceProvider;
22
use Source\Gateways\Schedules\SchedulesRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
23
use Source\UseCases\Groups\GetGroup\GetGroupUseCaseServiceProvider;
24
use Source\UseCases\Tokens\GetToken\GetTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
25
26
27
use Source\UseCases\Doors\CreateDoor\CreateDoorUseCaseServiceProvider;
use Source\UseCases\Doors\DeleteDoor\DeleteDoorUseCaseServiceProvider;
use Source\UseCases\Doors\UpdateDoor\UpdateDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
28
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
29
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
30
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
31
use Source\Gateways\DoorSchedule\DoorScheduleRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
32
use Source\UseCases\Doors\GetAllDoors\GetAllDoorsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
33
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
34
use Source\Gateways\RecurrenceSet\RecurrenceSetRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
35
use Source\UseCases\Groups\CreateGroup\CreateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
36
use Source\UseCases\Groups\DeleteGroup\DeleteGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
37
use Source\UseCases\Groups\UpdateGroup\UpdateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
38
39
use Source\UseCases\Tokens\CreateToken\CreateTokenUseCaseServiceProvider;
use Source\UseCases\Tokens\ExpireToken\ExpireTokenUseCaseServiceProvider;
40
use Source\UseCases\Tokens\UpdateToken\UpdateTokenUseCaseServiceProvider;
41
use Source\UseCases\Attempts\GetAttempts\GetAttemptsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
42
use Source\UseCases\Groups\GetAllGroups\GetAllGroupsUseCaseServiceProvider;
43
use Source\UseCases\Tokens\GetAllTokens\GetAllTokensUseCaseServiceProvider;
44
use Source\UseCases\Overrides\OverrideGet\OverrideGetUseCaseServiceProvider;
45
use Source\UseCases\Schedules\ScheduleGet\ScheduleGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
46
use Source\UseCases\Door\StatusResponse\StatusResponseUseCaseServiceProvider;
47
use Source\UseCases\Schedules\SchedulesGet\SchedulesGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
48
49
use Source\UseCases\DoorGroup\GetDoorGroups\GetDoorGroupsUseCaseServiceProvider;
use Source\UseCases\DoorGroup\GetGroupDoors\GetGroupDoorsUseCaseServiceProvider;
50
use Source\UseCases\GroupUser\GetGroupUsers\GetGroupUsersUseCaseServiceProvider;
51
use Source\UseCases\GroupUser\GetUserGroups\GetUserGroupsUseCaseServiceProvider;
52
use Source\UseCases\TokenUser\GetUserTokens\GetUserTokensUseCaseServiceProvider;
53
use Source\UseCases\DoorUser\UserDoorAccess\UserDoorAccessUseCaseServiceProvider;
54
use Source\UseCases\DoorGroup\AddDoorToGroup\AddDoorToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
55
use Source\UseCases\GroupUser\AddUserToGroup\AddUserToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
56
use Source\UseCases\Overrides\OverrideCreate\OverrideCreateUseCaseServiceProvider;
57
use Source\UseCases\Overrides\OverrideUpdate\OverrideUpdateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
58
use Source\UseCases\Schedules\ScheduleCreate\ScheduleCreateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
59
use Source\UseCases\Schedules\ScheduleUpdate\ScheduleUpdateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
60
use Source\UseCases\Doors\GenerateDoorToken\GenerateDoorTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
61
62
use Source\UseCases\Entries\GetEntriesForDoor\GetEntriesForDoorUseCaseServiceProvider;
use Source\UseCases\Entries\GetEntriesForUser\GetEntriesForUserUseCaseServiceProvider;
63
use Source\UseCases\Overrides\OverridesForDoor\OverridesForDoorUseCaseServiceProvider;
64
use Source\UseCases\Attempts\GetAttemptsForDoor\GetAttemptsForDoorUseCaseServiceProvider;
65
use Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCaseServiceProvider;
66
use Source\UseCases\GroupSchedule\SchedulesForGroup\SchedulesForGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
67
use Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCaseServiceProvider;
68
use Source\UseCases\Entries\GetEntriesForDateRange\GetEntriesForDateRangeUseCaseServiceProvider;
69
use Source\UseCases\Overrides\OverridesForDateRange\OverridesForDateRangeUseCaseServiceProvider;
70
use Source\UseCases\Attempts\GetAttemptCountForDoor\GetAttemptCountForDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
71
use Source\UseCases\Entries\GetEntriesForDoorAndUser\GetEntriesForDoorAndUserUseCaseServiceProvider;
72
use Source\UseCases\GroupSchedule\ActiveSchedulesForGroup\ActiveSchedulesForGroupUseCaseServiceProvider;
73
use Source\UseCases\Door\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
74
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
75
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider as TokenAuthenticateUseCaseServiceProvider;
76
77
78

class AppServiceProvider extends ServiceProvider
{
79
80
81
82
    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
83
        AuthorizerServiceProvider::class,
84
        SamlRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
85
        UsersRepositoryServiceProvider::class,
86
        DoorsRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
87
        TokensRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
88
        GroupsRepositoryServiceProvider::class,
89
90
        EntriesRepositoryServiceProvider::class,
        AttemptsRepositoryServiceProvider::class,
91
        DoorUserRepositoryServiceProvider::class,
92
        SchedulesRepositoryServiceProvider::class,
93
        DoorGroupRepositoryServiceProvider::class,
94
        GroupUserRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
95
        OverridesRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
96
        DoorScheduleRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
97
        RecurrenceSetRepositoryServiceProvider::class,
98
99
100
101
102
103
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
104
        // Users
Jacob Priddy's avatar
Jacob Priddy committed
105
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
106
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
107
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
108
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
109
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
110

111
112
113
        // DoorUser
        UserDoorAccessUseCaseServiceProvider::class,

Jacob Priddy's avatar
Jacob Priddy committed
114
        // Groups
Jacob Priddy's avatar
Jacob Priddy committed
115
        GetGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
116
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
117
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
118
        UpdateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
119
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
120

Jacob Priddy's avatar
Jacob Priddy committed
121
        // GroupUser
122
        GetUserGroupsUseCaseServiceProvider::class,
123
        GetGroupUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
124
125
126
        AddUserToGroupUseCaseServiceProvider::class,
        RemoveUserFromGroupUseCaseServiceProvider::class,

127
        // DoorGroup
128
        GetDoorGroupsUseCaseServiceProvider::class,
129
        GetGroupDoorsUseCaseServiceProvider::class,
130
        AddDoorToGroupUseCaseServiceProvider::class,
131
        RemoveDoorFromGroupUseCaseServiceProvider::class,
132

133
134
        // Door
        AccessUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
135
136
        StatusResponseUseCaseServiceProvider::class,
        DoorAuthenticateUseCaseServiceProvider::class,
137

Jacob Priddy's avatar
Jacob Priddy committed
138
        // Doors
139
        GetDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
140
        CreateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
141
        DeleteDoorUseCaseServiceProvider::class,
142
        UpdateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
143
        GetAllDoorsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
144
        UserAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
145
        GenerateDoorTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
146
147

        // Tokens
148
        GetTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
149
150
        CreateTokenUseCaseServiceProvider::class,
        ExpireTokenUseCaseServiceProvider::class,
151
152
        UpdateTokenUseCaseServiceProvider::class,
        GetAllTokensUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
153
        TokenAuthenticateUseCaseServiceProvider::class,
154
155
156

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
157
158
159
160
161

        // Attempts
        GetAttemptsUseCaseServiceProvider::class,
        GetAttemptsForDoorUseCaseServiceProvider::class,
        GetAttemptCountForDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
162
163
164
165

        // Entries
        GetEntriesForDoorUseCaseServiceProvider::class,
        GetEntriesForUserUseCaseServiceProvider::class,
166
        GetEntriesForDateRangeUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
167
        GetEntriesForDoorAndUserUseCaseServiceProvider::class,
168
169

        // Schedule
170
171
        ScheduleGetUseCaseServiceProvider::class,
        SchedulesGetUseCaseServiceProvider::class,
172
        ScheduleCreateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
173
        ScheduleUpdateUseCaseServiceProvider::class,
174
175
        SchedulesForGroupUseCaseServiceProvider::class,
        ActiveSchedulesForGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
176

177
        // Overrides
178
        OverrideGetUseCaseServiceProvider::class,
179
        OverrideCreateUseCaseServiceProvider::class,
180
        OverrideUpdateUseCaseServiceProvider::class,
181
182
        OverridesForDoorUseCaseServiceProvider::class,
        OverridesForDateRangeUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
183
184
185

        // Commands
        CommandServiceProvider::class,
186
187
    ];

188
189
190
191
192
193
194
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
195
        // We register gateways first, as use cases will generally use gateways
196
197
        // Not that it actually matters because they are all deferred anyway
        // and will all be registered before any need to be created.
198
199
200
201
202
203
204
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
205
206
207
208
209
210
211
212
213
214
215
216
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}