Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace Unity.GrantManager.ApplicantProfile;

public class CreateUpdateReportsHistoryDto
{
public Guid? ApplicantId { get; set; }
public string? FiscalYear { get; set; }
public DateTime? ReportDate { get; set; }
public bool? Outstanding { get; set; }
public bool? IncompleteReport { get; set; }
public string? Note { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ public interface IApplicantHistoryAppService : IApplicationService
Task<AuditHistoryDto> UpdateAuditHistoryAsync(Guid id, CreateUpdateAuditHistoryDto input);
Task DeleteAuditHistoryAsync(Guid id);

Task<List<ReportsHistoryDto>> GetReportsHistoryListAsync(Guid applicantId);
Task<ReportsHistoryDto> GetReportsHistoryAsync(Guid id);
Task<ReportsHistoryDto> CreateReportsHistoryAsync(CreateUpdateReportsHistoryDto input);
Task<ReportsHistoryDto> UpdateReportsHistoryAsync(Guid id, CreateUpdateReportsHistoryDto input);
Task DeleteReportsHistoryAsync(Guid id);

Task SaveNotesAsync(Guid applicantId, SaveApplicantHistoryNotesDto input);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using Volo.Abp.Application.Dtos;

namespace Unity.GrantManager.ApplicantProfile;

public class ReportsHistoryDto : AuditedEntityDto<Guid>
{
public Guid? ApplicantId { get; set; }
public string? FiscalYear { get; set; }
public DateTime? ReportDate { get; set; }
public bool? Outstanding { get; set; }
public bool? IncompleteReport { get; set; }
public string? Note { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ public class SaveApplicantHistoryNotesDto
public string? FundingHistoryComments { get; set; }
public string? IssueTrackingComments { get; set; }
public string? AuditComments { get; set; }
public string? ReportsComments { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ApplicantHistoryAppService(
IFundingHistoryRepository fundingHistoryRepository,
IIssueTrackingRepository issueTrackingRepository,
IAuditHistoryRepository auditHistoryRepository,
IReportsHistoryRepository reportsHistoryRepository,
IApplicantRepository applicantRepository) : GrantManagerAppService, IApplicantHistoryAppService
{
public async Task<List<FundingHistoryDto>> GetFundingHistoryListAsync(Guid applicantId)
Expand Down Expand Up @@ -107,12 +108,45 @@ public async Task DeleteAuditHistoryAsync(Guid id)
await auditHistoryRepository.DeleteAsync(id, autoSave: true);
}

public async Task<List<ReportsHistoryDto>> GetReportsHistoryListAsync(Guid applicantId)
{
var items = await reportsHistoryRepository.GetByApplicantIdAsync(applicantId);
return ObjectMapper.Map<List<ReportsHistory>, List<ReportsHistoryDto>>(items);
}

public async Task<ReportsHistoryDto> GetReportsHistoryAsync(Guid id)
{
var entity = await reportsHistoryRepository.GetAsync(id);
return ObjectMapper.Map<ReportsHistory, ReportsHistoryDto>(entity);
}

public async Task<ReportsHistoryDto> CreateReportsHistoryAsync(CreateUpdateReportsHistoryDto input)
{
var entity = ObjectMapper.Map<CreateUpdateReportsHistoryDto, ReportsHistory>(input);
await reportsHistoryRepository.InsertAsync(entity, autoSave: true);
return ObjectMapper.Map<ReportsHistory, ReportsHistoryDto>(entity);
}

public async Task<ReportsHistoryDto> UpdateReportsHistoryAsync(Guid id, CreateUpdateReportsHistoryDto input)
{
var entity = await reportsHistoryRepository.GetAsync(id);
ObjectMapper.Map(input, entity);
await reportsHistoryRepository.UpdateAsync(entity, autoSave: true);
return ObjectMapper.Map<ReportsHistory, ReportsHistoryDto>(entity);
}

public async Task DeleteReportsHistoryAsync(Guid id)
{
await reportsHistoryRepository.DeleteAsync(id, autoSave: true);
}

public async Task SaveNotesAsync(Guid applicantId, SaveApplicantHistoryNotesDto input)
{
var applicant = await applicantRepository.GetAsync(applicantId);
applicant.FundingHistoryComments = input.FundingHistoryComments;
applicant.IssueTrackingComments = input.IssueTrackingComments;
applicant.AuditComments = input.AuditComments;
applicant.ReportsComments = input.ReportsComments;
await applicantRepository.UpdateAsync(applicant, autoSave: true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ public GrantManagerApplicationAutoMapperProfile()
CreateMap<Tag, TagDto>();
CreateMap<TagSummaryCount, TagSummaryCountDto>();
CreateMap<TagUsageSummary, TagUsageSummaryDto>();
CreateMap<ApplicationTags, ApplicationTagsDto>();
CreateMap<ApplicationTags, ApplicationTagsDto>()
.ForMember(dest => dest.Tag, opt => opt.MapFrom(src => src.Tag));
CreateMap<AIGenerationRequest, AIGenerationRequestDto>();

//-- APPLICANT HISTORY
CreateMap<ApplicationTags, ApplicationTagsDto>();
CreateMap<ApplicationTags, ApplicationTagsDto>()
.ForMember(dest => dest.Tag, opt => opt.MapFrom(src => src.Tag));
CreateMap<AIGenerationRequest, AIGenerationRequestDto>();
//-- APPLICANT HISTORY
CreateMap<FundingHistory, FundingHistoryDto>();
CreateMap<CreateUpdateFundingHistoryDto, FundingHistory>();
CreateMap<FundingHistoryDto, FundingHistory>();
Expand All @@ -113,6 +113,10 @@ public GrantManagerApplicationAutoMapperProfile()
CreateMap<CreateUpdateAuditHistoryDto, AuditHistory>();
CreateMap<AuditHistoryDto, AuditHistory>();

CreateMap<ReportsHistory, ReportsHistoryDto>();
CreateMap<CreateUpdateReportsHistoryDto, ReportsHistory>();
CreateMap<ReportsHistoryDto, ReportsHistory>();

//-- PROJECT INFO
CreateMap<UpdateProjectInfoDto, Application>()
.IgnoreNullAndDefaultValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ public class Applicant : AuditedAggregateRoot<Guid>, IMultiTenant
public string? FundingHistoryComments { get; set; }
public string? IssueTrackingComments { get; set; }
public string? AuditComments { get; set; }
public string? ReportsComments { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;

namespace Unity.GrantManager.Applications;

public interface IReportsHistoryRepository : IRepository<ReportsHistory, Guid>
{
Task<List<ReportsHistory>> GetByApplicantIdAsync(Guid applicantId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Unity.GrantManager.Applications;

public class ReportsHistory : AuditedAggregateRoot<Guid>, IMultiTenant
{
public Guid? ApplicantId { get; set; }
public string? FiscalYear { get; set; }
public DateTime? ReportDate { get; set; }
public bool? Outstanding { get; set; }
public bool? IncompleteReport { get; set; }
public string? Note { get; set; }
public Guid? TenantId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class GrantTenantDbContext : AbpDbContext<GrantTenantDbContext>
public DbSet<FundingHistory> FundingHistories { get; set; }
public DbSet<IssueTracking> IssueTrackings { get; set; }
public DbSet<AuditHistory> AuditHistories { get; set; }
public DbSet<ReportsHistory> ReportsHistories { get; set; }
#endregion

public GrantTenantDbContext(DbContextOptions<GrantTenantDbContext> options) : base(options)
Expand Down Expand Up @@ -391,6 +392,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
b.HasOne<Applicant>().WithMany().HasForeignKey(x => x.ApplicantId).IsRequired(false);
});

modelBuilder.Entity<ReportsHistory>(b =>
{
b.ToTable(GrantManagerConsts.TenantTablePrefix + "ReportsHistories", GrantManagerConsts.DbSchema);
b.ConfigureByConvention();
b.HasOne<Applicant>().WithMany().HasForeignKey(x => x.ApplicantId).IsRequired(false);
});

var allEntityTypes = modelBuilder.Model.GetEntityTypes();
foreach (var type in allEntityTypes.Where(t => t.ClrType != typeof(ExtraPropertyDictionary)).Select(t => t.ClrType))
{
Expand Down
Loading
Loading