Skip to content

Commit

Permalink
fix(document): add check of documentTypeId (#1275)
Browse files Browse the repository at this point in the history
* add check for documentTypeId to Get-Document-endpoints
* adjust unit-tests
---------
Co-authored-by: Norbert Truchsess <norbert.truchsess@t-online.de>
  • Loading branch information
AnuragNagpure authored Feb 12, 2025
1 parent b0e1084 commit 4c000e5
Show file tree
Hide file tree
Showing 40 changed files with 118 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ private void PostRegistrationCancelEmailAsync(ICollection<EmailData> emailData,
public async Task<(string fileName, byte[] content, string contentType)> GetDocumentAsync(Guid documentId)
{
var document = await portalRepositories.GetInstance<IDocumentRepository>()
.GetDocumentByIdAsync(documentId)
.GetDocumentByIdAsync(documentId, [DocumentTypeId.COMMERCIAL_REGISTER_EXTRACT])
.ConfigureAwait(ConfigureAwaitOptions.None);
if (document == null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/framework/Framework.Async/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Cors/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.DBAccess/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;

public interface IErrorMessageContainer
{
public Type Type { get; }
public IReadOnlyDictionary<int, string> MessageContainer { get; }
Type Type { get; }
IReadOnlyDictionary<int, string> MessageContainer { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Service;

public interface IErrorMessageService
{
public string GetMessage(Type type, int code);
public IEnumerable<ErrorMessageType> GetAllMessageTexts();
public record ErrorMessageType(string ErrorType, IEnumerable<ErrorMessageCode> ErrorMessages);
public record ErrorMessageCode(string ErrorCode, string Message);
string GetMessage(Type type, int code);
IEnumerable<ErrorMessageType> GetAllMessageTexts();
record ErrorMessageType(string ErrorType, IEnumerable<ErrorMessageCode> ErrorMessages);
record ErrorMessageCode(string ErrorCode, string Message);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.IO/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Identity/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Linq/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Logging/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Models/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ public interface IProcessIdentityDataDetermination
/// <summary>
/// Initialize IdentityData
/// </summary>
public Task GetIdentityData();
Task GetIdentityData();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Seeding/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Swagger/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Token/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Web/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic;

public interface IRealmUpdater
{
public Task UpdateRealm(string keycloakInstanceName, CancellationToken cancellationToken);
Task UpdateRealm(string keycloakInstanceName, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public interface IAppChangeBusinessLogic
/// Deactivate Offer Status by appId
/// </summary>
/// <param name="appId">Id of the app</param>
public Task DeactivateOfferByAppIdAsync(Guid appId);
Task DeactivateOfferByAppIdAsync(Guid appId);

/// <summary>
/// Updates the url of the subscription
Expand Down
24 changes: 12 additions & 12 deletions src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,39 @@ public interface IAppsBusinessLogic
/// </summary>
/// <param name="languageShortName">Optional two character language specifier for the app description. No description if not provided.</param>
/// <returns>List of active marketplace apps.</returns>
public IAsyncEnumerable<AppData> GetAllActiveAppsAsync(string? languageShortName);
IAsyncEnumerable<AppData> GetAllActiveAppsAsync(string? languageShortName);

/// <summary>
/// Get all apps that a user has been assigned roles in.
/// </summary>
/// <returns>List of available apps for user.</returns>
public IAsyncEnumerable<BusinessAppData> GetAllUserUserBusinessAppsAsync();
IAsyncEnumerable<BusinessAppData> GetAllUserUserBusinessAppsAsync();

/// <summary>
/// Get detailed application data for a single app by id.
/// </summary>
/// <param name="appId">Persistence ID of the application to be retrieved.</param>
/// <param name="languageShortName">Optional two character language specifier for the localization of the app description. No description if not provided.</param>
/// <returns>AppDetailsViewModel of the requested application.</returns>
public Task<AppDetailResponse> GetAppDetailsByIdAsync(Guid appId, string? languageShortName = null);
Task<AppDetailResponse> GetAppDetailsByIdAsync(Guid appId, string? languageShortName = null);

/// <summary>
/// Get IDs of all favourite apps of the user by ID.
/// </summary>
/// <returns>List of IDs of user's favourite apps.</returns>
public IAsyncEnumerable<Guid> GetAllFavouriteAppsForUserAsync();
IAsyncEnumerable<Guid> GetAllFavouriteAppsForUserAsync();

/// <summary>
/// Adds an app to a user's favourites.
/// </summary>
/// <param name="appId">ID of the app to add to user's favourites.</param>
public Task AddFavouriteAppForUserAsync(Guid appId);
Task AddFavouriteAppForUserAsync(Guid appId);

/// <summary>
/// Removes an app from a user's favourites.
/// </summary>
/// <param name="appId">ID of the app to remove from user's favourites.</param>
public Task RemoveFavouriteAppForUserAsync(Guid appId);
Task RemoveFavouriteAppForUserAsync(Guid appId);

/// <summary>
/// Retrieves subscription statuses of subscribed apps of the provided user's company.
Expand All @@ -78,7 +78,7 @@ public interface IAppsBusinessLogic
/// <param name="statusId"></param>
/// <param name="name"></param>
/// <returns>Returns the details of the subscription status for App user</returns>
public Task<Pagination.Response<OfferSubscriptionStatusDetailData>> GetCompanySubscribedAppSubscriptionStatusesForUserAsync(int page, int size, OfferSubscriptionStatusId? statusId, string? name);
Task<Pagination.Response<OfferSubscriptionStatusDetailData>> GetCompanySubscribedAppSubscriptionStatusesForUserAsync(int page, int size, OfferSubscriptionStatusId? statusId, string? name);

/// <summary>
/// Retrieves subscription statuses of provided apps of the provided user's company.
Expand All @@ -90,32 +90,32 @@ public interface IAppsBusinessLogic
/// <param name="offerId"></param>
/// <param name="companyName"></param>
/// <returns>Async enumberable of user's company's provided apps' statuses.</returns>
public Task<Pagination.Response<OfferCompanySubscriptionStatusResponse>> GetCompanyProvidedAppSubscriptionStatusesForUserAsync(int page, int size, SubscriptionStatusSorting? sorting, OfferSubscriptionStatusId? statusId, Guid? offerId, string? companyName);
Task<Pagination.Response<OfferCompanySubscriptionStatusResponse>> GetCompanyProvidedAppSubscriptionStatusesForUserAsync(int page, int size, SubscriptionStatusSorting? sorting, OfferSubscriptionStatusId? statusId, Guid? offerId, string? companyName);

/// <summary>
/// Adds a subscription relation between an application and a user's company.
/// </summary>
/// <param name="appId">ID of the app to subscribe to.</param>
/// <param name="offerAgreementConsentData">The agreement consent data</param>
public Task<Guid> AddOwnCompanyAppSubscriptionAsync(Guid appId, IEnumerable<OfferAgreementConsentData> offerAgreementConsentData);
Task<Guid> AddOwnCompanyAppSubscriptionAsync(Guid appId, IEnumerable<OfferAgreementConsentData> offerAgreementConsentData);

/// <summary>
/// Declines a pending app subscription of an app, provided by the current user's company.
/// </summary>
/// <param name="subscriptionId">ID of the pending app to be declined.</param>
public Task DeclineAppSubscriptionAsync(Guid subscriptionId);
Task DeclineAppSubscriptionAsync(Guid subscriptionId);

/// <summary>
/// Activates a pending app subscription for an app provided by the current user's company.
/// </summary>
/// <param name="subscriptionId">ID of the pending app to be activated.</param>
public Task TriggerActivateOfferSubscription(Guid subscriptionId);
Task TriggerActivateOfferSubscription(Guid subscriptionId);

/// <summary>
/// Unsubscribes an app for the current users company.
/// </summary>
/// <param name="subscriptionId">ID of the subscription to unsubscribe from.</param>
public Task UnsubscribeOwnCompanyAppSubscriptionAsync(Guid subscriptionId);
Task UnsubscribeOwnCompanyAppSubscriptionAsync(Guid subscriptionId);

/// <summary>
/// Retrieve Company Owned App Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface IServiceBusinessLogic
/// Declines a pending service subscription of a service, provided by the current user's company.
/// </summary>
/// <param name="subscriptionId">ID of the pending service to be declined.</param>
public Task DeclineServiceSubscriptionAsync(Guid subscriptionId);
Task DeclineServiceSubscriptionAsync(Guid subscriptionId);

/// <summary>
/// Gets the service detail data for the given service
Expand Down Expand Up @@ -154,12 +154,12 @@ public interface IServiceBusinessLogic
/// Unsubscribes an Service for the current users company.
/// </summary>
/// <param name="subscriptionId">ID of the subscription to unsubscribe from.</param>
public Task UnsubscribeOwnCompanyServiceSubscriptionAsync(Guid subscriptionId);
Task UnsubscribeOwnCompanyServiceSubscriptionAsync(Guid subscriptionId);

/// <summary>
/// Activates a pending service subscription for an service provided by the current user's company.
/// </summary>
/// <param name="subscriptionId">ID of the pending service to be activated.</param>
public Task TriggerActivateOfferSubscription(Guid subscriptionId);
Task TriggerActivateOfferSubscription(Guid subscriptionId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public interface IServiceChangeBusinessLogic
/// Deactivate Offer Status by serviceId
/// </summary>
/// <param name="serviceId">Id of the service</param>
public Task DeactivateOfferByServiceIdAsync(Guid serviceId);
Task DeactivateOfferByServiceIdAsync(Guid serviceId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ public void RemoveDocument(Guid documentId) =>
dbContext.Documents.Remove(new Document(documentId, null!, null!, null!, default, default, default, default, default));

/// <inheritdoc />
public Task<Document?> GetDocumentByIdAsync(Guid documentId) =>
dbContext.Documents.SingleOrDefaultAsync(x => x.Id == documentId);
public Task<Document?> GetDocumentByIdAsync(Guid documentId, IEnumerable<DocumentTypeId> documentTypeIds) =>
dbContext.Documents
.Where(x => x.Id == documentId && documentTypeIds.Contains(x.DocumentTypeId))
.SingleOrDefaultAsync();

/// <inheritdoc />
public Task<(Guid DocumentId, DocumentStatusId DocumentStatusId, bool IsSameApplicationUser, DocumentTypeId documentTypeId, bool IsQueriedApplicationStatus, IEnumerable<Guid> applicationId)> GetDocumentDetailsForApplicationUntrackedAsync(Guid documentId, Guid userCompanyId, IEnumerable<CompanyApplicationStatusId> applicationStatusIds) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface IConnectorsRepository
/// <returns>Pagination.Source of connectors that allows transformation.</returns>
Func<int, int, Task<Pagination.Source<ManagedConnectorData>?>> GetManagedConnectorsForCompany(Guid companyId);

public Task<(ConnectorData ConnectorData, bool IsProvidingOrHostCompany)> GetConnectorByIdForCompany(Guid connectorId, Guid companyId);
Task<(ConnectorData ConnectorData, bool IsProvidingOrHostCompany)> GetConnectorByIdForCompany(Guid connectorId, Guid companyId);

Task<(ConnectorInformationData ConnectorInformationData, bool IsProviderUser)> GetConnectorInformationByIdForIamUser(Guid connectorId, Guid userCompanyId);

Expand Down
Loading

0 comments on commit 4c000e5

Please sign in to comment.