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

VCST-2357: Add OrganizationId #129

Merged
merged 8 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -14,6 +14,7 @@ public class QuoteRequestSearchCriteria : SearchCriteriaBase
public string NumberKeyword { get; set; }

public string CustomerId { get; set; }
public string[] OrganizationIds { get; set; }
artem-dudarev marked this conversation as resolved.
Show resolved Hide resolved
public string StoreId { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ protected virtual IQueryable<QuoteRequestEntity> BuildQuery(IQuoteRepository rep
query = query.Where(x => x.CustomerId == criteria.CustomerId);
}

if (!criteria.OrganizationIds.IsNullOrEmpty())
{
query = query.Where(x => criteria.OrganizationIds.Contains(x.OrganizationId));
}

if (criteria.StoreId != null)
{
query = query.Where(x => x.StoreId == criteria.StoreId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using System.Collections.Generic;
using GraphQL;
using GraphQL.Types;
using VirtoCommerce.Xapi.Core.BaseQueries;
using VirtoCommerce.QuoteModule.ExperienceApi.Aggregates;
using VirtoCommerce.Xapi.Core.BaseQueries;

namespace VirtoCommerce.QuoteModule.ExperienceApi.Queries;

public class QuotesQuery : SearchQuery<QuoteAggregateSearchResult>
{
public string StoreId { get; set; }
public string UserId { get; set; }
public string OrganizationId { get; set; }
public string CurrencyCode { get; set; }
public string CultureName { get; set; }
public string Filter { get; set; }
Expand All @@ -26,6 +27,7 @@ public override IEnumerable<QueryArgument> GetArguments()
yield return Argument<StringGraphType>(nameof(CurrencyCode));
yield return Argument<StringGraphType>(nameof(CultureName));
yield return Argument<StringGraphType>(nameof(Filter));
yield return Argument<StringGraphType>(nameof(OrganizationId));
}

public override void Map(IResolveFieldContext context)
Expand All @@ -37,5 +39,6 @@ public override void Map(IResolveFieldContext context)
CurrencyCode = context.GetArgument<string>(nameof(CurrencyCode));
CultureName = context.GetArgument<string>(nameof(CultureName));
Filter = context.GetArgument<string>(nameof(Filter));
OrganizationId = context.GetArgument<string>(nameof(OrganizationId));
artem-dudarev marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using VirtoCommerce.Xapi.Core.Index;
using VirtoCommerce.Xapi.Core.Infrastructure;
using VirtoCommerce.Platform.Core.Common;
using VirtoCommerce.QuoteModule.Core.Models;
using VirtoCommerce.QuoteModule.Core.Services;
using VirtoCommerce.QuoteModule.ExperienceApi.Aggregates;
using VirtoCommerce.SearchModule.Core.Model;
using VirtoCommerce.SearchModule.Core.Services;
using VirtoCommerce.Xapi.Core.Index;
using VirtoCommerce.Xapi.Core.Infrastructure;

namespace VirtoCommerce.QuoteModule.ExperienceApi.Queries;

Expand Down Expand Up @@ -48,6 +48,7 @@ protected virtual QuoteRequestSearchCriteria GetSearchCriteria(QuotesQuery reque
criteria.CustomerId = request.UserId;
criteria.Currency = request.CurrencyCode;
criteria.LanguageCode = request.CultureName;
criteria.OrganizationIds = [request.OrganizationId];

// parse Filter argument
if (string.IsNullOrEmpty(request.Filter))
Expand Down
Loading