Commit Graph

568 Commits

Author SHA1 Message Date
Thomas Trompette
18fafbdeb5
Rename findAvailableTables endpoint (#5557)
As title
2024-05-24 10:57:46 +02:00
Marie
4bd0aafb8e
[fix] Update remote table sync status in cache after schema update (#5553)
Upon schema update, sync status can change from synced to non_synced in
case the update regards a table that was deleted. Let's update the sync
status too to avoid displaying the table as still synchronized.


https://github.com/twentyhq/twenty/assets/51697796/7ff2342b-ce9f-4179-9b76-940617cf1292
2024-05-24 10:20:08 +02:00
Thomas Trompette
fede721ba8
Add sorter for distant tables (#5546)
As title
2024-05-23 22:36:50 +02:00
Marie
fe5b558477
[FE] Update remote table schema + refactor Tables list (#5548)
Closes #5062.

Refactoring tables list to avoid rendering all toggles on each sync or
schema update while using fresh data:
- introducing id for RemoteTables in apollo cache
- manually updating the cache for the record that was updated after a
sync or schema update instead of fetching all tables again
2024-05-23 17:00:24 +02:00
Thomas Trompette
0d6fe7b2b4
Handle relations separately for remotes (#5538)
Remote object id columns are not removed anymore when a remote object is
unsynced.
This is because we do not use relations anymore. We only created the id
field. So the current behavior that was implemented for custom objects,
to retrieve the fields to deleted, does not work.

Since remote object relations are really different, I extracted the
logic from `objectMetadataService`. It now handles only the relations
for custom objects creation and deletion (this part should be extracted
as well).

I create a new remote table relation service that will:
- fetch objects metadata linked to remotes (favorites,
activityTargets...)
- look for columns based on remote object name
- delete the fields and columns
2024-05-23 14:59:34 +02:00
Jérémy M
453525ca25
fix: workspace health showing error for multi select (#5547)
Fix `workspace:health` command not working properly with `MULTI_SELECT`
field metadata type.
2024-05-23 12:02:40 +02:00
Charles Bochet
7b1bea3a8a Release patch v0.11.3 2024-05-23 08:41:37 +02:00
Marie
6b1d4e0744
[Fix] Do not allow names with whitespaces (#5542)
As per title
2024-05-23 07:43:09 +02:00
Thaïs
04bf697b25
feat: add feature flag to activate Links field creation (#5535)
Related issue: #3607
2024-05-22 18:06:32 +02:00
Weiko
4e533bf2ef
fix pgGraphqlQuery with concurent search path (#5537) 2024-05-22 17:14:33 +02:00
Thomas Trompette
5448512bdc
Add quotes for table name (#5533)
As title
2024-05-22 14:21:32 +02:00
Jérémy M
bb6df43d17
fix: twentyORM datasource configuration for ssl (#5529)
We need to specify ssl configuration for TwentyORM datasources when
needed, otherwise connection will be broken.
2024-05-22 11:11:05 +02:00
bosiraphael
beaaf33544
5498 create a feature flag is gmail sync v2 enabled (#5501)
Closes #5498
2024-05-22 09:25:06 +02:00
Marie
3deda2f29a
Update foreign table to distant table schema (#5508)
Closes #5069 back-end part

And:
- do not display schemaPendingUpdates status on remote server lists as
this call will become too costly if there are dozens of servers
- (refacto) create foreignTableService

After this is merged we will be able to delete remoteTable's
availableTables column
2024-05-21 21:25:38 +02:00
gitstart-twenty
36b467d301
Fix storybook tests (#5487)
Fixes #5486

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-05-21 20:24:08 +02:00
bosiraphael
e47101e08b
5483 modify messagechannel syncstatus (#5484)
- Closes #5483
- Fix seeds
- Add default value to syncSubStatus
2024-05-21 13:31:39 +02:00
Jérémy M
66a23a852f
fix: unwanted change moving back datetime to date (#5499)
Moving back datetime to date, due to an unwanted change.
2024-05-21 13:29:59 +02:00
martmull
ec248f8605
Remove dumb code placement (#5494)
Fix a bug introduced in [this
PR](https://github.com/twentyhq/twenty/pull/5254/files)

When a subscription is created, we need to create the subscription,
#5254 return if no subscription is created so the sub can never be
created at all

This PR fixes that
2024-05-21 12:08:51 +02:00
martmull
4fcdfbff7d
Fix unhandled exception (#5474)
Solves exception.getStatus is not a function error logs in twenty-server

Catch all errors in order to have no error log at all
2024-05-21 11:31:03 +02:00
Marie
0d16051ded
[fix] Re-introduce beforeUpdateOneObject hook (#5495)
... and disable name edition in object edition form. This feature will
be introduced by #5491
2024-05-21 10:46:49 +02:00
Félix Malfait
4907ae5a74
Improve docs (#5492)
Fix #4382 and remove useless pages to make docs more readable
2024-05-21 09:09:19 +02:00
rostaklein
a9813447f3
feat: fetch and parse full gmail message (#5160)
first part of https://github.com/twentyhq/twenty/issues/4108
related PR https://github.com/twentyhq/twenty/pull/5081

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-05-20 17:29:35 +02:00
bosiraphael
b5d3396ea9
5477 - Introduce syncsubstatus in db to refactor gmail sync behavior (#5479)
Closes #5477
2024-05-20 17:19:21 +02:00
Thomas Trompette
4d479ee8ea
Remove relations for remotes (#5455)
For remotes, we will only create the foreign key, without the relation
metadata. Expected behavior will be:
- possible to create an activity. But the remote object will not be
displayed in the relations of the activity
- the remote objects should not be available in the search for relations

Also switched the number settings to an enum, since we now have to
handle `BigInt` case.

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-20 16:37:35 +02:00
Weiko
b098027174
Fix graphql prep query (#5478) 2024-05-20 15:53:13 +02:00
martmull
88f5eb669e
4689 multi workspace i should be able to accept an invite if im already logged in (#5454)
- split signInUp to separate Invitation from signInUp
- update redirection logic
- add a resolver for userWorkspace
- add a mutation to add a user to a workspace
- authorize /invite/hash while loggedIn
- add a button to join a workspace

### Base functionnality

https://github.com/twentyhq/twenty/assets/29927851/a1075a4e-a2af-4184-aa3e-e163711277a1

### Error handling

https://github.com/twentyhq/twenty/assets/29927851/1bdd78ce-933a-4860-a87a-3f1f7bda389e
2024-05-20 12:11:38 +02:00
Jérémy M
8b5f79ddbf
fix: multiple twenty orm issues & show an example of use (#5439)
This PR is fixing some issues and adding enhancement in TwentyORM:

- [x] Composite fields in nested relations are not formatted properly
- [x] Passing operators like `Any` in `where` condition is breaking the
query
- [x] Ability to auto load workspace-entities based on a regex path

I've also introduced an example of use for `CalendarEventService`:


https://github.com/twentyhq/twenty/pull/5439/files#diff-3a7dffc0dea57345d10e70c648e911f98fe237248bcea124dafa9c8deb1db748R15
2024-05-20 11:01:47 +02:00
Weiko
66637a3770
Add more details to mutation limit exception message and fix update many query (#5460)
## Context
Since we rely on PgGraphql to query the DB, we have to map its errors to
more comprehensible errors before sending them back to the FE. This has
already been done for unicity constraint and mutation maximum records
but for the last one the message wasn't clear enough. This PR introduces
a new pgGraphqlConfig param to the util to pass down the 'atMost' config
that we are actually overwriting with an
'MUTATION_MAXIMUM_RECORD_AFFECTED' env variable. See how atMost works in
this doc (https://supabase.github.io/pg_graphql/api/#delete)

Also adding the same message for the update since this mutation is also
affected. Create is not though.

Lastly, this PR introduces a fix on the updateMany. Since the current FE
is not using updateMany, this was missed for a few weeks but a
regression has been introduced when we started checking if the id is a
valid UUID however for updateMany this was checking the data object
instead of the filter object. Actually, the data object should never
contain id because it wouldn't make sense to allow the update of the id
and even more for multiple records since the id should be unique.

## Test
locally with MUTATION_MAXIMUM_RECORD_AFFECTED=5

<img width="1408" alt="Screenshot 2024-05-18 at 02 11 59"
src="https://github.com/twentyhq/twenty/assets/1834158/06bf25ce-4a44-4851-8456-aed7689bb33e">
<img width="1250" alt="Screenshot 2024-05-18 at 02 12 10"
src="https://github.com/twentyhq/twenty/assets/1834158/06fc4329-147b-4bb4-9223-c3bce340a8d2">
<img width="1222" alt="Screenshot 2024-05-18 at 02 12 36"
src="https://github.com/twentyhq/twenty/assets/1834158/0674546e-73e2-4e5c-918f-9825f2ee5967">
<img width="1228" alt="Screenshot 2024-05-18 at 02 13 01"
src="https://github.com/twentyhq/twenty/assets/1834158/f50df435-1fd4-45df-a953-8fefa8f36e75">
<img width="1174" alt="Screenshot 2024-05-18 at 02 13 09"
src="https://github.com/twentyhq/twenty/assets/1834158/707b9300-2779-43df-8177-9658b8965b49">


<img width="1393" alt="Screenshot 2024-05-18 at 02 19 11"
src="https://github.com/twentyhq/twenty/assets/1834158/2cd167b6-1261-4914-a4db-36f792d810c0">
2024-05-18 08:00:00 +02:00
Thomas Trompette
36e54119a3
Enable remotes with existing name (#5433)
- Check if a table with the same name already exists
- If yes, add a number suffix, and check again

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-17 10:38:17 +02:00
Marie
1694e0cccd
Fix missing name validation on object names at update (#5434)
## Context
as per title

## How was it tested? 
local (/metadata + in product)
2024-05-16 18:15:56 +02:00
Marie
d741f4a5bd
Minor refacto and fixes on Remotes updates (#5438)
In this PR

- Code refactoring
- v0 of adding "updates available" info in Connection sync status
<img width="835" alt="Capture d’écran 2024-05-16 à 17 02 07"
src="https://github.com/twentyhq/twenty/assets/51697796/9674d3ca-bed2-4520-a5a6-ba37bc242d06">

- fix distant table columns with not-camel case names are always
considered as new
2024-05-16 17:31:34 +02:00
martmull
afad993bb3
Fix main (#5435)
- fix lint issue
- fix Apply Cors exception handler (do not work when logged out)
2024-05-16 15:29:27 +02:00
martmull
fdf10f17e2
4655 batch endpoints on the rest api (#5411)
- add POST rest/batch/<OBJECT> endpoint
- rearrange rest api code with Twenty quality standard
- unify REST API error format
- Added PATCH verb to update objects
- In openapi schema, we replaced PUT with PATCH verb to comply with REST
standard
- fix openApi schema to match the REST api

### Batch Create

![image](https://github.com/twentyhq/twenty/assets/29927851/fe8cd91d-7b35-477f-9077-3477b57b054c)

### Replace PUT by PATCH in open Api

![image](https://github.com/twentyhq/twenty/assets/29927851/9a95060d-0b21-4a04-a3fa-c53390897b5b)

### Error format unification

![image](https://github.com/twentyhq/twenty/assets/29927851/f47dfcef-a4f8-4f93-8504-22f82a8d8057)

![image](https://github.com/twentyhq/twenty/assets/29927851/d76a87e2-2bf6-4ed9-a142-71ad7c123beb)

![image](https://github.com/twentyhq/twenty/assets/29927851/6db59ad3-0ba7-4390-a02d-be15884e2516)
2024-05-16 14:15:49 +02:00
Aditya Pimpalkar
ea5a7ba70e
feat: add renew token query for apollo client (chrome-extension) (#5200)
fixes - #5203
2024-05-16 10:21:16 +02:00
Marie
63387424c3
Fix transliteration for metadata + transliterate select options (#5430)
## Context 
Fixes #5403

Transliteration is now integrated to form validation through the schema.
While it does not impede inputting an invalid value, it impedes
submitting a form that will fail as the transliteration is not possible.
Until then we were only performing the transliteration at save time in
the front-end, but it's best to provide the information as soon as
possible. Later we will add helpers to guide the user (eg "This name is
not valid": https://github.com/twentyhq/twenty/issues/5428).

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-05-15 21:43:58 +02:00
Thomas Trompette
e1eead56c6
Alter comment on foreign key deletion (#5406)
We do not update the comment on the local table when a foreign table key
is deleted.
This was not breaking, which is why we did not see it. But comments
should be kept up to date.

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-15 17:05:30 +02:00
Jérémy M
f0383e3147
feat: twenty orm sync (#5266)
This PR is updating all object metadata entities with the new
decorators, and deleting the old ones.
This way we can use the new TwentyORM with all the standard objects.

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-05-15 16:58:47 +02:00
Marie
38eb293b3c
Compare distant tables schema with remote tables schema (#5413)
Closes #4532 and part of #5062
2024-05-15 15:47:54 +02:00
Félix Malfait
a53ce1c488
Track backend events (#5405)
Add tracking to backend events, we might disable frontend tracking which
doesn't bring much value to improve the product
2024-05-14 16:42:28 +02:00
martmull
ffdd3a7d4e
Return graphql errors when exists (#5389)
- throw badRequest with graphql error messages when graphql request
fails
- clean some code

Before
<img width="1470" alt="image"
src="https://github.com/twentyhq/twenty/assets/29927851/0b700d9a-2bbe-41f7-84a9-981dc7dd5344">

After

![image](https://github.com/twentyhq/twenty/assets/29927851/6bbaaf7c-1244-473d-9ae5-4fefc6a1b994)
2024-05-14 13:21:55 +02:00
Marie
b9154f315e
Enable deletion of relation fields (#5338)
In this PR
1. Enable deletion of relation fields in the product and via the api
(migration part was missing in the api)
3. Change wording, only use "deactivate" and "delete" everywhere (and
not a mix of the two + "disable", "erase")
2024-05-13 17:43:51 +02:00
martmull
0018ec78b0
4840 multi workspace update user userworkspace inconsistent on delete set null constraint (#5373) 2024-05-13 14:50:27 +02:00
martmull
8576127b47
Add migration to restrict users without workspaces (#5369)
- update set null ON DELETE constraint to RESTRICT
- update missing updates
2024-05-13 14:18:45 +02:00
martmull
1ac8abb118
5188 bug some canceled subscriptions are billed (#5254)
When user is deleting its account on a specific workspace, we remove it
as if it was a workspaceMember, and if no workspaceMember remains, we
delete the workspace and the associated stripe subscription
2024-05-13 10:23:32 +02:00
Marie
ae0e31abc7
Bump versions to 0.11.2 (#5349) 2024-05-10 13:56:41 +02:00
Charles Bochet
ce4e78aa85
Fix Rest API id UUID error (#5321)
A user has reported an issue with REST API.
We have recently migrated the graphql IDs from UUID to ID type. As Rest
API is leveraging the graphql API under the hood, the Rest API query
builder should be updated accordingly
2024-05-07 21:04:45 +02:00
Weiko
b691894254
Fix query runner throwing 500 when pg_graphql detects unique constraint (#5323)
## Context
Since pg_graphql does not return specific error/exception, we have to
map the error message and throw validation errors when needed
This PR adds a check on unicity constraint error returned by pg_graphql
when we are trying to insert duplicate records and returns a 400 instead
of being handled by the exceptionHandler as a 500.
2024-05-07 21:03:15 +02:00
Weiko
e802cef8f1
Fix 400 yoga errors being sent to exception handlers (#5322)
## Context
Yoga can catch its own errors and we don't want to convert them again.
Moreover those errors don't have an "originalError" property and should
be schema related only (400 validation) so we only want to send them
back to the API caller without going through the exception handler.

Also fixed an issue in the createMany which was throwing a 500 when id
was missing from the creation payload. It seems the FE is always sending
an ID but it should actually be optional since the DB can generate one.
This is a regression from the new UUID validation introduced a few weeks
ago.
2024-05-07 20:54:10 +02:00
Marie
7c3e82870c
[fix] Increment cache version after object/field/relation update (#5316)
Fixes #5276.

Updates were not triggering a cache version incrementation because they
do not trigger migrations while that is where the caching version logic
was.
We have decided to move the cache incrementation logic to the services.
2024-05-07 16:30:25 +02:00
Weiko
8074aae449
Split job modules (#5318)
## Context
JobsModule is hard to maintain because we provide all the jobs there,
including their dependencies. This PR aims to split jobs in dedicated
modules.
2024-05-07 14:08:20 +02:00