Releases: pdevito3/craftsman
v0.15.0
🚀 Additions and Updates
Added
-
Open Telemetry and Jaeger tracing support
-
ValueObject
class scaffolding toSharedKernel
-
Domain Event support for all
BaseEntities
. Automatically scaffolded for theCreate
andUpdate
methods that call messages in a newDomainEvents
directory under that entity. It works by adding messages to a newDomainEvents
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 supportedEntities: - 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 aprotected
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
andFakeItEasyAnalyzer
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 inBaseEntity
-
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
toUserPolicyHandler
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
v0.14.2
v0.14.1
v0.14.0
🚀 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
ordotnet 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 afterProjectTo
. 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
fromGetRecord
feature in favor of direct mapper. -
Initial commit will use system git user and email as author. Courtesy of @sshquack
-
Id
onBaseEntity
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 adocker-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 beDevelopment
- Updated examples to handle new environment setup
- Updated auth properties to be under an
-
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
v0.13.0
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 anUpdate
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 toSuperAdmin
. This will allow for integration tests of theUserPolicyHandler
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 thePolicyName
and add tests that check for access - Integration tests for
UserPolicyHandler
- Unit tests for
RolePermission
Policies
prop removed from Feature- Added
SetUserRole
andSetUserRoles
methods to integreation tests'TestFixture
for easy role management in integration tests - Functional tests auth helper method now sets
role
instead ofscope
- Alice is a
SuperAdmin
and bob is aUser
- Added a
register:producer
command with CLI prompt - Added
UseSoftDelete
property to theApiTemplate
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 fornew: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
andForbidden
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 theEventHandlers
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
v0.13.0-pre2
fixed an issue with the seeder for private entities
v0.13.0-pre1
This is a prerelease that drives for more ddd based entities. entities now have private setters, factory methods, and updated tests and seeders.