-
Notifications
You must be signed in to change notification settings - Fork 4
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
New docs #582
New docs #582
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v8.0-preview #582 +/- ##
=============================================
Coverage 63.00% 63.00%
=============================================
Files 244 244
Lines 5636 5636
Branches 369 369
=============================================
Hits 3551 3551
Misses 1978 1978
Partials 107 107 ☔ View full report in Codecov by Sentry. |
1c9f8c1
to
9291581
Compare
@@ -0,0 +1,64 @@ | |||
# Authorization | |||
|
|||
Each command and query has to be authorized or must explicitly opt-out of authorization (it's enforced using Roslyn analyzers). You can specify which authorizer to use using the `AuthorizeWhen` attribute and custom `ICustomAuthorizer`. Opting-out is done using the `AllowUnauthorized` attribute. There is a predefined authorizer that uses role- and permission-based authorization. You can specify which permissions to enforce using `AuthorizeWhenHasAnyOf` and configure the role-to-permission relationship using `IRoleRegistrations`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
command, query and operation?
I wonder do we have a clear term for all three concepts. Sometimes commands and queries are jointly called CQRS operations, but this would be misleading in our case. 🤔
If we pick one, it should be used consistently in all contexts. I would prefer a separate term instead of enumerating "comands, queries and operations". Unfortunately, I don't have an idea, maybe someone else would fill in. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could adapt a bit the CQRS objects terminology. Maybe go back to the roots calling them RCQRS objects (Remote), however we have abandoned this terminology I'm afraid. Otherwise, we can get a little bit silly and call them CQRS+ objects, where + would mean the operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like starting with potential use cases!
docs/cqrs/operation/index.md
Outdated
```csharp | ||
public class PayForAccessOH : IOperationHandler<PayForAccess, PaymentTokenDTO> | ||
{ | ||
private readonly IPaymentsService payments; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ending service names with Service
might be another topic for our freak fight weekly. 🤡
7219048
to
55c5858
Compare
8379cf2
to
3820958
Compare
docs/cqrs/validation/index.md
Outdated
|
||
> **Tip:** More on ids can be found [here](../../domain/id/index.md). | ||
|
||
If you need complex validation logic that needs to access external state, use `MustAsync`/`CustomAsync` validators. For `CustomAsync` validators, you can use `AddValidationError` helper to specify the error code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add an example of async validation (checking for existence with dbContext should suffice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was there above this, moved this text above async validator to make it more clear.
acdf7fe
to
a262605
Compare
docs/external_integrations/authorization_ory_kratos/handling_webhooks.md
Outdated
Show resolved
Hide resolved
docs/external_integrations/authorization_ory_kratos/handling_webhooks.md
Show resolved
Hide resolved
docs/external_integrations/authorization_ory_kratos/handling_webhooks.md
Outdated
Show resolved
Hide resolved
docs/external_integrations/authorization_ory_kratos/handling_webhooks.md
Show resolved
Hide resolved
docs/external_integrations/authorization_ory_kratos/handling_webhooks.md
Show resolved
Hide resolved
@@ -0,0 +1,64 @@ | |||
# Authorization | |||
|
|||
Each command and query has to be authorized or must explicitly opt-out of authorization (it's enforced using Roslyn analyzers). You can specify which authorizer to use using the `AuthorizeWhen` attribute and custom `ICustomAuthorizer`. Opting-out is done using the `AllowUnauthorized` attribute. There is a predefined authorizer that uses role- and permission-based authorization. You can specify which permissions to enforce using `AuthorizeWhenHasAnyOf` and configure the role-to-permission relationship using `IRoleRegistrations`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could adapt a bit the CQRS objects terminology. Maybe go back to the roots calling them RCQRS objects (Remote), however we have abandoned this terminology I'm afraid. Otherwise, we can get a little bit silly and call them CQRS+ objects, where + would mean the operation.
docs/features/audit_logs/index.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to also mention the features not present in this repo? Like LeanPipe, app rating and probably something else. We could have a list somewhere with just one sentence long descriptions and links to the docs (LeanPipe e.g. has some docs in its repo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could do it, but I can see that only app rating has public repo, leanpipe and notification center are private and I don't think that we should mention features that might not be available to user outside leancode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put that in the backlog - these repo will be open rather soon.
</Project> | ||
``` | ||
|
||
[/Directory.Build.props]: https://github.com/leancodepl/corelibrary/blob/v8.0-preview/Directory.Build.props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be broken very soon. I wonder if we can make it a link to a default branch no matter what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could point to the HEAD but we probably do not want docs just to point to newest commit. When v8 is released some other link also need to be updated. Will probably update it then.
@@ -0,0 +1,213 @@ | |||
# Authorization | |||
|
|||
Each command and query has to be authorized or must explicitly opt-out of authorization (it's enforced using Roslyn analyzers). You can specify which authorizer to use using the `AuthorizeWhen` attribute and custom `ICustomAuthorizer`. Opting-out is done using the `AllowUnauthorized` attribute. There is a predefined authorizer that uses role- and permission-based authorization. You can specify which permissions to enforce using `AuthorizeWhenHasAnyOf` and configure the role-to-permission relationship using `IRoleRegistrations`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(it's enforced using Roslyn analyzers)
Do we have any entry in the docs covering this topic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I will add this to backlog and reword it
|
||
// Assert that the `DateCreated` time matches | ||
// the expected time in UTC. | ||
Assert.Equal(expectedTime.UtcDateTime, project.DateCreated); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: FluentAssertions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm not sure about that, I think it should be as simple as possible and using FluentAssertions in docs might add some unnecessary complication (as it is not as popular and recognized XUnit's Assert
).
|
||
Our aim is to provide an opinionated framework for .NET Core app development. As for now we have, more-or-less, standardized: | ||
The LeanCode Core Library is a set of helper libraries developed at [our company](https://leancode.co/) that aids our day-to-day development. Not only does it serve as a facilitator in our day-to-day coding activities, but it also encapsulates comprehensive guidelines, gathers our collective knowledge on application architecture and development best practices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not now probably, but for future - we need to re-word this and put more focus on "CoreLib being a enterprise-ready framework that structures how you create the applications".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sth like the second paragraph.
|
||
After successfully setting up the local cluster, your next step is to initiate your application. Begin by navigating to the `backend` directory. This directory is the heart of your application, containing various subdirectories and files, each serving a specific purpose: | ||
|
||
```txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change soon, so let's remember to fix it after the fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/quick_start/index.md
Outdated
|
||
### Generating initial migrations | ||
|
||
Let's start with generating initial migrations. Begin by navigating, to the `backend/src/Apps/ProjectName.Migrations` directory. Generate initial migrations using the `dotnet ef` tool (install it via `dotnet tool install --global dotnet-ef`): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked with Krzysiek about this one, this tool IMO should be put in the dotnet-tools.json
. /cc: @Saancreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update this when it will be in dotnet-tools.json
docs/quick_start/index.md
Outdated
Then you can run the migrations and the API using the following command: | ||
|
||
```sh | ||
tilt up migrations api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will run API only, it will not start migrations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what we always had in README
if I remember correctly it did start the migrations when I ran it. Anyway I separated those commands now.
docs/cqrs/index.md
Outdated
|
||
- **Separation of concerns:** CQRS enforces a clear separation of concerns between the write and read operations. This leads to a more maintainable and modular codebase, making it easier to understand, test, and develop. | ||
- **Improved security:** Security measures can be applied more granularly. For instance, you might have different authorization mechanisms for read and write operations, providing an additional layer of control. | ||
- **Validation on the write side:** With CQRS, the write side typically handles commands that change the state of the system. This is where validation of incoming data and business rules can be enforced. By centralizing validation logic on the write side, you ensure that all changes to the system go through a consistent validation process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the typically
here - what does it refer to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I don't get the point fully. Could you paraphrase it to me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think typically
is unnecessary here and can be removed/
The point is that we do not need to include validation on our read side. I will reword it to make it more clear.
|
||
## Naming conventions | ||
|
||
Commands in CQRS are responsible for modifying the state of the system, and therefore their names should reflect the action they trigger. A common convention is to use imperative verbs that clearly describe the intent, including the namespace as part of the contract, such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the including the namespace as part of the contract
. What did you have in mind here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was @tomaszlaskowskiLC suggestion somewhere above. Namespace might sometimes provide additional information about the contract, and I think it should be treated as a part of it so that we do not create some weird folder structure which might confuse the clients.
…CommitTransaction middleware
General
section fromREADME.md
as new githubREADME.md
(with some small overview addition).Check links
step from markdown lint check as it exceeded nuget rate limits and failed.