-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use DI container instead of service locator
- Loading branch information
Showing
14 changed files
with
166 additions
and
223 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
Applications/AdminCli/src/AdminCli/Commands/Announcements/AnnouncementCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
using Backbone.AdminCli.Commands.BaseClasses; | ||
using System.CommandLine; | ||
|
||
namespace Backbone.AdminCli.Commands.Announcements; | ||
|
||
public class AnnouncementCommand : AdminCliCommand | ||
public class AnnouncementCommand : Command | ||
{ | ||
public AnnouncementCommand(ServiceLocator serviceLocator) : base("announcement", serviceLocator) | ||
public AnnouncementCommand(SendAnnouncementCommand sendAnnouncementCommand) : base("announcement") | ||
{ | ||
AddCommand(new SendAnnouncementCommand(serviceLocator)); | ||
AddCommand(sendAnnouncementCommand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
Applications/AdminCli/src/AdminCli/Commands/BaseClasses/AdminCliCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
using System.CommandLine; | ||
using System.Text.Json; | ||
using MediatR; | ||
|
||
namespace Backbone.AdminCli.Commands.BaseClasses; | ||
|
||
public abstract class AdminCliCommand : Command | ||
{ | ||
protected readonly IMediator _mediator; | ||
|
||
protected static readonly JsonSerializerOptions JSON_SERIALIZER_OPTIONS = | ||
new() { WriteIndented = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; | ||
|
||
protected readonly ServiceLocator _serviceLocator; | ||
|
||
protected AdminCliCommand(string name, ServiceLocator serviceLocator, string? description = null) : base(name, description) | ||
protected AdminCliCommand(IMediator mediator, string name, string? description = null) : base(name, description) | ||
{ | ||
_serviceLocator = serviceLocator; | ||
_mediator = mediator; | ||
} | ||
} |
64 changes: 0 additions & 64 deletions
64
Applications/AdminCli/src/AdminCli/Commands/BaseClasses/AdminCliDbCommand.cs
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
Applications/AdminCli/src/AdminCli/Commands/Clients/ClientCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
using Backbone.AdminCli.Commands.BaseClasses; | ||
using System.CommandLine; | ||
|
||
namespace Backbone.AdminCli.Commands.Clients; | ||
|
||
public class ClientCommand : AdminCliCommand | ||
public class ClientCommand : Command | ||
{ | ||
public ClientCommand(ServiceLocator serviceLocator) : base("client", serviceLocator) | ||
public ClientCommand(CreateClientCommand createClientCommand, ListClientsCommand listClientsCommand, DeleteClientsCommand deleteClientsCommand) : base("client") | ||
{ | ||
AddCommand(new CreateClientCommand(serviceLocator)); | ||
AddCommand(new ListClientsCommand(serviceLocator)); | ||
AddCommand(new DeleteClientsCommand(serviceLocator)); | ||
AddCommand(createClientCommand); | ||
AddCommand(listClientsCommand); | ||
AddCommand(deleteClientsCommand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
Applications/AdminCli/src/AdminCli/Commands/Tiers/TierCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
using Backbone.AdminCli.Commands.BaseClasses; | ||
using System.CommandLine; | ||
|
||
namespace Backbone.AdminCli.Commands.Tiers; | ||
|
||
public class TierCommand : AdminCliCommand | ||
public class TierCommand : Command | ||
{ | ||
public TierCommand(ServiceLocator serviceLocator) : base("tier", serviceLocator) | ||
public TierCommand(ListTiersCommand listTiersCommand) : base("tier") | ||
{ | ||
AddCommand(new ListTiersCommand(serviceLocator)); | ||
AddCommand(listTiersCommand); | ||
} | ||
} |
Oops, something went wrong.