**Context**
cf. feature request
[#4597](https://github.com/twentyhq/twenty/issues/4597)
Enables deletion of custom fields that aren't active nor of type
relation
Also
1. renamed a misnamed file
2. deleted redundant hook BeforeDeleteOneField as it seemed best to move
the logic to the resolver instead
**How was it tested?**
Did not write unit tests as code is to be migrated (discussed with
@Weiko).
Locally tested.
---------
Co-authored-by: Marie Stoppa <mariestoppa@MacBook-Pro-de-Marie.local>
Foreign table id cannot be a foreign key of a base table. But the
current code use foreign keys to link object metadata with activities,
events... So we will:
- create a column without creating a foreign key
- add a comment on the table schema so pg_graphql sees it as a foreign
key
This PR:
- refactor a bit object metadata service so the mutation creation is
separated into an util
- adds the mutation creation for remote object relations
- add a new type of mutation to create a comment
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
## Context
SyncExternalId should be renamed because this won't always represent an
id. For example, microsoft API does not use ids but dates for their
sync. Also we think external is a bit redundant so we are removing it.
Note: this field is not used by the front-end (and will probably never
be)
We were missing `JsDom` dependencies in the package.json generated by nx
while running `twenty-server`: `yarn nx build:packageJson`
Detailed explanation:
- we are currently using nx paradigm which is to put dependencies of all
projets at root, which enables global package migrations for the whole
monorepo
- for production containers, we only want specific project dependency to
be added. This is done by running `yarn nx build:packageJson` on
`twenty-server`. Nx is statically analyzing twenty-server dependencies
and generating a tailored package.json that production containers can
later use.
- However, `nx` static analysis is not flawless and is missing some
packages. We are going to stop using it as the value is not there yet
but the burden for developers is high. The guideline is to put back
project dependencies into specific package `package.json`
- Therefore, I'm adding `jsdom` to twenty-server `package.json`
- If sync fails we set authFailedAt
- This information is displayed in the frontend in accounts with a `Sync
Failed` pill
- The user can reconnect his account in the dropdown menu
- A new OAuth flow is triggered
- The account is synced
## Context
A new ADDRESS field type has been introduced and the company object has
been updated to use this new type however this introduced a few
regressions.
The good strategy would be to introduce a new field and rename the old
one.
This PR revert that change to fix the issue.
Split from https://github.com/twentyhq/twenty/pull/4518
- Upgrades dependencies and applies automatic config migrations with the
command: `npx nx migrate nx` (see
https://nx.dev/nx-api/nx/documents/migrate)
- Fixes lint errors after upgrading `@typescript-eslint`
Note: it was not possible (for now) to migrate Nx to the latest stable
version (v18.2.1) because it upgrades Typescript to v5.4.3, which seems
to cause a bug on install when Yarn tries to apply its native patches.
Might be a bug on the Yarn side.
When writing to the normalized cache (record), it's crucial to use _refs
for relationships to avoid many problems. Essentially, we only deal with
level 0 and generate all fields to be comfortable with their defaults.
When writing in queries (which should be very rare, the only cases are
prefetch and the case of activities due to the nested query; I've
reduced this to a single file for activities
usePrepareFindManyActivitiesQuery 🙂), it's important to use queryFields
to avoid bugs. I've implemented them on the side of query generation and
record generation.
When doing an updateOne / createOne, etc., it's necessary to distinguish
between optimistic writing (which we actually want to do with _refs) and
the server response without refs. This allows for a clean write in the
optimistic cache without worrying about nesting (as the first point).
To simplify the whole activities part, write to the normalized cache
first. Then, base queries on it in an idempotent manner. This way,
there's no need to worry about the current page or action. The
normalized cache is up-to-date, so I update the queries. Same idea as
for optimisticEffects, actually.
Finally, I've triggered optimisticEffects rather than the manual update
of many queries.
---------
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
* default value boolean fixed
* fixed creation, fixed updating a value to false
* fixed default value for default value if boolean
* fixed tests
---------
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
* fixes
* saving workspaceMemberId and personId when saving attendees
* add typing
* use Map
* improve saveMessageParticipants
* fix role type
* move logic in a service
* create new service
* use new service in calendar-event-attendee.service
* modify service to include more common logic
* add defaumt value to isOrganizer in calendar-event-attendee.object-metadata
* rename folder
* renaming
* update calendarEvent labels and description to match Figma
* modify conferenceUri to conferenceLink with LINK type
* update format-google-calendar-event.util to match new conferenceLink
* update CalendarEventDetails since overriding the fields is no longer needed
* fix mock metadata
* generate new uuid for field conferenceLink
* feat: wip refactor default-value
* feat: health check to migrate default value
* fix: tests
* fix: refactor defaultValue to make it more clean
* fix: unit tests
* fix: front-end default value
* fix: sever not throwing when enum contains two identical values
* fix: enum column name cannot be change
* fix: put field create/update inside transactions
* fix: check for options duplicate values front-end
* fix: missing commit transaction
* Build remote server
* Add getters
* Migrate to json inputs
* Use extendable type
* Use regex validation
* Remove acronymes
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
* add lodash differenceWith
* add awaits
* update sync cursor is working
* add logs
* use isSyncEnabled information to enqueue jobs
* add decorator InjectObjectMetadataRepository
* fix gmail-full-sync
* Being implementing events on the frontend
* Rename JSON to RAW JSON
* Fix handling of json field on frontend
* Log user id
* Add frontend tests
* Update packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/save-event-to-db.job.ts
Co-authored-by: Weiko <corentin@twenty.com>
* Move db calls to a dedicated repository
* Add server-side tests
---------
Co-authored-by: Weiko <corentin@twenty.com>
* feat: merge front and server dockerfiles and optimize build
* fix: update image label
* fix: bring back support for REACT_APP_SERVER_BASE_URL injection at runtime
* fix: remove old entries & add nx cache in dockerignore
* feat: generate frontend config at runtime using Nest
* fix: format and filename
* feat: use the EnvironmentService and leave default blank
* feat: add support for DB migrations
* Add getter factory for attachements
* Override guard in test
* Add secret in env variables
* Return custom message on expiration
* Rename to signPayload
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
* rename database services to repository
* refactor more repositories
* more refactoring
* followup
* remove unused imports
* fix
* fix
* Fix calendar listener being called when flag is off
* remove folders
* calendar module
* wip
* creating a folder for common files between calendar and messages
* wip
* wip
* wip
* wip
* update calendar search filter
* wip
* working on full sync service
* reorganizing folders
* adding repositories
* fix typo
* working on full-sync service
* Add calendarQueue to MessageQueue enum and update dependencies
* start transaction
* wip
* add save and update functions for event
* wip
* save events
* improving step by step
* add calendar scope
* fix nest modules imports
* renaming
* create calendar channel
* create job for google calendar full-sync
* call GoogleCalendarFullSyncJob after connected account creation
* ask for scope conditionnally
* fixes
* create channels conditionnally
* fix
* fixes
* fix FK bug
* filter out canceled events
* create save and update functions for calendarEventAttendee repository
* saving messageParticipants is working
* save calendarEventAttendees is working
* add calendarEvent cleaner
* calendar event cleaner is working
* working on updating attendees
* wip
* reintroducing google-gmail endpoint to ensure smooth deploy
* modify callbackURL
* modify front url
* changes to be able to merge
* put back feature flag
* fixes after PR comments
* add feature flag check
* remove unused modules
* separate delete connected account associated job data in two jobs
* fix error
* rename calendar_v3 as calendarV3
* Update packages/twenty-server/src/workspace/calendar-and-messaging/utils/valueStringForBatchRawQuery.util.ts
Co-authored-by: Jérémy M <jeremy.magrin@gmail.com>
* improve readability
* renaming to remove plural
* renaming to remove plural
* don't throw if no connected account is found
* use calendar queue
* modify usage of HttpService in fetch-by-batch
* modify valuesStringForBatchRawQuery to improve api and return flattened values
* fix auth module feature flag import
* fix getFlattenedValuesAndValuesStringForBatchRawQuery
---------
Co-authored-by: Jérémy M <jeremy.magrin@gmail.com>
* fix serverurl in openapi docs for self hosted instance
* fixed server url slash, moved calculation to enviroment function, fixed openapi path hardcoded api.twenty.com
* Define quantity at checkout
* Remove billing submenu when not isBillingEnabled
* Remove feature flag
* Log warning when missing subscription active workspace add or remove member
* Display subscribe cta for free usage of twenty
* Authorize all settings when subscription canceled or unpaid
* Display subscribe cta for workspace with canceled subscription
* Replace OneToOne by OneToMany
* Add a currentBillingSubscriptionField
* Handle multiple subscriptions by workspace
* Fix redirection
* Fix test
* Fix billingState
* Build arg setter for position
* Build separated query factory + rename existing
* Sort record by position in front
* Add tests
* Set first for type board
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
* Update Release.tsx
* Update StyledTitle.tsx
Changed Release color font to primary (#141414)
* Update StyledTitle.tsx
Spacing around the title for mobile , header font change for tablet
* Update Release.tsx
changed the date font -weight
removed the redundant paragraph color
added media design changes of spacing1, spacing2, paragrap gap
* Update StyledTitle.tsx
subhead releases font color
* Update Release.tsx
media alignment, release font change,
* Update Release.tsx
* Quick fix
* Unrelated change (sentry)
---------
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
* Update .env.example
this .env file will now work with the docker-compose example provided.
* Update .env.example
* Update doc and reset env example
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
* create blocklist service
* blocklist is working on email import in full sync
* add log
* add blocklist to partial sync
* define rule for blocklist imports
* gmail filter is working
* correct typo
* fix bugs
* getCompanyNameFromDomainName
* renaming
* remove unused service
* add transaction
* feat: find duplicate objects backend init
* refactor: move duplicate criteria to constants
* fix: correct constant usage after type change
* feat: skip query generation in case its not necessary
* feat: filter out existing duplicate
* feat: FE queries and hooks
* feat: show duplicates on FE
* refactor: should-skip-query moved to workspace utils
* refactor: naming improvements
* refactor: current record typings/parsing improvements
* refactor: throw error if existing record not found
* fix: domain -> domainName duplicate criteria
* refactor: fieldNames -> columnNames
* docs: add explanation to duplicate criteria collection
* feat: add person linkedinLinkUrl as duplicate criteria
* feat: throw early when bot id and data are empty
* refactor: trying to improve readability of filter criteria query
* refactor: naming improvements
* refactor: remove shouldSkipQuery
* feat: resolve empty array in case of empty filter
* feat: hide whole section in case of no duplicates
* feat: FE display list the same way as relations
* test: basic unit test coverage
* Refactor Record detail section front
* Use Create as input argument of findDuplicates
* Improve coverage
* Fix
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* fix: forbid creation of objects or fields with certain characters or with forbidden keywords that clashes with pg_graphql
* refactor: add a decorator for name validation and use it on fields
* Migrate command to cron
* Put back command using job as well
* Build service and module + move into folder
---------
Co-authored-by: Thomas Trompette <thomast@twenty.com>
* improve timeline messaging to allow users to view the threads to which they participated
* working
* improvement
* improvements
* improvements
* fix
* remove unnecessary type