Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workshop export #1619

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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

namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class AddressInfoDto
{
public long Id { get; set; }

[Required(ErrorMessage = "Street is required")]
[MaxLength(60)]
public string Street { get; set; } = string.Empty;

[Required(ErrorMessage = "Building number is required")]
[MaxLength(15)]
public string BuildingNumber { get; set; } = string.Empty;

public CodeficatorAddressInfoDto CodeficatorAddressDto { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class CodeficatorAddressInfoDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace OutOfSchool.BusinessLogic.Models.Exported;

public interface IExternalInfo<TKey>
{
public TKey Id { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace OutOfSchool.BusinessLogic.Models.Exported;

public interface IExternalRatingInfo : IExternalInfo<Guid>
{
float Rating { get; set; }

int NumberOfRatings { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

using System.Text.Json.Serialization;

namespace OutOfSchool.BusinessLogic.Models.Exported;

[JsonDerivedType(typeof(ProviderInfoDto))]
public class ProviderInfoBaseDto : IExternalInfo<Guid>
{
public Guid Id { get; set; }

public bool IsDeleted { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using OutOfSchool.BusinessLogic.Models.SubordinationStructure;
using OutOfSchool.BusinessLogic.Util.JsonTools;
using OutOfSchool.Common.Enums;
using OutOfSchool.Common.Models;
using OutOfSchool.Common.Validators;
using OutOfSchool.Services.Enums;

namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class ProviderInfoDto : ProviderInfoBaseDto, IHasRating
public class ProviderInfoDto : ProviderInfoBaseDto, IExternalRatingInfo
{
[Required]
[EnumDataType(typeof(OwnershipType), ErrorMessage = Constants.EnumErrorMessage)]
Expand All @@ -26,6 +23,14 @@ public class ProviderInfoDto : ProviderInfoBaseDto, IHasRating
[MaxLength(60)]
[MinLength(1)]
public string ShortTitle { get; set; }

[DataType(DataType.Text)]
[MaxLength(Constants.MaxProviderFullTitleLength)]
public string FullTitleEn { get; set; } = string.Empty;

[DataType(DataType.Text)]
[MaxLength(Constants.MaxProviderShortTitleLength)]
public string ShortTitleEn { get; set; } = string.Empty;

[DataType(DataType.Url)]
[MaxLength(Constants.MaxUnifiedUrlLength)]
Expand Down Expand Up @@ -55,10 +60,6 @@ public class ProviderInfoDto : ProviderInfoBaseDto, IHasRating
[Required(ErrorMessage = "The name of the director is required")]
public string Director { get; set; } = string.Empty;

[DataType(DataType.Date)]
[Required(ErrorMessage = "The date of birth is required")]
public DateTime? DirectorDateOfBirth { get; set; } = default;

[DataType(DataType.PhoneNumber)]
[CustomPhoneNumber(ErrorMessage = Constants.PhoneErrorMessage)]
[DisplayFormat(DataFormatString = Constants.PhoneNumberFormat)]
Expand All @@ -75,8 +76,10 @@ public class ProviderInfoDto : ProviderInfoBaseDto, IHasRating
[EnumDataType(typeof(ProviderStatus), ErrorMessage = Constants.EnumErrorMessage)]
public ProviderStatus Status { get; set; } = ProviderStatus.Pending;

[EnumDataType(typeof(ProviderLicenseStatus), ErrorMessage = Constants.EnumErrorMessage)]
public ProviderLicenseStatus LicenseStatus { get; set; }
[MaxLength(256)]
public string CoverImageId { get; set; } = string.Empty;

public IList<string> ImageIds { get; set; }

public bool IsBlocked { get; set; }

Expand All @@ -94,6 +97,5 @@ public class ProviderInfoDto : ProviderInfoBaseDto, IHasRating
[EnumDataType(typeof(InstitutionType), ErrorMessage = Constants.EnumErrorMessage)]
public InstitutionType InstitutionType { get; set; }

[ModelBinder(BinderType = typeof(JsonModelBinder))]
public IEnumerable<ProviderSectionItemInfoDto> ProviderSectionItems { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.ComponentModel.DataAnnotations;

namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class ProviderSectionItemInfoDto
{
public Guid Id { get; set; }

[MaxLength(200)]
public string SectionName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using OutOfSchool.Services.Enums;

namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class TeacherInfoDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;

namespace OutOfSchool.BusinessLogic.Models.Exported;

public class WorkshopDescriptionItemInfo
{
[MaxLength(200)]
public string SectionName { get; set; }

[MaxLength(2000)]
public string Description { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;

namespace OutOfSchool.BusinessLogic.Models.Exported;

[JsonDerivedType(typeof(WorkshopInfoDto))]
public class WorkshopInfoBaseDto : IExternalInfo<Guid>
{
public Guid Id { get; set; }

public bool IsDeleted { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Mvc;
using OutOfSchool.BusinessLogic.Models.Workshops;
using OutOfSchool.BusinessLogic.Util.CustomValidation;
using OutOfSchool.BusinessLogic.Util.JsonTools;
using OutOfSchool.Common.Enums;
using OutOfSchool.Common.Models;
using OutOfSchool.Common.Enums.Workshop;
using OutOfSchool.Common.Validators;

namespace OutOfSchool.BusinessLogic.Models.ProvidersInfo;
namespace OutOfSchool.BusinessLogic.Models.Exported;

public class WorkshopInfoDto : WorkshopInfoBaseDto, IHasRating
public class WorkshopInfoDto : WorkshopInfoBaseDto, IExternalRatingInfo
{
public Guid ProviderId { get; set; }

public Guid? ParentWorkshopId { get; set; }

public uint TakenSeats { get; set; } = 0;

public float Rating { get; set; }
Expand All @@ -26,6 +26,11 @@ public class WorkshopInfoDto : WorkshopInfoBaseDto, IHasRating
[MaxLength(60)]
public string Title { get; set; } = string.Empty;

[Required(ErrorMessage = "Workshop short title is required")]
[MinLength(Constants.MinWorkshopShortTitleLength)]
[MaxLength(Constants.MaxWorkshopShortTitleLength)]
public string ShortTitle { get; set; } = string.Empty;

[DataType(DataType.PhoneNumber)]
[Required(ErrorMessage = "Phone number is required")]
[CustomPhoneNumber(ErrorMessage = Constants.PhoneErrorMessage)]
Expand Down Expand Up @@ -58,46 +63,97 @@ public class WorkshopInfoDto : WorkshopInfoBaseDto, IHasRating
public int MaxAge { get; set; }

[Required]
[ModelBinder(BinderType = typeof(JsonModelBinder))]
public List<DateTimeRangeDto> DateTimeRanges { get; set; }

[Column(TypeName = "decimal(18,2)")]
public bool IsPaid { get; set; } = false;

[Range(0, 100000, ErrorMessage = "Field value should be in a range from 1 to 100 000")]
public decimal? Price { get; set; } = default;

[EnumDataType(typeof(PayRateType), ErrorMessage = Constants.EnumErrorMessage)]
public PayRateType? PayRate { get; set; } = PayRateType.Classes;

[Required(ErrorMessage = "Form of learning is required")]
[EnumDataType(typeof(FormOfLearning), ErrorMessage = Constants.EnumErrorMessage)]
public FormOfLearning FormOfLearning { get; set; }

public uint AvailableSeats { get; set; } = uint.MaxValue;

public bool CompetitiveSelection { get; set; }

[ModelBinder(BinderType = typeof(JsonModelBinder))]
[MaxLength(500)]
public string CompetitiveSelectionDescription { get; set; }

[CollectionNotEmpty(ErrorMessage = "At least one description is required")]
public IEnumerable<WorkshopDescriptionItemDto> WorkshopDescriptionItems { get; set; }
public IEnumerable<WorkshopDescriptionItemInfo> WorkshopDescriptionItems { get; set; }

public bool WithDisabilityOptions { get; set; } = default;

[MaxLength(200)]
public string DisabilityOptionsDesc { get; set; } = string.Empty;

public Guid? InstitutionId { get; set; }

public string Institution { get; set; }

public Guid? InstitutionHierarchyId { get; set; }

public string InstitutionHierarchy { get; set; }

public List<long> DirectionIds { get; set; }
public TeacherInfoDto DefaultTeacher { get; set; }

public List<string> Directions { get; set; }

[ModelBinder(BinderType = typeof(JsonModelBinder))]
public IEnumerable<string> Keywords { get; set; } = default;

[Required]
[ModelBinder(BinderType = typeof(JsonModelBinder))]
public AddressInfoDto Address { get; set; }

public List<TeacherInfoDto> Teachers { get; set; }

}
public DateOnly ActiveFrom { get; set; }

public DateOnly ActiveTo { get; set; }

public bool ShortStay { get; set; } = false;

public bool IsSelfFinanced { get; set; } = false;

public bool IsSpecial { get; set; } = false;

public bool IsInclusive { get; set; } = false;

[Required(ErrorMessage = "Workshop type is required")]
[EnumDataType(typeof(WorkshopType), ErrorMessage = Constants.EnumErrorMessage)]
public WorkshopType WorkshopType { get; set; }

[EnumDataType(typeof(SpecialNeedsType), ErrorMessage = Constants.EnumErrorMessage)]
public SpecialNeedsType SpecialNeedsType { get; set; } = SpecialNeedsType.None;

// TODO: Need to implement
public string LanguageOfEducation { get; set; } = "українська";

[MaxLength(256)]
public string CoverImageId { get; set; } = string.Empty;

public IList<string> ImageIds { get; set; }

public List<string> Tags { get; set; }

public Guid? DefaultTeacherId { get; set; }

[MaxLength(500)]
public string EnrollmentProcedureDescription { get; set; }

public bool AreThereBenefits { get; set; } = default;

[MaxLength(500)]
public string PreferentialTermsOfParticipation { get; set; }

[Required]
[EnumDataType(typeof(EducationalShift), ErrorMessage = Constants.EnumErrorMessage)]
public EducationalShift EducationalShift { get; set; } = EducationalShift.First;

[Required(ErrorMessage = "Type of age composition is required")]
[EnumDataType(typeof(AgeComposition), ErrorMessage = Constants.EnumErrorMessage)]
public AgeComposition AgeComposition { get; set; } = AgeComposition.SameAge;

[EnumDataType(typeof(Coverage), ErrorMessage = Constants.EnumErrorMessage)]
public Coverage Coverage { get; set; } = Coverage.School;
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using OutOfSchool.BusinessLogic.Util.CustomValidation;
using OutOfSchool.BusinessLogic.Util.JsonTools;
using OutOfSchool.Common.Enums.Workshop;

namespace OutOfSchool.BusinessLogic.Models.Workshops.Drafts;

Expand All @@ -26,14 +27,15 @@ public class WorkshopDescriptionDto : WorkshopRequiredPropertiesDto
public IEnumerable<string> Keywords { get; set; } = default;

[MaxLength(500)]
public string AdditionalDescription { get; set; }
public string EnrollmentProcedureDescription { get; set; }

public bool AreThereBenefits { get; set; } = default;

[MaxLength(500)]
public string PreferentialTermsOfParticipation { get; set; }

public uint CoverageId { get; set; } = 0;
[EnumDataType(typeof(Coverage), ErrorMessage = Constants.EnumErrorMessage)]
public Coverage Coverage { get; set; } = Coverage.School;

[ModelBinder(BinderType = typeof(JsonModelBinder))]
public List<long> TagIds { get; set; } = [];
Expand Down
Loading
Loading