feat(user): enhance GetAllUserByFilter query response with additional fields and update Protobuf definitions
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m6s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m6s
- Added DefaultAddress and DefaultPostalCode properties to GetAllUserByFilterResponseDto for improved user data representation. - Updated GetAllUserByFilterQueryHandler to populate new response fields with relevant data. - Modified Protobuf definitions to include new fields in GetAllUserByFilterResponseModel. - Bumped Protobuf project version to reflect the addition of new features.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# CMS Microservice
|
||||
|
||||
Documentation moved to [totalDoc/INDEX.md](../totalDoc/INDEX.md).
|
||||
|
||||
|
||||
+30
-5
@@ -17,7 +17,7 @@ public class GetAllUserByFilterQueryHandler : IRequestHandler<GetAllUserByFilter
|
||||
if (request.Filter is not null)
|
||||
{
|
||||
query = query
|
||||
.Where(x => request.Filter.SearchText == null ||
|
||||
.Where(x => request.Filter.SearchText == null ||
|
||||
x.FirstName.Contains(request.Filter.SearchText) ||
|
||||
x.LastName.Contains(request.Filter.SearchText) ||
|
||||
x.Mobile.Contains(request.Filter.SearchText) ||
|
||||
@@ -34,14 +34,39 @@ public class GetAllUserByFilterQueryHandler : IRequestHandler<GetAllUserByFilter
|
||||
.Where(x => request.Filter.SmsNotifications == null || x.SmsNotifications == request.Filter.SmsNotifications)
|
||||
.Where(x => request.Filter.EmailNotifications == null || x.EmailNotifications == request.Filter.EmailNotifications)
|
||||
.Where(x => request.Filter.PushNotifications == null || x.PushNotifications == request.Filter.PushNotifications)
|
||||
.Where(x => request.Filter.BirthDate == null || x.BirthDate == request.Filter.BirthDate)
|
||||
;
|
||||
.Where(x => request.Filter.BirthDate == null || x.BirthDate == request.Filter.BirthDate);
|
||||
}
|
||||
|
||||
return new GetAllUserByFilterResponseDto
|
||||
{
|
||||
MetaData = await query.GetMetaData(request.PaginationState, cancellationToken),
|
||||
Models = await query.PaginatedListAsync(paginationState: request.PaginationState)
|
||||
.ProjectToType<GetAllUserByFilterResponseModel>().ToListAsync(cancellationToken)
|
||||
};
|
||||
.Select(x => new GetAllUserByFilterResponseModel
|
||||
{
|
||||
Id = x.Id,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Mobile = x.Mobile,
|
||||
NationalCode = x.NationalCode,
|
||||
AvatarPath = x.AvatarPath,
|
||||
NetworkParentId = x.NetworkParentId,
|
||||
ReferralCode = x.ReferralCode,
|
||||
IsMobileVerified = x.IsMobileVerified,
|
||||
MobileVerifiedAt = x.MobileVerifiedAt,
|
||||
EmailNotifications = x.EmailNotifications,
|
||||
SmsNotifications = x.SmsNotifications,
|
||||
PushNotifications = x.PushNotifications,
|
||||
BirthDate = x.BirthDate,
|
||||
DefaultAddress = x.UserAddresses
|
||||
.Where(a => a.IsDefault && !a.IsDeleted)
|
||||
.Select(a => a.Address)
|
||||
.FirstOrDefault() ?? string.Empty,
|
||||
DefaultPostalCode = x.UserAddresses
|
||||
.Where(a => a.IsDefault && !a.IsDeleted)
|
||||
.Select(a => a.PostalCode)
|
||||
.FirstOrDefault() ?? string.Empty
|
||||
})
|
||||
.ToListAsync(cancellationToken)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -36,4 +36,8 @@ public class GetAllUserByFilterResponseDto
|
||||
public bool PushNotifications { get; set; }
|
||||
//تاریخ تولد
|
||||
public DateTime? BirthDate { get; set; }
|
||||
//آدرس پیشفرض
|
||||
public string DefaultAddress { get; set; } = string.Empty;
|
||||
//کدپستی پیشفرض
|
||||
public string DefaultPostalCode { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.208</Version>
|
||||
<Version>0.0.209</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
|
||||
@@ -238,6 +238,8 @@ message GetAllUserByFilterResponseModel
|
||||
bool sms_notifications = 12;
|
||||
bool push_notifications = 13;
|
||||
google.protobuf.Timestamp birth_date = 14;
|
||||
string default_address = 15;
|
||||
string default_postal_code = 16;
|
||||
}
|
||||
message GetJwtTokenRequest
|
||||
{
|
||||
|
||||
@@ -4,7 +4,10 @@ public class UserProfile : IRegister
|
||||
{
|
||||
void IRegister.Register(TypeAdapterConfig config)
|
||||
{
|
||||
//config.NewConfig<Source,Destination>()
|
||||
// .Map(dest => dest.FullName, src => $"{src.Firstname} {src.Lastname}");
|
||||
config.NewConfig<Application.UserCQ.Queries.GetAllUserByFilter.GetAllUserByFilterResponseModel,
|
||||
CMSMicroservice.Protobuf.Protos.User.GetAllUserByFilterResponseModel>()
|
||||
.Map(dest => dest.ParentId, src => src.NetworkParentId)
|
||||
.Map(dest => dest.DefaultAddress, src => src.DefaultAddress ?? string.Empty)
|
||||
.Map(dest => dest.DefaultPostalCode, src => src.DefaultPostalCode ?? string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user