Skip to content

Commit

Permalink
DOCUMENTATION: Proccessings Proofing
Browse files Browse the repository at this point in the history
Closes: #286
  • Loading branch information
glhays committed Jul 23, 2024
1 parent e8e368a commit 210f9cc
Showing 1 changed file with 7 additions and 5 deletions.
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);

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),
_ => 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

0 comments on commit 210f9cc

Please sign in to comment.