Starts in:
1 DAY
12 HRS
48 MIN
8 SEC
Starts in:
1 D
12 H
48 M
8 S

Activities of "falsharif"

Hi Team, How Can you i override the default behavior for handling exceptions and displaying the blazorise Dialog that is currently implemented by default in the blazor Project ? I am trying to display my own design for the Dialog that is displayed on backend exceptions

  • ABP Framework version: v5.0
  • UI type: / Blazor
  • DB provider: EF Core /
  • Tiered (MVC) or Identity Server Separated (Angular): / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • **ABP Framework version:**v5.0.0
  • UI type: Blazor
  • DB provider: EF Core /
  • Tiered (MVC) or Identity Server Separated (Angular): / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Dear Support team, Is there a blank blazor template that i can use in which i can exclude the blazorize template, create my own login page and still be able to use the generated application services directly into it without having to depend on the identity login page ? I can still use the original template to do tenant management and all of that but i am looking for a clean template that i can use without the blazorize bloatware The issue that i am having right now , is that i am trying to use Mudblazor with the new .net 6 blazor template but iam runinng into alot of UI issues. I would love to be able to create my own login page and have the token in the header of every api call without having to use the existing template that comes with ABP suite. Do you have any solutions or ideas ?

Question

HI Team, first of all thanks for always being prompt on answering my questions.

This is a bit of a noob question but i would appreciate your help.

I am integrating with a delivery company to process my orders and ive created this appservice with an endpoint for the delivery company to call when they change status of my order :

public class SwftBoxAppService : DukkantekAppService, ISwftBoxAppService
{
    private readonly IRequestsManager _requestsManager;
    private readonly IRequestRepository _requestRepository;
    private readonly IDataFilter _dataFilter;

    public SwftBoxAppService(IRequestsManager requestsManager, IRequestRepository requestRepository,
        IDataFilter dataFilter)
    {
        _requestsManager = requestsManager;
        _requestRepository = requestRepository;
        _dataFilter = dataFilter;
    }

    [HttpPost]
    public async Task Update(SwftBoxWebhookInput input)
    {
        using (_dataFilter.Disable<IMultiTenant>())
        {
            var request =
                (await _requestRepository.GetQueryForNavigationPropertiesAsync()).SingleOrDefault(c =>
                    c.Request.RequestNumber == input.merchant_order_id);
            if (request == null)
            {
                throw new UserFriendlyException("Could not find this request");
            }

            await _requestsManager.UpdateSwftBoxWebhook(request, input);
        }
    }

My question is , how do i secure this enpoint for them to use.

shall i be creating a new client for them in identity clients ? How do i give them an API KEY or something to access that endpooint ??

Answer

Hey Albert, appreciate your help and willininges to help me, you are right , this was more of an EFCORE problem, here is how i managed to do it :

public virtual async Task<IQueryable<ShopWithNavigationProperties>> GetQueryForNavigationPropertiesAsync() {

        var query = from shop in (await GetDbSetAsync()).DefaultIfEmpty()
            join invoice in (await GetDbContextAsync()).Invoices.DefaultIfEmpty() on shop.Id equals invoice.TenantId into invoices
            from invoice in invoices.DefaultIfEmpty()
            group invoice by new { shop.Id, shop.StoreName, shop.Name,
                shop.IsOnlineStoreEnabled, shop.ImgUrl, 
                shop.Latitude,shop.Longitude,shop.OpeningHour, 
                shop.ClosingHour,shop.DeliveryProximity } into g
            select new  ShopWithNavigationProperties
            {
                Id = g.Key.Id,
                StoreName = g.Key.StoreName, 
                Name = g.Key.Name,
                IsOnlineStoreEnabled = g.Key.IsOnlineStoreEnabled,
                Longitude = g.Key.Longitude,
                Latitude = g.Key.Latitude,
                ClosingHour = g.Key.ClosingHour,
                OpeningHour = g.Key.OpeningHour,
                DeliveryProximity = g.Key.DeliveryProximity,
                ImgUrl = g.Key.ImgUrl,
                TotalOrders = g.Count() , 
                TotalTransactions= g.Sum(c=>c.GrandTotal)
            } into shops
            orderby shops.TotalTransactions descending 
            select shops;;

     
        return query;

        


    }
Answer

to disable tenant filter use ( https://docs.abp.io/en/abp/latest/Data-Filtering )

 using (_dataFilter.Disable<IMultiTenant>()) 
{ 
    return await _bookRepository.GetListAsync(); 
} 

and as I understand you created Shop entity via Suite. If so you can write an overload method for GetListWithNavigationPropertiesAsync so that you can pass null values to MaxResultCount and SkipCount

Shop Entity is the equivleant of Tenant Like the way AppUser Extends Identity User

I know about disable the multitenant filter , but that is not my question here. .

How do i show a table where i can display for each tenant , the total transactions like the screenshot below .

Invoices is an AUDITEDAGGREGATEROOT and so is TENANT

so how can i do one to many between tenant and Invoice to display sums like this :

Question

ABP 4.2 .net 5

so i extended tenant entity and added few more fields to it. Its now named Shop this is a single database with more than 200 tenenats , i am trying to display a grid that shows each tenant and Total Transactions done by them .

SHOP TOTAL TRANSACTIONS TOTAL ORDERS

Ravenmart 1222 USD 55

My Invoice entity : <br>

public class Invoice : FullAuditedAggregateRoot, IMultiTenant
{
    public Invoice(Guid id, Guid? tenantId, bool isWalkIn, PaymentTypeEnums paymentTypeId,
    InvoiceTypeEnum invoiceTypeId) : base(id)
    {
        TenantId = tenantId;
        Total = new decimal(2);
        Vat = new decimal(2);
        InvoiceNumber = AnGenerator.RandomString(5);
        IsWalkIn = isWalkIn;
        PaymentTypeId = paymentTypeId;
        InvoiceTypeId = invoiceTypeId;
        InvoiceStatusId = InvoiceStatusEnum.Unpaid;
        InvoiceStatusName = Enum.GetName(InvoiceStatusEnum.Unpaid);
    }

 public Guid? TenantId { get; }
 
 
 + some other fields

This is my Shop Repository : <br>

public class ShopRepository : EfCoreRepository<DukkantekDbContext, Shop, Guid>, IShopRepository
{
    public ShopRepository(IDbContextProvider dbContextProvider)
    : base(dbContextProvider)
    {
    }
    public async Task<List<ShopWithNavigationProperties>> GetListWithNavigationPropertiesAsync(
        bool isOnlineStoreEnabled,
        string filter,
        string sorting = null,
        int maxResultCount = int.MaxValue,
        int skipCount = 0, CancellationToken cancellationToken = default)
    {
        var query = await GetQueryForNavigationPropertiesAsync();
        query = ApplyFilter(query, filter,isOnlineStoreEnabled);

        return await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken);
    }

    public async Task<long> GetCountAsync(
        bool isOnlineStoreEnabled,
        string filter,
        string sorting = null,
        CancellationToken cancellationToken = default)
    {
        var query = ApplyFilter((await GetQueryForNavigationPropertiesAsync()), filter,isOnlineStoreEnabled );
        return await query.LongCountAsync(GetCancellationToken(cancellationToken));

    }

    protected virtual IQueryable<ShopWithNavigationProperties> ApplyFilter(
        IQueryable<ShopWithNavigationProperties> query,
        string filter,
        bool isOnlineStoreEnabled
    )
    {
        return query
            .WhereIf(isOnlineStoreEnabled is true, u => u.Shop.IsOnlineStoreEnabled == true)
            .WhereIf(isOnlineStoreEnabled is false, u => u.Shop.IsOnlineStoreEnabled == false)
            .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.Shop.StoreName.Contains(filter));
    }

    public virtual async Task<IQueryable<ShopWithNavigationProperties>> GetQueryForNavigationPropertiesAsync()
    {

        return from shop in (await GetDbSetAsync())
            join invoice in (await GetDbContextAsync()).Invoices.DefaultIfEmpty() on shop.Id equals invoice.TenantId into invoices
            from invoice in invoices.DefaultIfEmpty()

            select new ShopWithNavigationProperties()
            {
                Shop = shop,
                Invoice = invoice,
            };
    }
}

Heres my issues : in my ShopAppservice , i have the following code : <br>

public async Task<PagedResultDto> GetAllWithDetails(GetShopsInput input)
{
    using (_dataFilter.Disable())
    {
        var shopst = (await _shopRepository.GetListWithNavigationPropertiesAsync(input.IsOnlineStoreEnabled,
        input.Filter, input.Sorting, input.MaxResultCount, input.SkipCount)).ToList();
        var shops = shopst
                    .GroupBy(s => s.Shop.Id, (c, i) =>
        {
            var shopWithNavigationPropertiesList = i.ToList();
            return new ShopWithNavigationPropertiesDto()
            {
                Shop = ObjectMapper.Map<Shop, AppTenantDto>(shopWithNavigationPropertiesList.First().Shop),
                TotalOrders = shopWithNavigationPropertiesList.Select(t => t.Request)
                        ?.Count(p => p is {RequestStatusId: RequestStatusEnum.Completed}),
                TotalTransactions = shopWithNavigationPropertiesList.Select(t => t.Invoice).ToList()
            ?.Where(p => p is {InvoiceStatusId: InvoiceStatusEnum.Paid}).Sum(g => g.GrandTotal),
            };
        }).ToList();
        return new PagedResultDto<ShopWithNavigationPropertiesDto>(
                await _shopRepository.GetCountAsync(), shops);
        }
    }

This is not working properly for me as MAXresultcount limits the total records and i end up with wrong values.

How can i show each shop and the total for his invoices knowing that each invoice has a tenantID ?

please please help as i really dont understand how to work around this DDD issue

Edited for better readability.

  • ABP Framework version: v4.3
  • UI type: / Blazor
  • DB provider: EF Core /
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

hello, i have a products entity , each product can have a product category and product subcategory. in some situations, the product exists in the tenant but the category and sub category only in the host.

i created a custom repository where i have this code where i implemenet datafilter to get host product categories and sub categories :

this unfortunately doesnt work and keeps returning null values for the product category and subcategory. i checked the response in GetHostProductCategories() function and shows the data there if do a .ToList().

I am tring to eventually achieve functionality where if the product category is not in this tenant, then we get it from host..

PS: BOTH TENANT AND HOST ARE IN THE SAME DATABASE

    public virtual async Task&lt;IQueryable&lt;ProductWithNavigationProperties&gt;> GetQueryForNavigationPropertiesAsync(
        Guid? tenantId=null)
    {
       
            var products = (await GetDbSetAsync());
            
            return from product in (products)
                join productCategory in await GetHostProductCategories()
                    on product.ProductCategoryId equals productCategory.Id into productCategories
                from productCategory in productCategories.DefaultIfEmpty()
                join productSubCategory in await GetHostProductSubCategories()
                    on product.ProductSubCategoryId equals productSubCategory.Id into productSubCategories
                from productSubCategory in productSubCategories.DefaultIfEmpty()
                select new ProductWithNavigationProperties()
                {
                    Product = product,
                    ProductCategory = productCategory,
                    ProductSubCategory = productSubCategory,
                };
        
    }
    
     private async Task&lt;IQueryable&lt;ProductCategory&gt;> GetHostProductCategories()
    {

        using (DataFilter.Disable&lt;IMultiTenant&gt;())
        {
           return (await GetDbContextAsync()).ProductCategories;
        }
    }

    private async Task&lt;IQueryable&lt;ProductSubCategory&gt;> GetHostProductSubCategories()
    {
        using (DataFilter.Disable&lt;IMultiTenant&gt;())
        {
            return(await GetDbContextAsync()).ProductSubCategories;
        }
    }
    
    
    
    
    

hi

Dear team, is there a faster way to run DBMigrator on 1000+ Tenants ?

You can try to execute the migration concurrently, such as creating multiple threads to execute the migration separately.

Is there a way to keep the system running while migration is running ?

This is similar to system running when changing the database, which may be difficult or impossible.

can i migrate them back to a single database ?

You can back to use the Host database by deleting the tenant's connection string.

"You can back to use the Host database by deleting the tenant's connection string."

does the script move the data back to the host database ?

ABP Framework version: v4.2.2 UI type: / Blazor DB provider: EF Core / Tiered (MVC) or Identity Server Separated (Angular): no

i am trying to create a UI inwhich when the user registers using his phone number, the backend autogenerates the password and should return a JWT token ( Same one we get when we authenticate using connect/token endpoint.

How can i authenticate and get a token in the backend programatically so ican send it as a response. ??

public virtual async Task<string> LoginOrRegister(LoginInputDto input) { await CheckSelfRegistrationAsync();

        await IdentityOptions.SetAsync();

        var user = new IdentityUser(GuidGenerator.Create(), input.PhoneNumber, input.PhoneNumber + "@dukkantek.com", CurrentTenant.Id);
        user.SetPhoneNumber(user.UserName,true);
        (await UserManager.CreateAsync(user, "#Pp" + input.PhoneNumber)).CheckErrors();
        (await UserManager.AddDefaultRolesAsync(user)).CheckErrors();

       var token = //code to login this new user and Generate token 

        return token;
    }
    
  • ABP Framework version: v4.2.2
  • UI type: / Blazor
  • DB provider: EF Core /
  • Tiered (MVC) or Identity Server Separated (Angular): no

Dear team, is there a faster way to run DBMigrator on 1000+ Tenants ? its currently taking hours to finish as it loops through all the tenants one by one, i understand that. But this strategy is causing us to have downtimes when we do schema updates.

Is there a way to keep the system running while migration is running ? is there a faster way to migrate this many databases ? can i migrate them back to a single database ?

Showing 11 to 20 of 31 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06