Skip to content

Releases: pdevito3/craftsman

v0.15.0

06 Jun 03:49
Compare
Choose a tag to compare

🚀 Additions and Updates

Added

  • Open Telemetry and Jaeger tracing support

  • ValueObject class scaffolding to SharedKernel

  • Domain Event support for all BaseEntities. Automatically scaffolded for the Create and Update methods that call messages in a new DomainEvents directory under that entity. It works by adding messages to a new DomainEvents prop on each entity and publishing all messages on an EF save using MediatR.

    • Unit tests are also scaffolded
    • To consume a message, you can use a MediatR INotificationHandler like normal.
  • Smart enum property support. Just add a property and give it a list of options using the SmartNames property and you're good to go. They will all be strings with smart enum backing. Attributes like filtering and sorting are supported

      Entities:
      - Name: Recipe
        Features:
        #...
        Properties:
        - Name: Title
          Type: string
          CanFilter: true
          CanSort: true
        - Name: Visibility
          SmartNames:
          - Public
          - Friends Only
          - Private
          CanFilter: true
          CanSort: true

Updated

  • CLI commands no longer use : and use the more traditional space delimiter. For exmaple, craftsman new example

  • Moved from old Startup model to new Program only for .NET 6. Includes updating test projects and service registrations for compatible setup

  • All features will now use a repository instead of using dbcontext directly.

  • Batch does not require a dbset name anymore, but does require a plural entity name for the FK if using one. Functionally, this is the same as before just with a new name for the prop: ParentEntityPlural

  • Entity props now virtual by default with a protected constructor for mocking in unit tests. This is mostly for foreign entities (since we don't have EF to populate our foreign entities in unit tests), but in order to have our mocks accurately reflect all our props, we need to make them virtual.

  • Add FakeItEasy and FakeItEasyAnalyzer to unit test project

  • Colocate DTOs with entities by default. Can be moved to shared kernel when needed

  • Default db provider set to postgres

  • Removed ?'s on strings in BaseEntity

  • Update integration test consumer registration to non-obsolete model

  • Testing cleanup

  • Performance optimizations for integration and functional tests

    • Integration tests will only wipe the db using checkpoint at the beginning of the entire fixture run, not after each test. This affects how assertions can and should be made
    • Unit tests have parallelization
  • Removed sort integration tests

  • Messages get a class for better typing as well as an interface.

  • Add postman client to example scaffolding

  • Add support for offline access and client secret requirement settings for client credentials clients

  • Automatically add a SuperAdmin role claim to machines

  • Updated services to use Newtonsoft to keep support for patchdocs. System.Text.Json is still available if patchdocs aren't needed for a project.

  • Integration Test TestBase has global autobogus settings

  • Permission and role validations are not case sensitive

  • Added client_role to UserPolicyHandler role check to accomodate machines with a new scaffolded test.

🐛 Pest Control

Fixed

  • Sql server connection strings to docker will trust the cert: TrustServerCertificate=True;

v0.14.3

28 Apr 03:54
Compare
Choose a tag to compare

Fixes

  • Nav link quote issue in BFF
  • Lingering recipe route in BFF
  • Added useQuery import to GET api in BFF

v0.14.2

23 Apr 03:20
Compare
Choose a tag to compare
  • fixes bff check

v0.14.1

20 Apr 01:55
Compare
Choose a tag to compare

last minute commits before a release without testing is asking for trouble...

Fixed

  • Resolved dependencies (#73)
  • BFF file fix
  • LaunchSettings doesn't break windows (#72)

v0.14.0

17 Apr 03:19
Compare
Choose a tag to compare

🚀 Additions and Updates

Added

  • A Dockerfile and .dockerignore will be added to each bounded context automatically (except BFFs)

  • A docker-compose.yaml will be added to your solution root by default for local development

    • Just run docker-compose up --build to spin up your databases (and RMQ if needed)

    • Then set an env and apply migrations. For a postgres example:

      • env

        Powershell

        $Env:ASPNETCORE_ENVIRONMENT = "anything"

        Bash

        export ASPNETCORE_ENVIRONMENT=anything
      • dotnet ef database update or dotnet ef database update --connection "Host=localhost;Port=3125;Database=dev_recipemanagement;Username=postgres;Password=postgres"

    • SA will always be default user for sqlserver so it can work properly

    • If no ports are given for api or db, they'll be auto assigned a free port on your machine

    • New john user to auth server (with no role)

    • Login hints for auth server

    • Minor helper override on fake generators

    • New add:bff command to add a bff to your solution

    • New add:bffentity command to add entities to your bff

    • Basic unit test scaffolding for create and update methods

    • Unit tests for updating rolepermissions

Updated

  • Fixed bug in Add feature that had a chained action after ProjectTo. They will now be filtered like so:

    var {entityNameLowercase}List = await _db.{entity.Plural}
    	.AsNoTracking()
     	.FirstOrDefaultAsync({entity.Lambda} => {entity.Lambda}.{primaryKeyPropName} == {entityNameLowercase}.{primaryKeyPropName}, cancellationToken);
    
    return _mapper.Map<{readDto}>({entityNameLowercase}List);
  • Removed ProjectTo from GetRecord feature in favor of direct mapper.

  • Initial commit will use system git user and email as author. Courtesy of @sshquack

  • Id on BaseEntity is sortable and filterable by default

  • Minor logging updates for better json formatting and more information in prod

  • GET record, PUT, and DELETE all have typed ids (e.g. {id:guid}) on their controllers

  • Development environment uses a connection string to an actual database now, instead of an in memory db. This can easily be spun up with a docker-compose for local development

  • Environment is now a singular object that will take in values for local environment variables for development and placed in launch settings and your docker compose. When deploying to other environments, you will use these same environment variables, but pass the appropriate value for that env.

    • Updated auth properties to be under an AuthSettings object like we do for broker settings
    • Removed ConnectionString from env. Docker connection will be added automatically in launch settings
    • Removed EnvironmentName as it will always be Development
    • Updated examples to handle new environment setup
  • Removed unused mapper from delete feature

  • Updated entity property definition with optional ColumnType attribute

  • Fixed a bug that broke registration of the bus in development env

  • Logger modifications

  • Cleanup batch add feature

  • Updated Created response for batch add

  • Use entity plural directory for tests

  • MassTransit bumped to v8

  • Bumped Nuget packages to latest

  • Updated checkpoint in test fixture for major version bump

Removed

  • Removed seeders

🐛 Pest Control

Fixed

  • Dbcontext for userpolicyhandler uses template (#70)
  • Patch cancellation token added in feature
  • Typo in role permission validation

v0.13.1

26 Feb 03:20
Compare
Choose a tag to compare

Fix

  • add:entity command will now use the correct solution folder

v0.13.0

27 Jan 05:36
Compare
Choose a tag to compare

Lots of updates here! Highlights are

  • DDD promoted entities (private setters, factory methods, associated fakers)

  • Huge permissions upgrade. Significantly simplified setup which resulted in a new library (HeimGuard) that can be used in any .NET project.

  • Message bus scaffolding and testing improvements

  • New register:producer command

  • Added soft delete capability

  • Added Shared Kernel

  • Added Complex example for new:example command

Also, big shout out to @sshquack for his first contributions!

🚀 Additions and Updates

Added

  • Entities will now have private setters, a static Create method and an Update method to promote a DDD workflow
    • This includes base entity and the dbcontext setters for the auditable fields
  • A huge permissions overhaul
    • SuperAdmin role is added by default and will automatically be given all permissions.
    • A User role with also be created. This role will not have any permissions assigned to it by default and can be removed if you would like as long as you add another role in addition to SuperAdmin. This will allow for integration tests of the UserPolicyHandler to be fully scoped.
    • A permission will be added for each feature with a default name of CanFEATURENAME, but can be overridden if desired.
    • Role-permission mappings outside of this need tobe done manually
    • You will be responsible for managing permissions outside of super admin
    • Policies are no longer part of the craftsman api, but a single policy will be added with each api boundary to swagger to dictate access to that boundary. It has a default of a snake case of ProjectName, but can be overridden
      • If using the built in auth server, this will be added for you. if not, make sure it mataches an appropriate scope in your auth server for this api boundary
    • Features now have a prop for IsProtected that, if true, will add an authorization attribute to your endpoint with the PolicyName and add tests that check for access
    • Integration tests for UserPolicyHandler
    • Unit tests for RolePermission
    • Policies prop removed from Feature
    • Added SetUserRole and SetUserRoles methods to integreation tests' TestFixture for easy role management in integration tests
    • Functional tests auth helper method now sets role instead of scope
    • Alice is a SuperAdmin and bob is a User
  • Added a register:producer command with CLI prompt
  • Added UseSoftDelete property to the ApiTemplate which is set to true. When adding an entity after the fact, Craftsman will automatically detect whether or not your project is using soft deletion by checking base entity for the appropriate property.
  • Added a SharedKernel project at the root to capture DTOs, exceptions, and roles (if using auth)
  • Added new Complex example for new:example

Updated

  • Updated FK and basic examples to have more features on the entities

  • Updated tests to work with new private entity workflow

  • CurrentUserServer has a method to get the User from the ClaimsPrincipal

  • Swagger question removed from add:feature as it wasn't being used. Will be set to true.

  • Removed unused Unauthorized and Forbidden MediatR filters

  • Test Fixture updated to better handle MassTransit

    • _provider will always be injected, even when not using MassTransit

    • The end of the fixture has been slightly updated to look like this:

              // MassTransit Harness Setup -- Do Not Delete Comment
      
              _provider = services.BuildServiceProvider();
              _scopeFactory = _provider.GetService<IServiceScopeFactory>();
      
              // MassTransit Start Setup -- Do Not Delete Comment
    • Added several helper methods to the test fixture

    • Updated the consumer test to use the helper methods

    • Producer doesn't take in placeholder props

    • Producer test generated

  • Minor update to naming of producer in the bus example

  • Default exchange type now Fanout for producer and consumer

  • Added optional (but recommended) DomainDirectory prop to producers and consumers. This will move them from the EventHandlers directory and keep them directly with features for better colocation.

  • Updated the 1:1 relationships to use proper scaffolding.

  • Updated the FK example to show proper 1:1 relationship

  • Entities with a Guid prop will no longer have a default of Guid.NewGuid()

  • Updated default library from NewtonSoft.Json to System.text.Json (#52)

  • Took audit fields off of DTO

  • Bumped LibGit2Sharp to preview for M1 compatibility

🐛 Pest Control

  • Batch endpoint route updated to batch along with a functional testing route
  • Batch add using update to controller
  • IHttpContextAccessor fixted to a singleton in integration tests' TestFixture
  • Can enter null for add:feature batch list options where needed
  • Minor formatting fix for indentation in producers and consumers
  • Removed extra exception using from patch integration test
  • Fixed docker image for integration tests running on macOS + M1 chip (#53)

v0.12.3

21 Dec 04:42
Compare
Choose a tag to compare
  • Updated Craftsman to .NET 6 (fixes #48)

v0.13.0-pre2

10 Dec 14:26
Compare
Choose a tag to compare
v0.13.0-pre2 Pre-release
Pre-release

fixed an issue with the seeder for private entities

v0.13.0-pre1

09 Dec 02:44
Compare
Choose a tag to compare
v0.13.0-pre1 Pre-release
Pre-release

This is a prerelease that drives for more ddd based entities. entities now have private setters, factory methods, and updated tests and seeders.