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

Draft workshop management #1602

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

IrynaNakoneshniuk
Copy link
Contributor

Summary of Changes:

  • Added Base Model TrackableBaseEntity:
    Introduced a reusable base model for non-business entities to track changes such as CreatedBy, ModifiedBy, CreatedAt, and
    ModifiedAt.
  • Added WorkshopDraft and TeacherDraft introduced models to store draft data for workshops and teachers
  • Added IWorkshopDraftRepository, added methods Update and Delete to ensure data consistency during concurrent access.
  • Added сustom exceptions EntityDeletedConflictException and EntityModifiedConflictException
  • Added Create method to IWorkshopDraftService

@IrynaNakoneshniuk IrynaNakoneshniuk force-pushed the draft-workshop-management branch from dbe21bd to 32fae6e Compare December 9, 2024 18:20
@AndriyYehorov AndriyYehorov force-pushed the draft-workshop-management branch from 086d918 to 4ecca8f Compare January 2, 2025 13:53
@AndriyYehorov AndriyYehorov marked this pull request as ready for review January 2, 2025 14:02
public class DateTimeRangeDraftDto
{
[JsonConverter(typeof(TimespanConverter))]
public TimeSpan StartTime { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if TimeOnly is relevant type here?
(My main concern against TimeSpan is possibility t have such value as TimeSpan.FromDays(3) i.e., that means nothing for Start/EndTime, I guess)

Copy link

@AndriyYehorov AndriyYehorov Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLevkovskyi Could you please clarify your question?

Copy link
Contributor

@VadymLevkovskyi VadymLevkovskyi Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that DateTimeRangeDraftDto.StartTime field has next range of allowed values: 00:00:00...23:59:59.999. If my assumption is correct - then valid for TimeSpan value (i.e. TimeSpan.FromDays(3)) is not valid from business perspective and thus wrong type is chosen - instead of TimeSpan there should be i.e. TimeOnly. So I've asked @IrynaNakoneshniuk to check if mentioned type is more relevant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, if my assumption is wrong and StartTime could have not only time part but also date part, then property name should be fixed

Copy link

@AndriyYehorov AndriyYehorov Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLevkovskyi Replaced TimeSpan with TimeOnly

public TimeSpan EndTime { get; set; }

[Required]
public List<DaysBitMask> Workdays { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure that DaysBitMask is not sufficient here.
I'm in doubt of List, b/c it makes possible to have 2 Wednesdays i.e.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All duplicate Workdays will be removed during the mapping to the database entity when a workshop is created/updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cool, that they are sanitized somewhere. But my main question is why we have to have to use the wrong type?

Copy link

@AndriyYehorov AndriyYehorov Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced List<> with HashSet<>

@AndriyYehorov AndriyYehorov force-pushed the draft-workshop-management branch from b790b63 to d4d2ca6 Compare January 7, 2025 19:14
Copy link

sonarqubecloud bot commented Jan 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
65.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants