-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from BeniceSoft/dev/feat-v1.0.0
merge 2024/05/05
- Loading branch information
Showing
14 changed files
with
183 additions
and
59 deletions.
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
src/BeniceSoft.OpenAuthing.Application.Contracts/Dtos/UserGroups/InputUserGroupReq.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace BeniceSoft.OpenAuthing.Dtos.UserGroups; | ||
|
||
public class InputUserGroupReq | ||
{ | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
} |
15 changes: 15 additions & 0 deletions
15
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/CreateUserGroupCommand.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using MediatR; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class CreateUserGroupCommand : IRequest<Guid> | ||
{ | ||
public string Name { get; private set; } | ||
public string Description { get; private set; } | ||
|
||
public CreateUserGroupCommand(string name, string description) | ||
{ | ||
Name = name; | ||
Description = description; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/CreateUserGroupCommandHandler.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using BeniceSoft.OpenAuthing.Entities.UserGroups; | ||
using MediatR; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Domain.Repositories; | ||
using Volo.Abp.Guids; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class CreateUserGroupCommandHandler(IGuidGenerator guid, IRepository<UserGroup> repository) | ||
: IRequestHandler<CreateUserGroupCommand, Guid>, ITransientDependency | ||
{ | ||
public async Task<Guid> Handle(CreateUserGroupCommand request, CancellationToken cancellationToken) | ||
{ | ||
var userGroup = new UserGroup(guid.Create(), request.Name, request.Description); | ||
await repository.InsertAsync(userGroup, cancellationToken: cancellationToken); | ||
|
||
return userGroup.Id; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/DeleteUserGroupCommand.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using MediatR; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class DeleteUserGroupCommand : IRequest<bool> | ||
{ | ||
public Guid Id { get; private set; } | ||
|
||
public DeleteUserGroupCommand(Guid id) | ||
{ | ||
Id = id; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/DeleteUserGroupCommandHandler.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using BeniceSoft.OpenAuthing.Entities.UserGroups; | ||
using MediatR; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Domain.Repositories; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class DeleteUserGroupCommandHandler(IRepository<UserGroup, Guid> groupRepository) | ||
: IRequestHandler<DeleteUserGroupCommand, bool>, ITransientDependency | ||
{ | ||
public async Task<bool> Handle(DeleteUserGroupCommand request, CancellationToken cancellationToken) | ||
{ | ||
await groupRepository.DeleteAsync(request.Id, cancellationToken: cancellationToken); | ||
|
||
return true; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/UpdateUserGroupCommand.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using MediatR; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class UpdateUserGroupCommand : IRequest<bool> | ||
{ | ||
public Guid Id { get; private set; } | ||
public string Name { get; private set; } | ||
public string Description { get; private set; } | ||
|
||
public UpdateUserGroupCommand(Guid id, string name, string description) | ||
{ | ||
Id = id; | ||
Name = name; | ||
Description = description; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/BeniceSoft.OpenAuthing.Application/Commands/UserGroups/UpdateUserGroupCommandHandler.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using BeniceSoft.OpenAuthing.Entities.UserGroups; | ||
using MediatR; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Domain.Repositories; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.UserGroups; | ||
|
||
public class UpdateUserGroupCommandHandler(IRepository<UserGroup, Guid> groupRepository) | ||
: IRequestHandler<UpdateUserGroupCommand, bool>, ITransientDependency | ||
{ | ||
public async Task<bool> Handle(UpdateUserGroupCommand request, CancellationToken cancellationToken) | ||
{ | ||
var userGroup = await groupRepository.GetAsync(request.Id, includeDetails: false, cancellationToken: cancellationToken); | ||
userGroup.Update(request.Name, request.Description); | ||
|
||
await groupRepository.UpdateAsync(userGroup, cancellationToken: cancellationToken); | ||
|
||
return true; | ||
} | ||
} |
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