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

Create remoteServer API #3922

Closed
Tracked by #3920
FelixMalfait opened this issue Feb 13, 2024 · 0 comments
Closed
Tracked by #3920

Create remoteServer API #3922

FelixMalfait opened this issue Feb 13, 2024 · 0 comments
Labels
scope: backend Issues that are affecting the backend side only

Comments

@FelixMalfait
Copy link
Member

FelixMalfait commented Feb 13, 2024

Context

Once we have completed #3742 we now need to create a proper API to manipulate remote servers.

Reference

For create/update/delete:

For read:

SELECT srvname, srvowner, srvfdw
FROM pg_foreign_server;

Or

SELECT um.user_mapping_oid, um.srvname, um.usename, um.umoptions
FROM pg_user_mappings um
JOIN pg_foreign_server fs ON um.srvname = fs.srvname
WHERE fs.srvname = 'your_foreign_server_name';

(from ChatGPT, not tested)

Implementation

Within /twenty-server/src/metadata we will create a new folder remote-server folder similar to what was done in the object-metadata folder. In the latter we've used nestjs/graphql query to auto-generate mutations but this won't be helpful here, we'll want to overwrite/create our one mutation for create/update/delete/read (the same way we've overriden deleteOneObject already)

Unlike Postgres we should consider that 1 server = 1 user mapping.
So for example in the create method we would do 3 things:

  • Create the remoteServer record in our metadata schema
  • Create the SERVER (Postgres function)
  • Create the USER MAPPING (Postgres function)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: backend Issues that are affecting the backend side only
Projects
Archived in project
Development

No branches or pull requests

1 participant