-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
984 additions
and
215 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
Nezam.EES.Shared/Domain/Identity/Departments/DepartmentCreatedEvent.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 Nezam.EEs.Shared.Domain.Identity.User.ValueObjects; | ||
using Payeh.SharedKernel.Domain.DomainEvents; | ||
|
||
namespace Nezam.EEs.Shared.Domain.Identity.User.DomainEvents | ||
{ | ||
public class DepartmentCreatedEvent : DomainEvent | ||
{ | ||
public DepartmentId DepartmentId { get; } | ||
public string Title { get; } | ||
|
||
public DepartmentCreatedEvent(DepartmentId userId, string title) | ||
{ | ||
DepartmentId = userId; | ||
Title = title; | ||
} | ||
} | ||
} |
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,8 @@ | ||
using Payeh.SharedKernel.Domain.ValueObjects; | ||
|
||
namespace Nezam.EEs.Shared.Domain.Identity.User; | ||
|
||
public class DepartmentId : GuidBusinessId<DepartmentId> | ||
{ | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
Nezam.EES.Shared/Domain/Identity/User/DomainEvents/UserDepartmentUpdatedEvent.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,16 @@ | ||
using Nezam.EEs.Shared.Domain.Identity.User.ValueObjects; | ||
using Payeh.SharedKernel.Domain.DomainEvents; | ||
|
||
namespace Nezam.EEs.Shared.Domain.Identity.User.DomainEvents; | ||
|
||
public class UserDepartmentUpdatedEvent : DomainEvent | ||
{ | ||
public UserId UserId { get; } | ||
public DepartmentId[] Departments { get; } | ||
|
||
public UserDepartmentUpdatedEvent(UserId userId, DepartmentId[] departments) | ||
{ | ||
UserId = userId; | ||
Departments = departments; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Nezam.EES.Shared/Domain/Identity/User/DomainEvents/UserRoleUpdatedEvent.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,16 @@ | ||
using Nezam.EEs.Shared.Domain.Identity.User.ValueObjects; | ||
using Payeh.SharedKernel.Domain.DomainEvents; | ||
|
||
namespace Nezam.EEs.Shared.Domain.Identity.User.DomainEvents; | ||
|
||
public class UserRoleUpdatedEvent : DomainEvent | ||
{ | ||
public UserId UserId { get; } | ||
public string[] Roles { get; } | ||
|
||
public UserRoleUpdatedEvent(UserId userId, string[] roles) | ||
{ | ||
UserId = userId; | ||
Roles = roles; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
Nezam.EES.Slice.Identity/Application/UseCases/Users/GetUsers/GetUsersRequest.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,8 +1,23 @@ | ||
using Nezam.EES.Service.Identity.Application.Dto; | ||
using Nezam.EEs.Shared.Application.Dto; | ||
using System.Collections.Generic; | ||
|
||
namespace Nezam.EES.Service.Identity.Application.UseCases.Users.GetUsers; | ||
|
||
/// <summary> | ||
/// Request class for fetching users with support for pagination, filtering, and sorting. | ||
/// </summary> | ||
public class GetUsersRequest : PaginatedRequest | ||
{ | ||
/// <summary> | ||
/// Filters to apply on the user data. Each filter is a string in the format "Property:Value". | ||
/// Example: "Profile.LastName:Smith,Email.Value:test". | ||
/// </summary> | ||
public string? Filters { get; set; } | ||
|
||
/// <summary> | ||
/// Sorting instructions in the format "Property:Direction". | ||
/// Example: "Email.Value:asc". | ||
/// </summary> | ||
public string? Sorting { get; set; } | ||
} |
51 changes: 51 additions & 0 deletions
51
Nezam.EES.Slice.Identity/Domains/Departments/DepartmentEntity.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,51 @@ | ||
using Nezam.EES.Service.Identity.Domains.Users; | ||
using Nezam.EEs.Shared.Domain.Identity.User; | ||
using Nezam.EEs.Shared.Domain.Identity.User.DomainEvents; | ||
using Payeh.SharedKernel.Domain; | ||
|
||
namespace Nezam.EES.Service.Identity.Domains.Departments | ||
{ | ||
public class DepartmentEntity : AggregateRoot | ||
{ | ||
// Protected constructor for EF Core | ||
protected DepartmentEntity() | ||
{ | ||
} | ||
|
||
public DepartmentEntity(DepartmentId departmentId, string title) : this() | ||
{ | ||
DepartmentId = departmentId; | ||
SetTitle(title); | ||
AddDomainEvent(new DepartmentCreatedEvent(departmentId,title)); | ||
|
||
} | ||
|
||
public DepartmentId DepartmentId { get; private set; } | ||
public string Title { get; private set; } | ||
|
||
public ICollection<UserEntity> Users { get; private set; } | ||
|
||
// Method to update title | ||
public void SetTitle(string title) | ||
{ | ||
if (string.IsNullOrWhiteSpace(title)) | ||
{ | ||
throw new ArgumentException("Title cannot be empty", nameof(title)); | ||
} | ||
|
||
if (title.Length > 50) | ||
{ | ||
throw new ArgumentException("Title cannot exceed 50 characters", nameof(title)); | ||
} | ||
|
||
Title = title; | ||
} | ||
|
||
// Override to provide unique key for this entity | ||
public override object GetKey() | ||
{ | ||
return DepartmentId; | ||
} | ||
|
||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Nezam.EES.Slice.Identity/Domains/Departments/Repositories/IDepartmentRepository.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,8 @@ | ||
using Payeh.SharedKernel.Domain.Repositories; | ||
|
||
namespace Nezam.EES.Service.Identity.Domains.Departments.Repositories; | ||
|
||
public interface IDepartmentRepository : IRepository<DepartmentEntity> | ||
{ | ||
|
||
} |
Oops, something went wrong.