Files
hermes 32a80eb84d Implemented security functionality
Added data protection feature
Migrated changes
2026-08-20 15:15:54 +02:00

324 lines
9.9 KiB
C#

using PostFundManagement.Domain.Models;
namespace PostFundManagement.Domain.Extensions;
public static class Mappers
{
public static Activity Map(this Entities.Activity entity) => new()
{
Id = entity.Id,
Amount = entity.Amount,
ApprovedBy = entity.ApprovedBy,
Category = entity.Category,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
MilestoneId = entity.MilestoneId,
PerformedAt = entity.PerformedAt,
ProjectId = entity.ProjectId,
Status = entity.Status,
Title = entity.Title,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy
};
public static AuditLog Map(this Entities.AuditLog entity) => new()
{
Id = entity.Id,
Action = entity.Action,
Changes = entity.Changes,
EntityId = entity.EntityId,
EntityName = entity.EntityName,
PerformedBy = entity.PerformedBy,
Timestamp = entity.Timestamp
};
public static Award Map(this Entities.Award entity) => new()
{
Id = entity.Id,
Amount = entity.Amount,
ApprovedBy = entity.ApprovedBy,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
OrganisationId = entity.OrganisationId,
ProgrammeId = entity.ProgrammeId,
ProjectId = entity.ProjectId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy
};
public static Beneficiary Map(this Entities.Beneficiary entity) => new()
{
Id = entity.Id,
Category = entity.Category,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Location = entity.Location,
Name = entity.Name,
ProjectId = entity.ProjectId,
ReachedCount = entity.ReachedCount,
TargetCount = entity.TargetCount,
UserId = entity.UserId
};
public static Budget Map(this Entities.Budget entity) => new()
{
Id = entity.Id,
Amount = entity.Amount,
ApprovedBy = entity.ApprovedBy,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Name = entity.Name,
ProjectId = entity.ProjectId,
UpdatedAt = entity.UpdatedAt
};
public static ComplianceItem Map(this Entities.ComplianceItem entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
ProjectId = entity.ProjectId,
Requirements = entity.Requirements,
Status = entity.Status,
Title = entity.Title,
UpdatedAt = entity.UpdatedAt,
VerifiedBy = entity.VerifiedBy
};
public static Contract Map(this Entities.Contract entity) => new()
{
Id = entity.Id,
AwardId = entity.AwardId,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
EffectiveAt = entity.EffectiveAt,
ExpiresAt = entity.ExpiresAt,
ExternalSignatureId = entity.ExternalSignatureId,
SignedDocumentUrl = entity.SignedDocumentUrl,
Status = entity.Status,
TotalValue = entity.TotalValue
};
public static Disbursement Map(this Entities.Disbursement entity) => new()
{
Id = entity.Id,
Amount = entity.Amount,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
MilestoneId = entity.MilestoneId,
ProjectId = entity.ProjectId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy
};
public static Evidence Map(this Entities.Evidence entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
DocumentUrl = entity.DocumentUrl,
IndicatorId = entity.IndicatorId,
MilestoneId = entity.MilestoneId,
ProjectId = entity.ProjectId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy,
Version = entity.Version,
ActivityId = entity.ActivityId,
Type = entity.Type
};
public static Indicator Map(this Entities.Indicator entity) => new()
{
Id = entity.Id,
ActualAmount = entity.ActualAmount,
BaselineAmount = entity.BaselineAmount,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Name = entity.Name,
ProjectId = entity.ProjectId,
TargetAmount = entity.TargetAmount,
UnitOfMeasure = entity.UnitOfMeasure
};
public static Instrument Map(this Entities.Instrument entity) => new()
{
Id = entity.Id,
Code = entity.Code,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
Name = entity.Name,
Status = entity.Status,
ProgrammeId = entity.ProgrammeId
};
public static Invite Map(this Entities.Invite entity) => new()
{
Id = entity.Id,
AwardId = entity.AwardId,
ContractId = entity.ContractId,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
InvitedOrganisationId = entity.InvitedOrganisationId,
OrganisationId = entity.OrganisationId,
Recipient = entity.Recipient,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy
};
public static Issue Map(this Entities.Issue entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
Priority = entity.Priority,
ProjectId = entity.ProjectId,
ResolvedAt = entity.ResolvedAt,
Status = entity.Status,
Title = entity.Title,
AssignedTo = entity.AssignedTo,
Resolution = entity.Resolution
};
public static Milestone Map(this Entities.Milestone entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
DueAt = entity.DueAt,
Name = entity.Name,
ProjectId = entity.ProjectId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy,
Priority = entity.Priority
};
public static Organisation Map(this Entities.Organisation entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Email = entity.Email,
Name = entity.Name,
RegistrationNo = entity.RegistrationNo,
Status = entity.Status,
Type = entity.Type
};
public static Outcome Map(this Entities.Outcome entity) => new()
{
Id = entity.Id,
BeneficiaryId = entity.BeneficiaryId,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
Name = entity.Name
};
public static Portfolio Map(this Entities.Portfolio entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
Name = entity.Name,
OwnedBy = entity.OwnedBy
};
public static Notification Map(this Entities.Notification entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
Destination = entity.Destination,
Error = entity.Error,
Message = entity.Message,
OrganisationId = entity.OrganisationId,
Platform = entity.Platform,
Recipient = entity.Recipient,
SentAt = entity.SentAt,
Status = entity.Status,
Subject = entity.Subject,
UpdatedAt = entity.UpdatedAt
};
public static Programme Map(this Entities.Programme entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Name = entity.Name,
OwnedBy = entity.OwnedBy,
PortfolioId = entity.PortfolioId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy
};
public static Project Map(this Entities.Project entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
EndedAt = entity.EndedAt,
Name = entity.Name,
ProgrammeId = entity.ProgrammeId,
StartedAt = entity.StartedAt,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy,
ProjectType = entity.ProjectType,
Sector = entity.Sector
};
public static Risk Map(this Entities.Risk entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Description = entity.Description,
Impact = entity.Impact,
Likelihood = entity.Likelihood,
Name = entity.Name,
ProjectId = entity.ProjectId
};
public static Rule Map(this Entities.Rule entity) => new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Name = entity.Name,
ProgrammeId = entity.ProgrammeId,
Status = entity.Status,
UpdatedAt = entity.UpdatedAt,
UpdatedBy = entity.UpdatedBy,
Version = entity.Version
};
public static SiteVisit Map(this Entities.SiteVisit entity) => new()
{
Id = entity.Id,
ProjectId = entity.ProjectId,
CreatedAt = entity.CreatedAt,
CreatedBy = entity.CreatedBy,
Findings = entity.Findings,
InspectorName = entity.InspectorName,
Status = entity.Status,
VisitedAt = entity.VisitedAt
};
public static User Map(this Entities.User entity) => new()
{
Id = entity.Id,
Email = entity.Email,
LastLoginAt = entity.LastLoginAt,
Status = entity.Status
};
}