Giter Site home page Giter Site logo

jadhielv / itl Goto Github PK

View Code? Open in Web Editor NEW
57.0 7.0 15.0 7.92 MB

Sample Web API implementation with .NET Core and DDD using Clean Architecture.

License: MIT License

C# 59.46% JavaScript 24.23% HTML 0.53% Vue 15.72% CSS 0.06%
ddd-architecture dotnetcore mssql nunit vuejs fluentvalidation collaborate communityexchange educative github

itl's Introduction

Hi there - I'm Jadhiel!

linkedin freecodecamp Last updated: less than 1 hour* Update README CodeQL

πŸš€ Skills:



πŸ“Š Github Stats:

πŸ’» Profile
Jadhiel VΓ©lez's GitHub Stats Top Langs

NOTE: Top languages do not indicate my skill level or something like that, it's a GitHub metric of which languages I've the most code.

⚑ Recent Activity
  1. πŸŽ‰ Merged PR #536 in Jadhielv/ITL
  2. πŸŽ‰ Merged PR #324 in AngelGarcia13/DominicanWhoCodes
  3. πŸŽ‰ Merged PR #149 in Jadhielv/ACGSS
  4. πŸŽ‰ Merged PR #148 in Jadhielv/ACGSS
  5. πŸ—£ Commented on #536 in Jadhielv/ITL

itl's People

Contributors

dependabot[bot] avatar depfu[bot] avatar jadhielv avatar morzkat avatar nminaya avatar shamirvaldez avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

itl's Issues

Crosscutting project ?

Hello,

I need to use some enums in Application or Domain, it's not a good idea to create a crosscutting project to place these enums ? Same for exceptions, in Application you can throw an exception catched in the Middleware in the API.

Thanks,

Update all the packages listed

Is your feature request related to a problem? Please describe.
Update dependencies and devDependencies to the latest version

Describe the solution you'd like
Use npm-update

Describe alternatives you've considered
NONE

Additional context
NONE

Update to .NET 6.0

  • Migrate from ASP.NET Core 5.0 to 6.0
  • Change the target framework of all projects.
<TargetFramework>net6.0</TargetFramework>

IStringLocalizer in Application project

Hello,

The application is multilanguage means, I have to return an error message in the right language.

When I do this in the API project, it's ok I get the right value for Article
image

In the Startup.cs

services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddControllersWithViews()
        .AddViewLocalization
        (LanguageViewLocationExpanderFormat.Suffix)
        .AddDataAnnotationsLocalization();
services.Configure<RequestLocalizationOptions>(options => {
    var supportedCultures = new[] { "fr-BE", "nl-BE", "en-US" };
    options.SetDefaultCulture(supportedCultures[0])
        .AddSupportedCultures(supportedCultures)
        .AddSupportedUICultures(supportedCultures);
});

In the controller :

private readonly IStringLocalizer<MyController> _localizer;
public MyController(IStringLocalizer<MyController> localizer)
{    _localizer = localizer; }

public ActionResult Get()
{   var article = _localizer["Article"];
    return Ok();
}

But I have to use that in the Application project

Then I do this :

public class MyService : IMyService
{
   private readonly IStringLocalizer<MyService> _localization;
    public MyService(IStringLocalizer<MyService> localization)
    {
	_localization = localization;
    }	
    public void Search()
    {
        var res = _localization["Article"];
    }
}

In res I get the value Article (the key) but not the value, I tried to move the resources files to Application project but still not work.

How can I do to fix this ?

Thanks

Query in nested object

Hello,

See explanation in 'MyMethod'

thanks,

public class Product : BaseEntity
{
    public string Name { get; set; }
    public ICollection<ProductPrice> ProductPrices { get; set; }
}

public class ProductPrice : BaseEntity
{
    [Column(TypeName = "decimal(18, 2)")]
    public decimal Price { get; set; }
    public bool IsActive { get; set; }
    public Product Product { get; set; }
}

public async Task<Product> MyMethod (int id)
{

   // In the query below, I'd like get in the result, the ProductPrice collection but only the Product where IsActive is true
   // how do this with your generic repo ?

   var product = await _unitOfWork.Products.First(x => x.Id == id);   
    
   return product;
}

Add some unit tests

Describe alternatives you've considered
Unit Test Through Mocking Using Moq Framework.

Additional context
NONE

Repositories of the UOW

Instead of create a new instance of the repositories you can use DI (because you already have the interfaces) for inject the repositories the UOW needs.

[TODO]: Find a way to inject the repositories and share the same context without creating an instance.

//TODO: Find a way to inject the repositories and share the same context without creating a instance.

In C#, you can use the Dependency Injection (DI) pattern to provide instances of repositories to your application without having to create an instance of each repository yourself. If you require any further information, please do not hesitate to contact me or our collaborator, @nminaya, he can provide more details.

How add custom method in Repository

Hello,

I'd like add a custom method in the PermissionRepository but I don't have access to the DBSet of the base class Repository.

What is the best way to do this ?

Thanks,

Npm install error

Running npm install command in the kctest-frontend folder throws the following error:

image

Query in nested object (Update)

    You can filter using LinQ:

var product = await _unitOfWork.Products.Where(x => x.Id == id).Select(x => new ProductDto { x.Name, ActiveProductPrices = x.ProductPrices.Where(p => p.IsActive) }).First();

Does not work because you don't have access Products but you have access to ProductRepository.

Originally posted by @nminaya in #220 (comment)

Create contributing guidelines

Is your feature request related to a problem? Please describe.
The purpose is describing how others may contribute content to the project.

Describe the solution you'd like
Use Good-CONTRIBUTING.md-template or whatever you prefer.

Describe alternatives you've considered
NONE

Additional context
NONE

Test suite failed to run

Is your feature request related to a problem?
FAIL test/e2e/specs/test.js

● Test suite failed to run

Your test suite must contain at least one test.

  at onResult (D:\Repositories (GitHub)../../../KCTest/kctest-frontend/node_modules/@jest/core/build/TestScheduler.js:175:18)
  at D:\Repositories (GitHub)../../../KCTest/kctest-frontend/node_modules/@jest/core/build/TestScheduler.js:304:17
  at D:\Repositories (GitHub)../../../KCTest/kctest-frontend/node_modules/emittery/index.js:260:13
      at Array.map (<anonymous>)
  at Emittery.Typed.emit (D:\Repositories (GitHub)../../../KCTest/kctest-frontend/node_modules/emittery/index.js:258:23)

FAIL test/unit/specs/HelloWorld.spec.js
● Test suite failed to run

Configuration error:

Could not locate module @/components/HelloWorld mapped as:
D:\Repositories (GitHub)\KCTest\kctest-frontend\src\$1.

Please check your configuration for these entries:
{
  "moduleNameMapper": {
    "/^@\/(.*)$/": "D:\Repositories (GitHub)\KCTest\kctest-frontend\src\$1"
  },
  "resolver": undefined
}

  1 | import Vue from 'vue'
> 2 | import HelloWorld from '@/components/HelloWorld'
    | ^
  3 | 
  4 | describe('HelloWorld.vue', () => {
  5 |   it('should render correct contents', () => {

  at createNoMappedModuleFoundError (D:\Repositories (GitHub)../../../KCTest/kctest-frontend/node_modules/jest-resolve/build/index.js:551:17)
  at Object.<anonymous> (D:\Repositories (GitHub)../../../KCTest/kctest-frontend/test/unit/specs/HelloWorld.spec.js:2:1)

Describe the solution you'd like
Adjust Configuration of Jest. Documentation: https://jestjs.io/docs/en/configuration

Describe alternatives you've considered
NONE

Additional context
NONE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.