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

Update workshop export #1619

merged 3 commits into from
Dec 24, 2024

Conversation

DmyMi
Copy link
Contributor

@DmyMi DmyMi commented Dec 23, 2024

  • Updated Workshop entity to include stub of future dictionaries as enums.
  • Refactored naming of some fields to better reflect requirements
  • Refactored workshop export as separate API method due to its new hierarchical structure.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@DmyMi DmyMi merged commit 438dae0 into develop Dec 24, 2024
4 of 5 checks passed
@DmyMi DmyMi deleted the dmin/update_workshop_export branch December 24, 2024 10:33
Comment on lines +1136 to +1142
if (dto.ParentWorkshopId.HasValue && !await Exists((Guid)dto.ParentWorkshopId).ConfigureAwait(false))
{
var errorMessage = $"The main workshop (with id = {dto.MemberOfWorkshopId}) for the workshop being created was not found.";
var errorMessage = $"The main workshop (with id = {dto.ParentWorkshopId}) for the workshop being created was not found.";
throw new InvalidOperationException(errorMessage);
}

if (dto.MemberOfWorkshopId.HasValue && (await workshopRepository.GetById((Guid)dto.MemberOfWorkshopId).ConfigureAwait(false)).MemberOfWorkshopId.HasValue)
if (dto.ParentWorkshopId.HasValue && (await workshopRepository.GetById((Guid)dto.ParentWorkshopId).ConfigureAwait(false)).ParentWorkshopId.HasValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

Call to Exists() followed by GetById(). Could there be better iplementation from performance perspective?

{
try
{
logger.LogInformation("Getting all updated providers started");
Copy link
Contributor

Choose a reason for hiding this comment

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

LogTrace/Debug maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for other methods

Comment on lines +43 to +47
if (providers == null)
{
logger.LogError("Failed to retrieve updated providers. The provider list is null");
return new SearchResult<ProviderInfoBaseDto>();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious if it is ever a case? Do your repositories return null instead of empty list sometimes?

[JsonConverter(typeof(JsonStringEnumConverter))]
public enum WorkshopType
{
None
Copy link
Contributor

Choose a reason for hiding this comment

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

Some TODO comment should be present here, otherwise this enum looks pretty simple


public uint SpecialNeedsId { get; set; } = 0;
public SpecialNeedsType SpecialNeedsType { get; set; } = SpecialNeedsType.None;
Copy link
Contributor

Choose a reason for hiding this comment

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

Curios, why this and other enum property is not covered with EnumType attribute, as it was in Dto classes

Comment on lines +104 to +106
query = updatedAfter == default
? query.Where(workshop => !workshop.IsDeleted)
: query.Where(workshop => workshop.UpdatedAt > updatedAfter || workshop.DeleteDate > updatedAfter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logic doesn't correspond name. Could either be changed?

return query.Skip(from).Take(size).ToListAsync();
}

public Task<int> CountWithDeleted(DateTime updatedAfter)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same name vs logic issue. WithDeleted in name but !workshop.IsDeleted in logic

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.

2 participants