Add rest api (#2757)

* Add a wildcard get route

* Call api from api

* Add a query formatter

* Use headers to authenticate

* Handle findMany query

* Add limit, orderBy and lastCursor parameters

* Add filter parameters

* Remove singular object name from valid requests

* Update order_by format

* Add depth parameter

* Make /api/objects/ID requests work

* Fix filter

* Add INTERNAL_SERVER_URL env variable

* Remove useless comment

* Change bath api url to 'rest'

* Fix limit parser

* Handle full filter version

* Improve handle full filter version

* Continue rest api

* Add and(...) default behaviour on filters

* Add tests

* Handle 'not' conjunction for filters

* Check filter query

* Format values with field metadata item type

* Handle nested filtering

* Update parsing method

* Check nested fields

* Add delete query

* Add create query

* Rename methods

* Add update query

* Update get one object request

* Fix error handling

* Code review returns
This commit is contained in:
martmull
2023-12-01 16:26:39 +01:00
committed by GitHub
parent f405b77cea
commit 97f154ef2c
9 changed files with 872 additions and 1 deletions

View File

@ -4,6 +4,7 @@ PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default
# PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default?connection_limit=1
FRONT_BASE_URL=http://localhost:3001
LOCAL_SERVER_URL=http://localhost:3000
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
@ -28,4 +29,4 @@ SIGN_IN_PREFILLED=true
# LOG_LEVEL=error,warn
# MESSAGE_QUEUE_TYPE=pg-boss
# REDIS_HOST=127.0.0.1
# REDIS_PORT=6379
# REDIS_PORT=6379