From 06ec2738e03939d5c45e72dfbba70b4954b942dc Mon Sep 17 00:00:00 2001 From: adrianwium <82496337+adrianwium@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:34:02 +0200 Subject: [PATCH] My Opportunity Verification Improvements (#1209) --- .../Lookups/Helpers/TimeIntervalHelper.cs | 17 + .../Extensions/MyOpportunityExtensions.cs | 5 + .../MyOpportunity/Models/MyOpportunity.cs | 12 + .../MyOpportunity/Models/MyOpportunityInfo.cs | 15 + .../Models/MyOpportunityRequestVerify.cs | 8 + ...ortunityRequestVerifyCommitmentInterval.cs | 15 + .../Services/MyOpportunityService.cs | 77 +- .../MyOpportunityRequestValidatorVerify.cs | 63 +- .../Services/OpportunityService.cs | 2 +- .../OpportunityRequestValidatorBase.cs | 2 +- ...nDb_MyOpportunity_Verification.Designer.cs | 2820 +++++++++++++++++ ...pplicationDb_MyOpportunity_Verification.cs | 125 + .../ApplicationDbContextModelSnapshot.cs | 27 +- .../MyOpportunity/Entities/MyOpportunity.cs | 18 +- .../Repositories/MyOpportunityRepository.cs | 26 + 15 files changed, 3206 insertions(+), 26 deletions(-) create mode 100644 src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerifyCommitmentInterval.cs create mode 100644 src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.Designer.cs create mode 100644 src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.cs diff --git a/src/api/src/domain/Yoma.Core.Domain/Lookups/Helpers/TimeIntervalHelper.cs b/src/api/src/domain/Yoma.Core.Domain/Lookups/Helpers/TimeIntervalHelper.cs index 0548bccb1..4d8bce45e 100644 --- a/src/api/src/domain/Yoma.Core.Domain/Lookups/Helpers/TimeIntervalHelper.cs +++ b/src/api/src/domain/Yoma.Core.Domain/Lookups/Helpers/TimeIntervalHelper.cs @@ -28,6 +28,23 @@ public static long ConvertToMinutes(string intervalName, int count) return minutes; } + public static (TimeIntervalOption Interval, short Count) ConvertToCommitmentInterval(DateTimeOffset dateStart, DateTimeOffset dateEnd) + { + if (dateEnd < dateStart) + throw new ArgumentOutOfRangeException(nameof(dateEnd), "End date is earlier than the start date"); + + var totalMinutes = (dateEnd - dateStart).TotalMinutes; + + return totalMinutes switch + { + < 60 => (TimeIntervalOption.Minute, (short)Math.Round(totalMinutes)), + < 60 * 24 => (TimeIntervalOption.Hour, (short)Math.Round(totalMinutes / 60)), + < 60 * 24 * 7 => (TimeIntervalOption.Day, (short)Math.Round(totalMinutes / (60 * 24))), + < 60 * 24 * 30 => (TimeIntervalOption.Week, (short)Math.Round(totalMinutes / (60 * 24 * 7))), + _ => (TimeIntervalOption.Month, (short)Math.Round(totalMinutes / (60 * 24 * 30))), + }; + } + public static int GetOrder(string intervalAsString) { if (Enum.TryParse(intervalAsString, out var interval)) diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Extensions/MyOpportunityExtensions.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Extensions/MyOpportunityExtensions.cs index e4b72bae9..a2c1fe3ed 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Extensions/MyOpportunityExtensions.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Extensions/MyOpportunityExtensions.cs @@ -40,11 +40,16 @@ public static MyOpportunityInfo ToInfo(this Models.MyOpportunity value) VerificationStatusId = value.VerificationStatusId, VerificationStatus = value.VerificationStatus, CommentVerification = value.CommentVerification, + CommitmentInterval = value.CommitmentInterval, + CommitmentIntervalCount = value.CommitmentIntervalCount, DateStart = value.DateStart, DateEnd = value.DateEnd, DateCompleted = value.DateCompleted, ZltoReward = value.ZltoReward, YomaReward = value.YomaReward, + Recommendable = value.Recommendable, + StarRating = value.StarRating, + Feedback = value.Feedback, DateModified = value.DateModified, Verifications = value.Verifications?.Select(o => new MyOpportunityInfoVerification diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunity.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunity.cs index 985b9c7e1..c74ada76c 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunity.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunity.cs @@ -100,6 +100,12 @@ public class MyOpportunity public string? CommentVerification { get; set; } + public Guid? CommitmentIntervalId { get; set; } + + public Core.TimeIntervalOption? CommitmentInterval { get; set; } + + public short? CommitmentIntervalCount { get; set; } + public DateTimeOffset? DateStart { get; set; } public DateTimeOffset? DateEnd { get; set; } @@ -110,6 +116,12 @@ public class MyOpportunity public decimal? YomaReward { get; set; } + public bool? Recommendable { get; set; } + + public byte? StarRating { get; set; } + + public string? Feedback { get; set; } + public DateTimeOffset DateCreated { get; set; } public DateTimeOffset DateModified { get; set; } diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityInfo.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityInfo.cs index 5173e9b1a..4d6ca86f2 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityInfo.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityInfo.cs @@ -93,6 +93,12 @@ public class MyOpportunityInfo [Name("Comment")] public string? CommentVerification { get; set; } + [Name("Completion Interval")] + public Core.TimeIntervalOption? CommitmentInterval { get; set; } + + [Name("Completion Interval Count")] + public short? CommitmentIntervalCount { get; set; } + [Name("Date Start")] public DateTimeOffset? DateStart { get; set; } @@ -108,6 +114,15 @@ public class MyOpportunityInfo [Ignore] //reserved for future use public decimal? YomaReward { get; set; } + [Ignore] + public bool? Recommendable { get; set; } + + [Ignore] + public byte? StarRating { get; set; } + + [Name("Feedback")] + public string? Feedback { get; set; } + [Name("Date Connected")] public DateTimeOffset DateModified { get; set; } diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerify.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerify.cs index 484a66fd7..d58100c60 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerify.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerify.cs @@ -18,6 +18,14 @@ public class MyOpportunityRequestVerify public DateTimeOffset? DateEnd { get; set; } + public MyOpportunityRequestVerifyCommitmentInterval? CommitmentInterval { get; set; } + + public bool? Recommendable { get; set; } + + public byte? StarRating { get; set; } + + public string? Feedback { get; set; } + [JsonIgnore] internal bool OverridePending { get; set; } diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerifyCommitmentInterval.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerifyCommitmentInterval.cs new file mode 100644 index 000000000..ea98c96df --- /dev/null +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerifyCommitmentInterval.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; +using Yoma.Core.Domain.Core; + +namespace Yoma.Core.Domain.MyOpportunity.Models +{ + public class MyOpportunityRequestVerifyCommitmentInterval + { + public Guid Id { get; set; } + + public short Count { get; set; } + + [JsonIgnore] + internal TimeIntervalOption? Option { get; set; } + } +} diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Services/MyOpportunityService.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Services/MyOpportunityService.cs index 87c045443..4a977f695 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Services/MyOpportunityService.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Services/MyOpportunityService.cs @@ -36,6 +36,8 @@ using System.Globalization; using System.Reflection; using Yoma.Core.Domain.Lookups.Interfaces; +using Yoma.Core.Domain.Lookups.Helpers; +using Yoma.Core.Domain.Lookups.Models; namespace Yoma.Core.Domain.MyOpportunity.Services { @@ -60,6 +62,7 @@ public class MyOpportunityService : IMyOpportunityService private readonly INotificationDeliveryService _notificationDeliveryService; private readonly ICountryService _countryService; private readonly IGenderService _genderService; + private readonly ITimeIntervalService _timeIntervalService; private readonly MyOpportunitySearchFilterValidator _myOpportunitySearchFilterValidator; private readonly MyOpportunityRequestValidatorVerify _myOpportunityRequestValidatorVerify; private readonly MyOpportunityRequestValidatorVerifyFinalize _myOpportunityRequestValidatorVerifyFinalize; @@ -94,6 +97,7 @@ public MyOpportunityService(ILogger logger, INotificationDeliveryService notificationDeliveryService, ICountryService countryService, IGenderService genderService, + ITimeIntervalService timeIntervalService, MyOpportunitySearchFilterValidator myOpportunitySearchFilterValidator, MyOpportunityRequestValidatorVerify myOpportunityRequestValidatorVerify, MyOpportunityRequestValidatorVerifyFinalize myOpportunityRequestValidatorVerifyFinalize, @@ -121,6 +125,7 @@ public MyOpportunityService(ILogger logger, _notificationDeliveryService = notificationDeliveryService; _countryService = countryService; _genderService = genderService; + _timeIntervalService = timeIntervalService; _myOpportunitySearchFilterValidator = myOpportunitySearchFilterValidator; _myOpportunityRequestValidatorVerify = myOpportunityRequestValidatorVerify; _myOpportunityRequestValidatorVerifyFinalize = myOpportunityRequestValidatorVerifyFinalize; @@ -1261,15 +1266,61 @@ private static string PerformActionNotPossibleValidationMessage(Opportunity.Mode return $"Opportunity '{opportunity.Title}' {description}, because {reasonText}. Please check these conditions and try again"; } + private void PerformActionSendForVerificationParseCommitment(MyOpportunityRequestVerify request, Opportunity.Models.Opportunity opportunity) + { + if (request.DateStart.HasValue) request.DateStart = request.DateStart.RemoveTime(); + if (request.DateEnd.HasValue) request.DateEnd = request.DateEnd.ToEndOfDay(); + + if (request.DateStart.HasValue && request.DateStart.Value < opportunity.DateStart) + throw new ValidationException($"Start date can not be earlier than the opportunity start date of '{opportunity.DateStart:yyyy-MM-dd}'"); + + if (request.DateEnd.HasValue) + { + if (opportunity.DateEnd.HasValue && request.DateEnd.Value > opportunity.DateEnd.Value) + throw new ValidationException($"End date cannot be later than the opportunity end date of '{opportunity.DateEnd.Value:yyyy-MM-dd}'"); + + if (request.DateEnd.Value > DateTimeOffset.UtcNow.ToEndOfDay()) + throw new ValidationException($"End date cannot be in the future. Please select today's date or earlier"); + } + + TimeInterval? timeInterval; + + //validation should ensure either the start date or commitment interval is provided; failsafe ensuring commitement takes preference + if (request.CommitmentInterval != null) + { + if (!request.DateEnd.HasValue) return; + + timeInterval = _timeIntervalService.GetById(request.CommitmentInterval.Id); + + request.CommitmentInterval.Option = Enum.Parse(timeInterval.Name, true); + + var totalMinutes = TimeIntervalHelper.ConvertToMinutes(timeInterval.Name, request.CommitmentInterval.Count); + request.DateStart = request.DateEnd.Value.AddMinutes(-totalMinutes).RemoveTime(); + + return; + } + + //validation should ensure both start (provided no commitment was specified) and end dates are provided; failsafe by not setting commitement if not provided + if (!request.DateStart.HasValue || !request.DateEnd.HasValue) return; + + var (Interval, Count) = TimeIntervalHelper.ConvertToCommitmentInterval(request.DateStart.Value, request.DateEnd.Value); + + timeInterval = _timeIntervalService.GetByName(Interval.ToString()); + + request.CommitmentInterval = new MyOpportunityRequestVerifyCommitmentInterval + { + Id = timeInterval.Id, + Count = Count, + Option = Enum.Parse(timeInterval.Name, true) + }; + } + private async Task PerformActionSendForVerification(User user, Guid opportunityId, MyOpportunityRequestVerify request, VerificationMethod? requiredVerificationMethod) { ArgumentNullException.ThrowIfNull(request, nameof(request)); await _myOpportunityRequestValidatorVerify.ValidateAndThrowAsync(request); - if (request.DateStart.HasValue) request.DateStart = request.DateStart.RemoveTime(); - if (request.DateEnd.HasValue) request.DateEnd = request.DateEnd.ToEndOfDay(); - //provided opportunity is published (and started) or expired var opportunity = _opportunityService.GetById(opportunityId, true, true, false); var canSendForVerification = opportunity.Status == Status.Expired; @@ -1277,6 +1328,8 @@ private async Task PerformActionSendForVerification(User user, Guid opportunityI if (!canSendForVerification) throw new ValidationException(PerformActionNotPossibleValidationMessage(opportunity, "cannot be sent for verification")); + PerformActionSendForVerificationParseCommitment(request, opportunity); + if (!opportunity.VerificationEnabled) throw new ValidationException($"Opportunity '{opportunity.Title}' can not be completed / verification is not enabled"); @@ -1289,18 +1342,6 @@ private async Task PerformActionSendForVerification(User user, Guid opportunityI if (requiredVerificationMethod.HasValue && opportunity.VerificationMethod != requiredVerificationMethod.Value) throw new ValidationException($"Opportunity '{opportunity.Title}' cannot be completed / requires verification method {requiredVerificationMethod}"); - if (request.DateStart.HasValue && request.DateStart.Value < opportunity.DateStart) - throw new ValidationException($"Start date can not be earlier than the opportunity start date of '{opportunity.DateStart:yyyy-MM-dd}'"); - - if (request.DateEnd.HasValue) - { - if (opportunity.DateEnd.HasValue && request.DateEnd.Value > opportunity.DateEnd.Value) - throw new ValidationException($"End date cannot be later than the opportunity end date of '{opportunity.DateEnd.Value:yyyy-MM-dd}'"); - - if (request.DateEnd.Value > DateTimeOffset.UtcNow.ToEndOfDay()) - throw new ValidationException($"End date cannot be in the future. Please select today's date or earlier"); - } - var actionVerificationId = _myOpportunityActionService.GetByName(Action.Verification.ToString()).Id; var verificationStatusPendingId = _myOpportunityVerificationStatusService.GetByName(VerificationStatus.Pending.ToString()).Id; @@ -1337,8 +1378,14 @@ private async Task PerformActionSendForVerification(User user, Guid opportunityI } myOpportunity.VerificationStatusId = verificationStatusPendingId; + myOpportunity.CommitmentIntervalId = request.CommitmentInterval?.Id; + myOpportunity.CommitmentIntervalCount = request.CommitmentInterval?.Count; + myOpportunity.CommitmentInterval = request.CommitmentInterval?.Option; myOpportunity.DateStart = request.DateStart; myOpportunity.DateEnd = request.DateEnd; + myOpportunity.Recommendable = request.Recommendable; + myOpportunity.StarRating = request.StarRating; + myOpportunity.Feedback = request.Feedback; await PerformActionSendForVerificationProcessVerificationTypes(request, opportunity, myOpportunity, isNew); diff --git a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Validators/MyOpportunityRequestValidatorVerify.cs b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Validators/MyOpportunityRequestValidatorVerify.cs index 777b1423b..a8895e883 100644 --- a/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Validators/MyOpportunityRequestValidatorVerify.cs +++ b/src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Validators/MyOpportunityRequestValidatorVerify.cs @@ -1,13 +1,20 @@ using FluentValidation; +using Yoma.Core.Domain.Lookups.Interfaces; using Yoma.Core.Domain.MyOpportunity.Models; namespace Yoma.Core.Domain.MyOpportunity.Validators { public class MyOpportunityRequestValidatorVerify : AbstractValidator { + #region Class Variables + private readonly ITimeIntervalService _timeIntervalService; + #endregion + #region Constructor - public MyOpportunityRequestValidatorVerify() + public MyOpportunityRequestValidatorVerify(ITimeIntervalService timeIntervalService) { + _timeIntervalService = timeIntervalService; + RuleFor(x => x.Certificate).Must(file => file == null || file.Length > 0).WithMessage("{PropertyName} is optional, but if specified, cannot be empty."); RuleFor(x => x.VoiceNote).Must(file => file == null || file.Length > 0).WithMessage("{PropertyName} is optional, but if specified, cannot be empty."); RuleFor(x => x.Picture).Must(file => file == null || file.Length > 0).WithMessage("{PropertyName} is optional, but if specified, cannot be empty."); @@ -19,12 +26,56 @@ public MyOpportunityRequestValidatorVerify() .Must(x => x == null || (x.Coordinates != null && x.Coordinates.All(coordinate => coordinate.Length >= 3))) .WithMessage("3 or more coordinate points expected per coordinate set i.e. Point: X-coordinate (longitude -180 to +180), Y-coordinate (latitude -90 to +90), Z-elevation.") .When(x => x.Geometry != null && x.Geometry.Type != Core.SpatialType.None); + //with instant-verifications start or end date not captured - RuleFor(x => x.DateStart).NotEmpty().When(x => !x.InstantOrImportedVerification).WithMessage("{PropertyName} is required."); - RuleFor(model => model.DateEnd) - .GreaterThanOrEqualTo(model => model.DateStart) - .When(model => model.DateEnd.HasValue) - .WithMessage("{PropertyName} is earlier than the Start Date."); + RuleFor(x => x) + .Must(x => x.InstantOrImportedVerification || (!x.DateStart.HasValue && x.CommitmentInterval != null) || (x.DateStart.HasValue && x.CommitmentInterval == null)) + .WithMessage("Either Start date or commitment interval (time to complete) must be specified, but not both."); + + RuleFor(x => x.DateStart) + .NotEmpty() + .When(x => x.CommitmentInterval == null && !x.InstantOrImportedVerification) + .WithMessage("Start date is required when the commitment interval (time to comnplete) is not specified."); + + RuleFor(x => x.CommitmentInterval) + .NotNull() + .When(x => !x.DateStart.HasValue && !x.InstantOrImportedVerification) + .WithMessage("Commitment interval (time to complete) is required when start date is not specified.") + .DependentRules(() => + { + RuleFor(x => x.CommitmentInterval!.Id) + .Must(id => id != Guid.Empty && CommitmentIntervalExists(id)) + .WithMessage("Commitment interval is empty or does not exist.") + .When(x => x.CommitmentInterval != null); + + RuleFor(x => x.CommitmentInterval!.Count) + .GreaterThanOrEqualTo((short)1) + .WithMessage("Commitment interval count must be greater than or equal to 1.") + .When(x => x.CommitmentInterval != null); + }); + + RuleFor(x => x.DateEnd) + .NotEmpty() + .When(x => !x.InstantOrImportedVerification) + .WithMessage("End date (when did you finish) is required") + .GreaterThanOrEqualTo(x => x.DateStart) + .When(x => x.DateStart.HasValue) + .WithMessage("End date (when did you finish) is earlier than the start date"); + + RuleFor(x => x.StarRating) + .InclusiveBetween((byte)1, (byte)5) + .When(x => x.StarRating.HasValue) + .WithMessage("Star rating must be between 1 and 5 if specified."); + + RuleFor(x => x.Feedback).Length(1, 500).When(x => !string.IsNullOrEmpty(x.Feedback)).WithMessage("Feedback must be between 1 and 500 characters."); + } + #endregion + + #region Private Members + private bool CommitmentIntervalExists(Guid id) + { + if (id == Guid.Empty) return false; + return _timeIntervalService.GetByIdOrNull(id) != null; } #endregion } diff --git a/src/api/src/domain/Yoma.Core.Domain/Opportunity/Services/OpportunityService.cs b/src/api/src/domain/Yoma.Core.Domain/Opportunity/Services/OpportunityService.cs index 512397658..aaf905199 100644 --- a/src/api/src/domain/Yoma.Core.Domain/Opportunity/Services/OpportunityService.cs +++ b/src/api/src/domain/Yoma.Core.Domain/Opportunity/Services/OpportunityService.cs @@ -1891,7 +1891,7 @@ await _executionStrategyService.ExecuteInExecutionStrategyAsync(async () => request = new OpportunityRequestUpdate { Id = existingByExternalId.Id, - VerificationMethod = !existingByExternalId.VerificationMethod.HasValue ? VerificationMethod.Automatic : existingByExternalId.VerificationMethod.Value, //preserve existing method if set + VerificationMethod = existingByExternalId.VerificationMethod ?? VerificationMethod.Automatic, //preserve existing method if set SSISchemaName = string.IsNullOrEmpty(existingByExternalId.SSISchemaName) ? SSISSchemaHelper.ToFullName(SchemaType.Opportunity, $"Default") : existingByExternalId.SSISchemaName //preserve existing schema if set }; } diff --git a/src/api/src/domain/Yoma.Core.Domain/Opportunity/Validators/OpportunityRequestValidatorBase.cs b/src/api/src/domain/Yoma.Core.Domain/Opportunity/Validators/OpportunityRequestValidatorBase.cs index 01d262cf4..ad6d16086 100644 --- a/src/api/src/domain/Yoma.Core.Domain/Opportunity/Validators/OpportunityRequestValidatorBase.cs +++ b/src/api/src/domain/Yoma.Core.Domain/Opportunity/Validators/OpportunityRequestValidatorBase.cs @@ -54,7 +54,7 @@ public OpportunityRequestValidatorBase(IOpportunityTypeService opportunityTypeSe RuleFor(x => x.Description).NotEmpty(); RuleFor(x => x.TypeId).NotEmpty().Must(TypeExists).WithMessage($"Specified type is invalid / does not exist."); RuleFor(x => x.OrganizationId).NotEmpty().Must(OrganizationActive).WithMessage("The selected organization is either invalid or inactive."); - RuleFor(x => x.Summary).NotEmpty().Length(1, 150).WithMessage("'{PropertyName}' must be between 1 and 150 characters."); + RuleFor(x => x.Summary).NotEmpty().Length(1, 150).WithMessage("'{PropertyName}' is required and must be between 1 and 150 characters."); //instructions (varchar(max); auto trimmed RuleFor(x => x.URL).Length(1, 2048).Must(ValidURL).When(x => !string.IsNullOrEmpty(x.URL)).WithMessage("'{PropertyName}' must be between 1 and 2048 characters long and be a valid URL if specified."); diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.Designer.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.Designer.cs new file mode 100644 index 000000000..cfb8aca55 --- /dev/null +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.Designer.cs @@ -0,0 +1,2820 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Yoma.Core.Infrastructure.Database.Context; + +#nullable disable + +namespace Yoma.Core.Infrastructure.Database.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250122073855_ApplicationDb_MyOpportunity_Verification")] + partial class ApplicationDb_MyOpportunity_Verification + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.ActionLink.Entities.Link", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Action") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("CommentApproval") + .HasColumnType("varchar(500)"); + + b.Property("CreatedByUserId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("varchar(500)"); + + b.Property("DistributionList") + .HasColumnType("text"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("LockToDistributionList") + .HasColumnType("boolean"); + + b.Property("ModifiedByUserId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("ShortURL") + .IsRequired() + .HasColumnType("varchar(2048)"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("URL") + .IsRequired() + .HasColumnType("varchar(2048)"); + + b.Property("UsagesLimit") + .HasColumnType("integer"); + + b.Property("UsagesTotal") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByUserId"); + + b.HasIndex("ModifiedByUserId"); + + b.HasIndex("OpportunityId"); + + b.HasIndex("ShortURL") + .IsUnique(); + + b.HasIndex("StatusId"); + + b.HasIndex("URL") + .IsUnique(); + + b.HasIndex("Name", "EntityType", "Action", "StatusId", "OpportunityId", "DateEnd", "DateCreated"); + + b.ToTable("Link", "ActionLink"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.ActionLink.Entities.LinkUsageLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("LinkId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("DateCreated"); + + b.HasIndex("UserId"); + + b.HasIndex("LinkId", "UserId") + .IsUnique(); + + b.ToTable("UsageLog", "ActionLink"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.ActionLink.Entities.Lookups.LinkStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Status", "ActionLink"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("varchar(127)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("FileType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("Key") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.Property("OriginalFileName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("StorageType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.HasKey("Id"); + + b.HasIndex("Key") + .IsUnique(); + + b.HasIndex("ParentId"); + + b.HasIndex("StorageType", "FileType", "ParentId"); + + b.ToTable("Blob", "Object"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Lookups.OrganizationProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OrganizationProviderType", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Lookups.OrganizationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OrganizationStatus", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Lookups.SettingsDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DefaultValue") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("varchar(500)"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("Group") + .IsRequired() + .HasColumnType("varchar(100)"); + + b.Property("Key") + .IsRequired() + .HasColumnType("varchar(100)"); + + b.Property("Order") + .HasColumnType("smallint"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("SubGroup") + .HasColumnType("varchar(100)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("varchar(100)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("Visible") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("EntityType", "Key") + .IsUnique(); + + b.ToTable("SettingsDefinition", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Biography") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("varchar(50)"); + + b.Property("CommentApproval") + .HasColumnType("varchar(500)"); + + b.Property("CountryId") + .HasColumnType("uuid"); + + b.Property("CreatedByUserId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateStatusModified") + .HasColumnType("timestamp with time zone"); + + b.Property("LogoId") + .HasColumnType("uuid"); + + b.Property("ModifiedByUserId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("NameHashValue") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("PostalCode") + .HasColumnType("varchar(10)"); + + b.Property("PrimaryContactEmail") + .HasColumnType("varchar(320)"); + + b.Property("PrimaryContactName") + .HasColumnType("varchar(255)"); + + b.Property("PrimaryContactPhone") + .HasColumnType("varchar(50)"); + + b.Property("Province") + .HasColumnType("varchar(255)"); + + b.Property("RegistrationNumber") + .HasColumnType("varchar(255)"); + + b.Property("SSOClientIdInbound") + .HasColumnType("varchar(255)"); + + b.Property("SSOClientIdOutbound") + .HasColumnType("varchar(255)"); + + b.Property("Settings") + .HasColumnType("text"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("StreetAddress") + .HasColumnType("varchar(500)"); + + b.Property("Tagline") + .HasColumnType("text"); + + b.Property("TaxNumber") + .HasColumnType("varchar(255)"); + + b.Property("VATIN") + .HasColumnType("varchar(255)"); + + b.Property("WebsiteURL") + .HasColumnType("varchar(2048)"); + + b.Property("YomaRewardCumulative") + .HasColumnType("decimal(12,2)"); + + b.Property("YomaRewardPool") + .HasColumnType("decimal(12,2)"); + + b.Property("ZltoRewardCumulative") + .HasColumnType("decimal(12,2)"); + + b.Property("ZltoRewardPool") + .HasColumnType("decimal(12,2)"); + + b.HasKey("Id"); + + b.HasIndex("CountryId"); + + b.HasIndex("CreatedByUserId"); + + b.HasIndex("LogoId"); + + b.HasIndex("ModifiedByUserId"); + + b.HasIndex("Name") + .IsUnique(); + + b.HasIndex("NameHashValue") + .IsUnique(); + + b.HasIndex("StatusId", "DateStatusModified", "DateCreated", "CreatedByUserId", "DateModified", "ModifiedByUserId"); + + b.ToTable("Organization", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("FileId") + .HasColumnType("uuid"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("Type") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("FileId") + .IsUnique(); + + b.HasIndex("OrganizationId", "Type", "DateCreated"); + + b.ToTable("OrganizationDocuments", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("ProviderTypeId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.HasIndex("OrganizationId", "ProviderTypeId") + .IsUnique(); + + b.ToTable("OrganizationProviderTypes", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("OrganizationId", "UserId") + .IsUnique(); + + b.ToTable("OrganizationUsers", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CountryId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateLastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOfBirth") + .HasColumnType("timestamp with time zone"); + + b.Property("DateYoIDOnboarded") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("varchar(255)"); + + b.Property("EducationId") + .HasColumnType("uuid"); + + b.Property("Email") + .HasColumnType("varchar(320)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("ExternalId") + .HasColumnType("uuid"); + + b.Property("FirstName") + .HasColumnType("varchar(125)"); + + b.Property("GenderId") + .HasColumnType("uuid"); + + b.Property("PhoneNumber") + .HasColumnType("varchar(50)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("PhotoId") + .HasColumnType("uuid"); + + b.Property("Settings") + .HasColumnType("text"); + + b.Property("Surname") + .HasColumnType("varchar(125)"); + + b.Property("YoIDOnboarded") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CountryId"); + + b.HasIndex("EducationId"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("ExternalId") + .IsUnique(); + + b.HasIndex("GenderId"); + + b.HasIndex("PhoneNumber") + .IsUnique(); + + b.HasIndex("PhotoId"); + + b.HasIndex("FirstName", "Surname", "DisplayName", "EmailConfirmed", "PhoneNumberConfirmed", "DateOfBirth", "DateLastLogin", "YoIDOnboarded", "DateYoIDOnboarded", "DateCreated", "DateModified"); + + b.ToTable("User", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserLoginHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthMethod") + .HasColumnType("varchar(255)"); + + b.Property("AuthType") + .HasColumnType("varchar(255)"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("IpAddress") + .HasColumnType("varchar(39)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "ClientId", "DateCreated"); + + b.ToTable("UserLoginHistory", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("SkillId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SkillId"); + + b.HasIndex("UserId", "SkillId") + .IsUnique(); + + b.ToTable("UserSkills", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkillOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("UserSkillId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserSkillId", "OrganizationId") + .IsUnique(); + + b.ToTable("UserSkillOrganizations", "Entity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.Country", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CodeAlpha2") + .IsRequired() + .HasColumnType("varchar(2)"); + + b.Property("CodeAlpha3") + .IsRequired() + .HasColumnType("varchar(3)"); + + b.Property("CodeNumeric") + .IsRequired() + .HasColumnType("varchar(3)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("CodeAlpha2") + .IsUnique(); + + b.HasIndex("CodeAlpha3") + .IsUnique(); + + b.HasIndex("CodeNumeric") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Country", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.Education", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Education", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.EngagementType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("EngagementType", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.Gender", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Gender", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CodeAlpha2") + .IsRequired() + .HasColumnType("varchar(2)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("CodeAlpha2") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Language", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ExternalId") + .IsRequired() + .HasColumnType("varchar(100)"); + + b.Property("InfoURL") + .HasColumnType("varchar(2048)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("ExternalId") + .IsUnique(); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Skill", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Lookups.Entities.TimeInterval", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("TimeInterval", "Lookup"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.Lookups.StoreAccessControlRuleStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(30)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("StoreAccessControlRuleStatus", "Marketplace"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.Lookups.TransactionStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(30)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("TransactionStatus", "Marketplace"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AgeFrom") + .HasColumnType("integer"); + + b.Property("AgeTo") + .HasColumnType("integer"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("varchar(500)"); + + b.Property("GenderId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("OpportunityOption") + .HasColumnType("varchar(10)"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("StoreCountryId") + .HasColumnType("uuid"); + + b.Property("StoreId") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("StoreItemCategories") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GenderId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("StoreCountryId"); + + b.HasIndex("Name", "OrganizationId", "StoreId", "StatusId", "DateCreated", "DateModified"); + + b.ToTable("StoreAccessControlRule", "Marketplace"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRuleOpportunity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("StoreAccessControlRuleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OpportunityId"); + + b.HasIndex("StoreAccessControlRuleId", "OpportunityId") + .IsUnique(); + + b.ToTable("StoreAccessControlRuleOpportunity", "Marketplace"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.TransactionLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("decimal(8,2)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ItemCategoryId") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("ItemId") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("TransactionId") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("StatusId"); + + b.HasIndex("UserId", "ItemCategoryId", "ItemId", "StatusId", "DateCreated", "DateModified"); + + b.ToTable("TransactionLog", "Marketplace"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.Lookups.MyOpportunityAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("MyOpportunityAction", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.Lookups.MyOpportunityVerificationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("MyOpportunityVerificationStatus", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionId") + .HasColumnType("uuid"); + + b.Property("CommentVerification") + .HasColumnType("varchar(500)"); + + b.Property("CommitmentIntervalCount") + .HasColumnType("smallint"); + + b.Property("CommitmentIntervalId") + .HasColumnType("uuid"); + + b.Property("DateCompleted") + .HasColumnType("timestamp with time zone"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone"); + + b.Property("Feedback") + .HasColumnType("varchar(500)"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("Recommendable") + .HasColumnType("boolean"); + + b.Property("StarRating") + .HasColumnType("smallint"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("VerificationStatusId") + .HasColumnType("uuid"); + + b.Property("YomaReward") + .HasColumnType("decimal(8,2)"); + + b.Property("ZltoReward") + .HasColumnType("decimal(8,2)"); + + b.HasKey("Id"); + + b.HasIndex("ActionId"); + + b.HasIndex("CommitmentIntervalId"); + + b.HasIndex("OpportunityId"); + + b.HasIndex("UserId", "OpportunityId", "ActionId") + .IsUnique(); + + b.HasIndex("VerificationStatusId", "DateStart", "DateEnd", "DateCompleted", "ZltoReward", "YomaReward", "Recommendable", "StarRating", "DateCreated", "DateModified"); + + b.ToTable("MyOpportunity", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunityVerification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("FileId") + .HasColumnType("uuid"); + + b.Property("GeometryProperties") + .HasColumnType("text"); + + b.Property("MyOpportunityId") + .HasColumnType("uuid"); + + b.Property("VerificationTypeId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("FileId"); + + b.HasIndex("VerificationTypeId"); + + b.HasIndex("MyOpportunityId", "VerificationTypeId") + .IsUnique(); + + b.ToTable("MyOpportunityVerifications", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("ImageURL") + .IsRequired() + .HasColumnType("varchar(2048)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpportunityCategory", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityDifficulty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpportunityDifficulty", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpportunityStatus", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpportunityType", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityVerificationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpportunityVerificationType", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CommitmentIntervalCount") + .HasColumnType("smallint"); + + b.Property("CommitmentIntervalId") + .HasColumnType("uuid"); + + b.Property("CreatedByUserId") + .HasColumnType("uuid"); + + b.Property("CredentialIssuanceEnabled") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("DifficultyId") + .HasColumnType("uuid"); + + b.Property("EngagementTypeId") + .HasColumnType("uuid"); + + b.Property("ExternalId") + .HasColumnType("varchar(50)"); + + b.Property("Featured") + .HasColumnType("boolean"); + + b.Property("Hidden") + .HasColumnType("boolean"); + + b.Property("Instructions") + .HasColumnType("text"); + + b.Property("Keywords") + .HasColumnType("varchar(500)"); + + b.Property("ModifiedByUserId") + .HasColumnType("uuid"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("ParticipantCount") + .HasColumnType("integer"); + + b.Property("ParticipantLimit") + .HasColumnType("integer"); + + b.Property("SSISchemaName") + .HasColumnType("varchar(255)"); + + b.Property("ShareWithPartners") + .HasColumnType("boolean"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("Summary") + .HasColumnType("varchar(500)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("TypeId") + .HasColumnType("uuid"); + + b.Property("URL") + .HasColumnType("varchar(2048)"); + + b.Property("VerificationEnabled") + .HasColumnType("boolean"); + + b.Property("VerificationMethod") + .HasColumnType("varchar(20)"); + + b.Property("YomaReward") + .HasColumnType("decimal(8,2)"); + + b.Property("YomaRewardCumulative") + .HasColumnType("decimal(12,2)"); + + b.Property("YomaRewardPool") + .HasColumnType("decimal(12,2)"); + + b.Property("ZltoReward") + .HasColumnType("decimal(8,2)"); + + b.Property("ZltoRewardCumulative") + .HasColumnType("decimal(12,2)"); + + b.Property("ZltoRewardPool") + .HasColumnType("decimal(12,2)"); + + b.HasKey("Id"); + + b.HasIndex("CommitmentIntervalId"); + + b.HasIndex("CreatedByUserId"); + + b.HasIndex("Description") + .HasAnnotation("Npgsql:TsVectorConfig", "english"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Description"), "GIN"); + + b.HasIndex("DifficultyId"); + + b.HasIndex("EngagementTypeId"); + + b.HasIndex("ModifiedByUserId"); + + b.HasIndex("StatusId"); + + b.HasIndex("Title") + .IsUnique(); + + b.HasIndex("OrganizationId", "ExternalId") + .IsUnique(); + + b.HasIndex("TypeId", "OrganizationId", "ZltoReward", "DifficultyId", "CommitmentIntervalId", "CommitmentIntervalCount", "StatusId", "Keywords", "DateStart", "DateEnd", "CredentialIssuanceEnabled", "Featured", "EngagementTypeId", "ShareWithPartners", "Hidden", "DateCreated", "CreatedByUserId", "DateModified", "ModifiedByUserId"); + + b.ToTable("Opportunity", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("OpportunityId", "CategoryId") + .IsUnique(); + + b.ToTable("OpportunityCategories", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityCountry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CountryId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CountryId"); + + b.HasIndex("OpportunityId", "CountryId") + .IsUnique(); + + b.ToTable("OpportunityCountries", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityLanguage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("LanguageId") + .HasColumnType("uuid"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("LanguageId"); + + b.HasIndex("OpportunityId", "LanguageId") + .IsUnique(); + + b.ToTable("OpportunityLanguages", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunitySkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("SkillId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SkillId"); + + b.HasIndex("OpportunityId", "SkillId") + .IsUnique(); + + b.ToTable("OpportunitySkills", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityVerificationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("varchar(255)"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("VerificationTypeId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("VerificationTypeId"); + + b.HasIndex("OpportunityId", "VerificationTypeId") + .IsUnique(); + + b.ToTable("OpportunityVerificationTypes", "Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.Lookups.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionEnabled") + .HasColumnType("text"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Partner", "PartnerSharing"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.Lookups.ProcessingStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("ProcessingStatus", "PartnerSharing"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.ProcessingLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Action") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EntityExternalId") + .HasColumnType("varchar(50)"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("ErrorReason") + .HasColumnType("text"); + + b.Property("OpportunityId") + .HasColumnType("uuid"); + + b.Property("PartnerId") + .HasColumnType("uuid"); + + b.Property("RetryCount") + .HasColumnType("smallint"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OpportunityId"); + + b.HasIndex("PartnerId"); + + b.HasIndex("StatusId"); + + b.HasIndex("EntityType", "OpportunityId", "PartnerId", "Action", "StatusId", "EntityExternalId", "DateCreated", "DateModified"); + + b.ToTable("ProcessingLog", "PartnerSharing"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.Lookups.RewardTransactionStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(30)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_TransactionStatus_Name1"); + + b.ToTable("TransactionStatus", "Reward"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.Lookups.WalletCreationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("WalletCreationStatus", "Reward"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.RewardTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("decimal(8,2)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ErrorReason") + .HasColumnType("text"); + + b.Property("MyOpportunityId") + .HasColumnType("uuid"); + + b.Property("RetryCount") + .HasColumnType("smallint"); + + b.Property("SourceEntityType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("TransactionId") + .HasColumnType("varchar(50)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("MyOpportunityId"); + + b.HasIndex("StatusId", "DateCreated", "DateModified"); + + b.HasIndex("UserId", "SourceEntityType", "MyOpportunityId") + .IsUnique(); + + b.ToTable("Transaction", "Reward"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.WalletCreation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Balance") + .HasColumnType("decimal(12,2)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ErrorReason") + .HasColumnType("text"); + + b.Property("RetryCount") + .HasColumnType("smallint"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("Username") + .HasColumnType("varchar(320)"); + + b.Property("WalletId") + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.HasIndex("Username") + .IsUnique(); + + b.HasIndex("StatusId", "DateCreated", "DateModified"); + + b.ToTable("WalletCreation", "Reward"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSICredentialIssuanceStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("CredentialIssuanceStatus", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("TypeName") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("TypeName") + .IsUnique(); + + b.ToTable("SchemaEntity", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntityProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.Property("Format") + .HasColumnType("varchar(125)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("NameDisplay") + .IsRequired() + .HasColumnType("varchar(50)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("SSISchemaEntityId") + .HasColumnType("uuid"); + + b.Property("SystemType") + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("SSISchemaEntityId", "Name") + .IsUnique(); + + b.ToTable("SchemaEntityProperty", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntityType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("SSISchemaEntityId") + .HasColumnType("uuid"); + + b.Property("SSISchemaTypeId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SSISchemaTypeId"); + + b.HasIndex("SSISchemaEntityId", "SSISchemaTypeId") + .IsUnique(); + + b.ToTable("SchemaEntityType", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.Property("SupportMultiple") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("SchemaType", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSITenantCreationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("TenantCreationStatus", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.SSICredentialIssuance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ArtifactType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("CredentialId") + .HasColumnType("varchar(50)"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ErrorReason") + .HasColumnType("text"); + + b.Property("MyOpportunityId") + .HasColumnType("uuid"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("RetryCount") + .HasColumnType("smallint"); + + b.Property("SchemaName") + .IsRequired() + .HasColumnType("varchar(125)"); + + b.Property("SchemaTypeId") + .HasColumnType("uuid"); + + b.Property("SchemaVersion") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("MyOpportunityId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("UserId"); + + b.HasIndex("SchemaName", "UserId", "OrganizationId", "MyOpportunityId") + .IsUnique(); + + b.HasIndex("SchemaTypeId", "ArtifactType", "SchemaName", "StatusId", "DateCreated", "DateModified"); + + b.ToTable("CredentialIssuance", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.SSITenantCreation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("varchar(25)"); + + b.Property("ErrorReason") + .HasColumnType("text"); + + b.Property("OrganizationId") + .HasColumnType("uuid"); + + b.Property("RetryCount") + .HasColumnType("smallint"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("varchar(50)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("EntityType", "UserId", "OrganizationId") + .IsUnique(); + + b.HasIndex("StatusId", "DateCreated", "DateModified"); + + b.ToTable("TenantCreation", "SSI"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.ActionLink.Entities.Link", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedByUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "ModifiedByUser") + .WithMany() + .HasForeignKey("ModifiedByUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany() + .HasForeignKey("OpportunityId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.ActionLink.Entities.Lookups.LinkStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedByUser"); + + b.Navigation("ModifiedByUser"); + + b.Navigation("Opportunity"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.ActionLink.Entities.LinkUsageLog", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.ActionLink.Entities.Link", "Link") + .WithMany() + .HasForeignKey("LinkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Link"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Country", "Country") + .WithMany() + .HasForeignKey("CountryId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedByUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", "Logo") + .WithMany() + .HasForeignKey("LogoId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "ModifiedByUser") + .WithMany() + .HasForeignKey("ModifiedByUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Lookups.OrganizationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Country"); + + b.Navigation("CreatedByUser"); + + b.Navigation("Logo"); + + b.Navigation("ModifiedByUser"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationDocument", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", "File") + .WithMany() + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany("Documents") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationProviderType", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany("ProviderTypes") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Lookups.OrganizationProviderType", "ProviderType") + .WithMany() + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.OrganizationUser", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany("Administrators") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.User", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Country", "Country") + .WithMany() + .HasForeignKey("CountryId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Education", "Education") + .WithMany() + .HasForeignKey("EducationId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", "Photo") + .WithMany() + .HasForeignKey("PhotoId"); + + b.Navigation("Country"); + + b.Navigation("Education"); + + b.Navigation("Gender"); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserLoginHistory", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkill", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Skill", "Skill") + .WithMany() + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany("Skills") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Skill"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkillOrganization", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkill", "UserSkill") + .WithMany("Organizations") + .HasForeignKey("UserSkillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + + b.Navigation("UserSkill"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRule", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Marketplace.Entities.Lookups.StoreAccessControlRuleStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Country", "StoreCountry") + .WithMany() + .HasForeignKey("StoreCountryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Gender"); + + b.Navigation("Organization"); + + b.Navigation("Status"); + + b.Navigation("StoreCountry"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRuleOpportunity", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany() + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRule", "StoreAccessControlRule") + .WithMany("Opportunities") + .HasForeignKey("StoreAccessControlRuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Opportunity"); + + b.Navigation("StoreAccessControlRule"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.TransactionLog", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Marketplace.Entities.Lookups.TransactionStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Status"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.Lookups.MyOpportunityAction", "Action") + .WithMany() + .HasForeignKey("ActionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.TimeInterval", "CommitmentInterval") + .WithMany() + .HasForeignKey("CommitmentIntervalId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany() + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.Lookups.MyOpportunityVerificationStatus", "VerificationStatus") + .WithMany() + .HasForeignKey("VerificationStatusId"); + + b.Navigation("Action"); + + b.Navigation("CommitmentInterval"); + + b.Navigation("Opportunity"); + + b.Navigation("User"); + + b.Navigation("VerificationStatus"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunityVerification", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Core.Entities.BlobObject", "File") + .WithMany() + .HasForeignKey("FileId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", "MyOpportunity") + .WithMany("Verifications") + .HasForeignKey("MyOpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityVerificationType", "VerificationType") + .WithMany() + .HasForeignKey("VerificationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("MyOpportunity"); + + b.Navigation("VerificationType"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.TimeInterval", "CommitmentInterval") + .WithMany() + .HasForeignKey("CommitmentIntervalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedByUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityDifficulty", "Difficulty") + .WithMany() + .HasForeignKey("DifficultyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.EngagementType", "EngagementType") + .WithMany() + .HasForeignKey("EngagementTypeId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "ModifiedByUser") + .WithMany() + .HasForeignKey("ModifiedByUserId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CommitmentInterval"); + + b.Navigation("CreatedByUser"); + + b.Navigation("Difficulty"); + + b.Navigation("EngagementType"); + + b.Navigation("ModifiedByUser"); + + b.Navigation("Organization"); + + b.Navigation("Status"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityCategory", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany("Categories") + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityCountry", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Country", "Country") + .WithMany() + .HasForeignKey("CountryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany("Countries") + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Country"); + + b.Navigation("Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityLanguage", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany("Languages") + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Language"); + + b.Navigation("Opportunity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunitySkill", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany("Skills") + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.Skill", "Skill") + .WithMany() + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Opportunity"); + + b.Navigation("Skill"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.OpportunityVerificationType", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany("VerificationTypes") + .HasForeignKey("OpportunityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Lookups.OpportunityVerificationType", "VerificationType") + .WithMany() + .HasForeignKey("VerificationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Opportunity"); + + b.Navigation("VerificationType"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.ProcessingLog", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") + .WithMany() + .HasForeignKey("OpportunityId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.Lookups.Partner", "Partner") + .WithMany() + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.PartnerSharing.Entities.Lookups.ProcessingStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Opportunity"); + + b.Navigation("Partner"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.RewardTransaction", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", "MyOpportunity") + .WithMany() + .HasForeignKey("MyOpportunityId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Reward.Entities.Lookups.RewardTransactionStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MyOpportunity"); + + b.Navigation("Status"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Reward.Entities.WalletCreation", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Reward.Entities.Lookups.WalletCreationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Status"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntityProperty", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntity", "SSISchemaEntity") + .WithMany("Properties") + .HasForeignKey("SSISchemaEntityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SSISchemaEntity"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntityType", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntity", "SSISchemaEntity") + .WithMany("Types") + .HasForeignKey("SSISchemaEntityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaType", "SSISchemaType") + .WithMany() + .HasForeignKey("SSISchemaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SSISchemaEntity"); + + b.Navigation("SSISchemaType"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.SSICredentialIssuance", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", "MyOpportunity") + .WithMany() + .HasForeignKey("MyOpportunityId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaType", "SchemaType") + .WithMany() + .HasForeignKey("SchemaTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSICredentialIssuanceStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("MyOpportunity"); + + b.Navigation("Organization"); + + b.Navigation("SchemaType"); + + b.Navigation("Status"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.SSITenantCreation", b => + { + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.HasOne("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSITenantCreationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Yoma.Core.Infrastructure.Database.Entity.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Organization"); + + b.Navigation("Status"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.Organization", b => + { + b.Navigation("Administrators"); + + b.Navigation("Documents"); + + b.Navigation("ProviderTypes"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.User", b => + { + b.Navigation("Skills"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Entity.Entities.UserSkill", b => + { + b.Navigation("Organizations"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Marketplace.Entities.StoreAccessControlRule", b => + { + b.Navigation("Opportunities"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.MyOpportunity", b => + { + b.Navigation("Verifications"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", b => + { + b.Navigation("Categories"); + + b.Navigation("Countries"); + + b.Navigation("Languages"); + + b.Navigation("Skills"); + + b.Navigation("VerificationTypes"); + }); + + modelBuilder.Entity("Yoma.Core.Infrastructure.Database.SSI.Entities.Lookups.SSISchemaEntity", b => + { + b.Navigation("Properties"); + + b.Navigation("Types"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.cs new file mode 100644 index 000000000..8f08aeea2 --- /dev/null +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/20250122073855_ApplicationDb_MyOpportunity_Verification.cs @@ -0,0 +1,125 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Yoma.Core.Infrastructure.Database.Migrations +{ + /// + public partial class ApplicationDb_MyOpportunity_Verification : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_MyOpportunity_VerificationStatusId_DateCompleted_ZltoReward~", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.AddColumn( + name: "CommitmentIntervalCount", + schema: "Opportunity", + table: "MyOpportunity", + type: "smallint", + nullable: true); + + migrationBuilder.AddColumn( + name: "CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity", + type: "uuid", + nullable: true); + + migrationBuilder.AddColumn( + name: "Feedback", + schema: "Opportunity", + table: "MyOpportunity", + type: "varchar(500)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Recommendable", + schema: "Opportunity", + table: "MyOpportunity", + type: "boolean", + nullable: true); + + migrationBuilder.AddColumn( + name: "StarRating", + schema: "Opportunity", + table: "MyOpportunity", + type: "smallint", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_MyOpportunity_CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity", + column: "CommitmentIntervalId"); + + migrationBuilder.CreateIndex( + name: "IX_MyOpportunity_VerificationStatusId_DateStart_DateEnd_DateCo~", + schema: "Opportunity", + table: "MyOpportunity", + columns: ["VerificationStatusId", "DateStart", "DateEnd", "DateCompleted", "ZltoReward", "YomaReward", "Recommendable", "StarRating", "DateCreated", "DateModified"]); + + migrationBuilder.AddForeignKey( + name: "FK_MyOpportunity_TimeInterval_CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity", + column: "CommitmentIntervalId", + principalSchema: "Lookup", + principalTable: "TimeInterval", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_MyOpportunity_TimeInterval_CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropIndex( + name: "IX_MyOpportunity_CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropIndex( + name: "IX_MyOpportunity_VerificationStatusId_DateStart_DateEnd_DateCo~", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropColumn( + name: "CommitmentIntervalCount", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropColumn( + name: "CommitmentIntervalId", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropColumn( + name: "Feedback", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropColumn( + name: "Recommendable", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.DropColumn( + name: "StarRating", + schema: "Opportunity", + table: "MyOpportunity"); + + migrationBuilder.CreateIndex( + name: "IX_MyOpportunity_VerificationStatusId_DateCompleted_ZltoReward~", + schema: "Opportunity", + table: "MyOpportunity", + columns: new[] { "VerificationStatusId", "DateCompleted", "ZltoReward", "YomaReward", "DateCreated", "DateModified" }); + } + } +} diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/ApplicationDbContextModelSnapshot.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/ApplicationDbContextModelSnapshot.cs index bc050a1f6..342cf4ee6 100644 --- a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/Migrations/ApplicationDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("ProductVersion", "9.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -1083,6 +1083,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CommentVerification") .HasColumnType("varchar(500)"); + b.Property("CommitmentIntervalCount") + .HasColumnType("smallint"); + + b.Property("CommitmentIntervalId") + .HasColumnType("uuid"); + b.Property("DateCompleted") .HasColumnType("timestamp with time zone"); @@ -1098,9 +1104,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DateStart") .HasColumnType("timestamp with time zone"); + b.Property("Feedback") + .HasColumnType("varchar(500)"); + b.Property("OpportunityId") .HasColumnType("uuid"); + b.Property("Recommendable") + .HasColumnType("boolean"); + + b.Property("StarRating") + .HasColumnType("smallint"); + b.Property("UserId") .HasColumnType("uuid"); @@ -1117,12 +1132,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ActionId"); + b.HasIndex("CommitmentIntervalId"); + b.HasIndex("OpportunityId"); b.HasIndex("UserId", "OpportunityId", "ActionId") .IsUnique(); - b.HasIndex("VerificationStatusId", "DateCompleted", "ZltoReward", "YomaReward", "DateCreated", "DateModified"); + b.HasIndex("VerificationStatusId", "DateStart", "DateEnd", "DateCompleted", "ZltoReward", "YomaReward", "Recommendable", "StarRating", "DateCreated", "DateModified"); b.ToTable("MyOpportunity", "Opportunity"); }); @@ -2371,6 +2388,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("Yoma.Core.Infrastructure.Database.Lookups.Entities.TimeInterval", "CommitmentInterval") + .WithMany() + .HasForeignKey("CommitmentIntervalId"); + b.HasOne("Yoma.Core.Infrastructure.Database.Opportunity.Entities.Opportunity", "Opportunity") .WithMany() .HasForeignKey("OpportunityId") @@ -2389,6 +2410,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Action"); + b.Navigation("CommitmentInterval"); + b.Navigation("Opportunity"); b.Navigation("User"); diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Entities/MyOpportunity.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Entities/MyOpportunity.cs index beb53bfdd..b45b5ea6b 100644 --- a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Entities/MyOpportunity.cs +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Entities/MyOpportunity.cs @@ -3,13 +3,15 @@ using System.ComponentModel.DataAnnotations.Schema; using Yoma.Core.Infrastructure.Database.Core.Entities; using Yoma.Core.Infrastructure.Database.Entity.Entities; +using Yoma.Core.Infrastructure.Database.Lookups.Entities; using Yoma.Core.Infrastructure.Database.MyOpportunity.Entities.Lookups; namespace Yoma.Core.Infrastructure.Database.MyOpportunity.Entities { [Table("MyOpportunity", Schema = "Opportunity")] [Index(nameof(UserId), nameof(OpportunityId), nameof(ActionId), IsUnique = true)] - [Index(nameof(VerificationStatusId), nameof(DateCompleted), nameof(ZltoReward), nameof(YomaReward), nameof(DateCreated), nameof(DateModified))] + [Index(nameof(VerificationStatusId), nameof(DateStart), nameof(DateEnd), nameof(DateCompleted), nameof(ZltoReward), nameof(YomaReward), + nameof(Recommendable), nameof(StarRating), nameof(DateCreated), nameof(DateModified))] public class MyOpportunity : BaseEntity { [Required] @@ -34,6 +36,12 @@ public class MyOpportunity : BaseEntity [Column(TypeName = "varchar(500)")] public string? CommentVerification { get; set; } + [ForeignKey("CommitmentIntervalId")] + public Guid? CommitmentIntervalId { get; set; } + public TimeInterval? CommitmentInterval { get; set; } + + public short? CommitmentIntervalCount { get; set; } + public DateTimeOffset? DateStart { get; set; } public DateTimeOffset? DateEnd { get; set; } @@ -46,6 +54,14 @@ public class MyOpportunity : BaseEntity [Column(TypeName = "decimal(8,2)")] public decimal? YomaReward { get; set; } + public bool? Recommendable { get; set; } + + public byte? StarRating { get; set; } + + //support specials characters like emojis + [Column(TypeName = "varchar(500)")] //MS SQL: nvarchar(500) + public string? Feedback { get; set; } + [Required] public DateTimeOffset DateCreated { get; set; } diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Repositories/MyOpportunityRepository.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Repositories/MyOpportunityRepository.cs index 8f0c68104..d6f14b6cc 100644 --- a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Repositories/MyOpportunityRepository.cs +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Database/MyOpportunity/Repositories/MyOpportunityRepository.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Yoma.Core.Domain.BlobProvider; +using Yoma.Core.Domain.Core; using Yoma.Core.Domain.Core.Interfaces; using Yoma.Core.Domain.Entity; using Yoma.Core.Domain.MyOpportunity; @@ -65,11 +66,17 @@ public MyOpportunityRepository(ApplicationDbContext context) : base(context) { } VerificationStatusId = entity.VerificationStatusId, VerificationStatus = entity.VerificationStatus != null ? Enum.Parse(entity.VerificationStatus.Name, true) : null, CommentVerification = entity.CommentVerification, + CommitmentIntervalId = entity.CommitmentIntervalId, + CommitmentInterval = entity.CommitmentInterval != null ? Enum.Parse(entity.CommitmentInterval.Name, true) : null, + CommitmentIntervalCount = entity.CommitmentIntervalCount, DateStart = entity.DateStart, DateEnd = entity.DateEnd, DateCompleted = entity.DateCompleted, ZltoReward = entity.ZltoReward, YomaReward = entity.YomaReward, + Recommendable = entity.Recommendable, + StarRating = entity.StarRating, + Feedback = entity.Feedback, DateCreated = entity.DateCreated, DateModified = entity.DateModified, Verifications = entity.Verifications == null ? null : includeChildItems ? @@ -108,11 +115,15 @@ public MyOpportunityRepository(ApplicationDbContext context) : base(context) { } ActionId = item.ActionId, VerificationStatusId = item.VerificationStatusId, CommentVerification = item.CommentVerification, + CommitmentIntervalId = item.CommitmentIntervalId, DateStart = item.DateStart, DateEnd = item.DateEnd, DateCompleted = item.DateCompleted, ZltoReward = item.ZltoReward, YomaReward = item.YomaReward, + Recommendable = item.Recommendable, + StarRating = item.StarRating, + Feedback = item.Feedback, DateCreated = item.DateCreated, DateModified = item.DateModified, }; @@ -138,11 +149,16 @@ public MyOpportunityRepository(ApplicationDbContext context) : base(context) { } ActionId = item.ActionId, VerificationStatusId = item.VerificationStatusId, CommentVerification = item.CommentVerification, + CommitmentIntervalId = item.CommitmentIntervalId, + CommitmentIntervalCount = item.CommitmentIntervalCount, DateStart = item.DateStart, DateEnd = item.DateEnd, DateCompleted = item.DateCompleted, ZltoReward = item.ZltoReward, YomaReward = item.YomaReward, + Recommendable = item.Recommendable, + StarRating = item.StarRating, + Feedback = item.Feedback, DateCreated = DateTimeOffset.UtcNow, DateModified = DateTimeOffset.UtcNow, }); @@ -171,11 +187,16 @@ public MyOpportunityRepository(ApplicationDbContext context) : base(context) { } entity.ActionId = item.ActionId; entity.VerificationStatusId = item.VerificationStatusId; entity.CommentVerification = item.CommentVerification; + entity.CommitmentIntervalId = item.CommitmentIntervalId; + entity.CommitmentIntervalCount = item.CommitmentIntervalCount; entity.DateStart = item.DateStart; entity.DateEnd = item.DateEnd; entity.DateCompleted = item.DateCompleted; entity.ZltoReward = item.ZltoReward; entity.YomaReward = item.YomaReward; + entity.Recommendable = item.Recommendable; + entity.StarRating = item.StarRating; + entity.Feedback = item.Feedback; entity.DateModified = item.DateModified; await _context.SaveChangesAsync(); @@ -200,11 +221,16 @@ public MyOpportunityRepository(ApplicationDbContext context) : base(context) { } entity.ActionId = item.ActionId; entity.VerificationStatusId = item.VerificationStatusId; entity.CommentVerification = item.CommentVerification; + entity.CommitmentIntervalId = item.CommitmentIntervalId; + entity.CommitmentIntervalCount = item.CommitmentIntervalCount; entity.DateStart = item.DateStart; entity.DateEnd = item.DateEnd; entity.DateCompleted = item.DateCompleted; entity.ZltoReward = item.ZltoReward; entity.YomaReward = item.YomaReward; + entity.Recommendable = item.Recommendable; + entity.StarRating = item.StarRating; + entity.Feedback = item.Feedback; entity.DateModified = item.DateModified; }