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

feat(crud,crud-request,crud-typeorm): Added custom operators #253

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rgolea
Copy link

@rgolea rgolea commented Sep 11, 2019

This is a first attempt to add custom operators to allow users to extend functionality. I still need some help with some tests but I believe this should close #149.

It should allow you to do something like the following:

@Crud({
  ...
  customOperators: {
    <operator key>: (field: string, param: string) => <returns a string>
  }
})

so, for an example like the following:

@Crud({
  ...
  customOperators: {
    intersects: (field: string, param: string) => `ST_Intersects(${field}, ST_GeomFromGeoJSON(:${param}))`
  }
})

You should be able to do something like: ?filter=geom||intersects||<some geojson> in order to filter the entries that actually intersect that geojson.

PS: Added tests as well

@rgolea rgolea changed the title feat(crud,crud-request,crud-typeorm): Added to in order to extend f… feat(crud,crud-request,crud-typeorm): Added custom operators Sep 11, 2019
@rgolea
Copy link
Author

rgolea commented Sep 15, 2019

@zMotivat0r would you please tell me if this is at least the right path to go on? I would like to proceed with my project but I won’t want to proceed on a path that will be on direct conflict with the official path that you guys might take.

@michaelyali
Copy link
Member

First of all, @rgolea, thank you very much for your PR. I think the idea itself is awesome, but I haven't a chance to discover and review this PR closely.
I'm working now on some magor bugs and hopefully will review your PR soon.

@rgolea
Copy link
Author

rgolea commented Sep 15, 2019

Thank you very much! Great project btw! If you need some help with the project, let me know: I will try to help however I can.

@rgolea
Copy link
Author

rgolea commented Oct 4, 2019

Hi there @zMotivat0r! Is there any news on this?

@Mr-Plutus
Copy link

Hello! This is a very good and necessary contribution, it is often required to write custom operators in postgres

@Diluka
Copy link
Contributor

Diluka commented Feb 10, 2020

@rgolea You need rebase and resolve the conflicts

@rgolea
Copy link
Author

rgolea commented Feb 11, 2020

@Diluka I had it updated for about a month. I don't know if you guys abandoned the project. I will update it soon but I would love to know if it can be merged soon.

@heuristicAL
Copy link

Chiming in to hopefully push this review forward! 😃 This looks like a great feature!

@reececasey
Copy link

@rgolea just checking if you are still working on this, and looking at the conflicts?

@rgolea
Copy link
Author

rgolea commented May 20, 2020

@reececasey I am very sorry but I have been swamped with work. I will do my best to update this over the weekend.

@Darkein
Copy link

Darkein commented Jul 3, 2020

@zMotivat0r have you been able to take a look ?

@michaelyali
Copy link
Member

@Darkein yep, I was looking at this PR but unfortunately for it, at that moment I was working on a big update when I refactored a lot of parts and moved a lot of work to the interceptors and introduced search param mechanism as far as I remember.
And now there is a lot of conflicts :(

@rgolea
Copy link
Author

rgolea commented Jul 4, 2020

@zMotivat0r @Darkein and unfortunately I’m currently mixed up in a lot of work and cannot get to it at the moment. If anyone wants to try to do the same thing it would be much appreciated. I cannot define at the moment the time I need to finish updating this PR. I wouldn’t close it because it can still be used as an example on how to implement it and I will update it eventually if no one gets to it before I do.

@Darkein
Copy link

Darkein commented Jul 5, 2020

I will take a look this week :)

@rgolea
Copy link
Author

rgolea commented Jul 5, 2020

@Darkein feel free to copy all the code you need and ask me if you need anything! This is a great feature to have.

@Darkein
Copy link

Darkein commented Jul 21, 2020

@zMotivat0r @rgolea I've created a new PR recently, can you check it ?
#568

@rgolea
Copy link
Author

rgolea commented Jul 21, 2020

@Darkein you my friend are a freaking hero. Give this man a medal. I will check it out today.

@rewiko
Copy link
Collaborator

rewiko commented Nov 28, 2021

I am trying to help and have forked this repo (can't reach the owner of this repo and do not have the credential for the npm repo).

See #710 (comment)

We can hopefully merge it via rewiko#5

@Darkein
Copy link

Darkein commented Dec 7, 2021

@rewiko You don't have to merge this one, #568 is a rebase of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Custom operators
8 participants