-
Notifications
You must be signed in to change notification settings - Fork 1
FRONTEND-8638 :: Feature :: Add Custom Angular Validation Patterns #143
base: feature/frontend-2309-remove-getall-putall
Are you sure you want to change the base?
FRONTEND-8638 :: Feature :: Add Custom Angular Validation Patterns #143
Conversation
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.
@orioljp I imagine that you didn't write the code, only moved or copied to a new files. But in general I see to much comments explaining the code and many if/else nested with return's.
You think that it's possible to refactor it in the same PR?.
sql = `${sql} and ${this.deletedAtColumn} is null`; | ||
} | ||
return this.sqlInterface.query(sql, query.ids); | ||
} else { |
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.
@orioljp the else is not needed.
} | ||
|
||
if (query instanceof IdsQuery) { | ||
if (values.length !== query.ids.length) { |
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.
@orioljp double if.
abstract put(value: T | undefined, query: Query): Promise<T>; | ||
|
||
public async delete(query: Query): Promise<void> { | ||
if (this.softDeleteEnabled) { |
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.
@orioljp I see to much if/else with a return's that can be simplified.
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 just checked the first file, I don't want to find the relevant changes between the "all" removal changes.
@Alex-DA I promise I would have been sooooo happy editing the raw-sql.data-source to simplify what we have because as you mentioned, it's a mess. I just made it compliant to our new datasource inteface (no getAll/putAll) because we're not working on a project that worth investing time on improving harmony-nest at this moment, so the code you see is really old. Please reconsider your approval. |
@doup What you reviewed were the actual changes. I didn't notice that this PR contained the changes from the "all" removal. Thanks for noticing and for you constructive comment |
This PR will remain on hold since the AbstractControl used in this validators is deprecated in Angular 14 and we should upgrade harmony-angular |
@orioljp Are you sure it is deprecated on v14? I just checked the API reference and I don't see any mention of this being deprecated: https://v14.angular.io/api/forms/AbstractControl Same for the next version of Angular : https://next.angular.io/api/forms/AbstractControl#description |
@lucianosantana sorry for not giving a complete explanation. Now forms are generic, so newer versions of angular use an AbstractControl or inherited FormControl and UntypedFormControl, which is an alias of FormControl. This makes that the current version of harmony that expects an AbstractControl in the validators (without generic) is not compatible with the typed ones used in v14. I always try new harmony versions in SocialPALS and I couldn't make this work because of this incompatibility of types. |
For more info, compare this two definitions: |
Anyway, since Angular 13 will be out of LTS soon and Harmony-Angular is just a small part of this library, I'm thinking on updating the library to Angular v14 |
Understood. Let's upgrade harmony-angular then. |
Asana task link:
https://app.asana.com/0/1109863238977521/1204241389098638
Merge / Pull request information:
Two validators have been added, these pattern allow us to use multiple patterns with different ids in the same Angular FormControl. One is to ensure that the pattern is followed and the other uses the pattern to find errors.