Skip to content
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

DOCUMENTATION: Proccessings Proofing #287

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions 2. Services/2.2 Processings/2.2 Processings.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Here's an example of what a Processing service function would look like:
public ValueTask<Student> UpsertStudentAsync(Student student) =>
TryCatch(async () =>
{
ValidateStudent(student);
ValidateStudentOnUpert(student);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnUpsert

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eyes!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


IQueryable<Student> allStudents =
this.studentService.RetrieveAllStudents();
Expand All @@ -21,7 +21,7 @@ TryCatch(async () =>
retrievedStudent.Id == student.Id);

return studentExists switch {
false => await this.studentService.RegisterStudentAsync(student),
false => await this.studentService.AddStudentAsync(student),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay as RegisterStudentAsync the idea here is that the language is more business specific than technical at the Processing layer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

_ => await this.studentService.ModifyStudentAsync(student.Id)
};
});
Expand Down Expand Up @@ -106,7 +106,7 @@ Processing services delegate full validations to the layer of services that are
public ValueTask<Student> UpsertStudentAsync(Student student) =>
TryCatch(async () =>
{
ValidateStudent(student);
ValidateStudentOnUpsert(student);

IQueryable<Student> allStudents =
this.studentService.RetrieveAllStudents();
Expand All @@ -115,13 +115,13 @@ TryCatch(async () =>
retrievedStudent.Id == student.Id);

return isStudentExists switch {
false => await this.studentService.RegisterStudentAsync(student),
false => await this.studentService.AddStudentAsync(student),
_ => await this.studentService.ModifyStudentAsync(student.Id)
};
});
```

Processing services are also not very concerned about outgoing validations except for what they will use within the same routine. For instance, if a Processing service is retrieving a model and will use this model to be passed to another primitive-level function on the Foundation layer, the Processing service will be required to validate that the retrieved model is valid, depending on which attributes of the model it uses.
Processing services are also not very concerned about outgoing validations except for what they will use within the same routine. Some exceptions may be neccesary as discussed in later sections. For instance, if a Processing service is retrieving a model and will use this model to be passed to another primitive-level function on the Foundation layer, the Processing service will be required to validate that the retrieved model is valid, depending on which attributes of the model it uses.
However, processing services will delegate the outgoing validation to the foundation layer for Pass-through scenarios.

## 2.2.3 Responsibilities
Expand All @@ -141,6 +141,8 @@ For instance, in a shifter pattern, we want to verify whether a student exists.
public ValueTask<bool> VerifyStudentExists(Guid studentId) =>
TryCatch(async () =>
{
ValidateStudentId(studentId);

IQueryable<Student> allStudents =
this.studentService.RetrieveAllStudents();

Expand Down
Loading