Added the Tenant Profile API
This commit is contained in:
parent
6b4e229f6b
commit
c210e6e3f2
@ -1,5 +1,6 @@
|
||||
using Marco.Pms.Model.Master;
|
||||
using Marco.Pms.Model.TenantModels.MongoDBModel;
|
||||
using Marco.Pms.Model.TenantModels;
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels.Tenant
|
||||
{
|
||||
@ -8,14 +9,14 @@ namespace Marco.Pms.Model.ViewModels.Tenant
|
||||
public Guid Id { get; set; }
|
||||
public string? PlanName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public double PriceQuarterly { get; set; }
|
||||
public double PriceMonthly { get; set; }
|
||||
public double PriceHalfYearly { get; set; }
|
||||
public double PriceYearly { get; set; }
|
||||
public int TrialDays { get; set; }
|
||||
public double MaxUser { get; set; }
|
||||
public double MaxStorage { get; set; }
|
||||
public FeatureDetails? Features { get; set; }
|
||||
public double Price { get; set; }
|
||||
public PLAN_FREQUENCY Frequency { get; set; }
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public BasicEmployeeVM? CreatedBy { get; set; }
|
||||
public BasicEmployeeVM? updatedBy { get; set; }
|
||||
public CurrencyMaster? Currency { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -33,5 +33,6 @@ namespace Marco.Pms.Model.ViewModels.Tenant
|
||||
public DateTime? ExpiryDate { get; set; }
|
||||
public DateTime? NextBillingDate { get; set; }
|
||||
public BasicEmployeeVM? CreatedBy { get; set; }
|
||||
public List<SubscriptionPlanDetailsVM>? SubscriptionHistery { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -277,6 +277,9 @@ namespace Marco.Pms.Services.Controllers
|
||||
{
|
||||
await using var _dbContext = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await _dbContext.TenantSubscriptions
|
||||
.Include(sp => sp!.CreatedBy)
|
||||
.Include(sp => sp!.UpdatedBy)
|
||||
.Include(sp => sp!.Currency)
|
||||
.Include(ts => ts.Plan).ThenInclude(sp => sp!.Plan)
|
||||
.AsNoTracking()
|
||||
.Where(ts => ts.TenantId == tenant.Id && ts.Plan != null)
|
||||
@ -317,7 +320,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
response.ExpiryDate = expiryDate;
|
||||
response.NextBillingDate = nextBillingDate;
|
||||
response.CreatedBy = createdBy;
|
||||
|
||||
response.SubscriptionHistery = _mapper.Map<List<SubscriptionPlanDetailsVM>>(plans);
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(response, "Tenant profile fetched successfully", 200));
|
||||
}
|
||||
|
@ -43,6 +43,23 @@ namespace Marco.Pms.Services.MappingProfiles
|
||||
dest => dest.Description,
|
||||
opt => opt.MapFrom(src => src.Plan != null ? src.Plan.Description : "")
|
||||
);
|
||||
CreateMap<TenantSubscriptions, SubscriptionPlanDetailsVM>()
|
||||
.ForMember(
|
||||
dest => dest.PlanName,
|
||||
opt => opt.MapFrom(src => src.Plan!.Plan != null ? src.Plan.Plan.PlanName : "")
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.Description,
|
||||
opt => opt.MapFrom(src => src.Plan!.Plan != null ? src.Plan.Plan.Description : "")
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.Price,
|
||||
opt => opt.MapFrom(src => src.Plan != null ? src.Plan.Price : 0)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.Frequency,
|
||||
opt => opt.MapFrom(src => src.Plan != null ? src.Plan.Frequency : PLAN_FREQUENCY.MONTHLY)
|
||||
);
|
||||
CreateMap<SubscriptionPlanDetailsDto, SubscriptionPlanDetails>();
|
||||
CreateMap<SubscriptionPlanDto, SubscriptionPlan>();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user