This pull request introduces a new `FieldMetadataType` called `ACTOR`.
The primary objective of this new type is to add an extra column to the
following objects: `person`, `company`, `opportunity`, `note`, `task`,
and all custom objects.
This composite type contains three properties:
- `source`
```typescript
export enum FieldActorSource {
EMAIL = 'EMAIL',
CALENDAR = 'CALENDAR',
API = 'API',
IMPORT = 'IMPORT',
MANUAL = 'MANUAL',
}
```
- `workspaceMemberId`
- This property can be `undefined` in some cases and refers to the
member who created the record.
- `name`
- Serves as a fallback if the `workspaceMember` is deleted and is used
for other source types like `API`.
### Functionality
The pre-hook system has been updated to allow real-time argument
updates. When a record is created, a pre-hook can now compute and update
the arguments accordingly. This enhancement enables the `createdBy`
field to be populated with the correct values based on the
`authContext`.
The `authContext` now includes:
- An optional User entity
- An optional ApiKey entity
- The workspace entity
This provides access to the necessary data for the `createdBy` field.
In the GraphQL API, only the `source` can be specified in the
`createdBy` input. This allows the front-end to specify the source when
creating records from a CSV file.
### Front-End Handling
On the front-end, `orderBy` and `filter` are only applied to the name
property of the `ACTOR` composite type. Currently, we are unable to
apply these operations to the workspace member relation. This means that
if a workspace member changes their first name or last name, there may
be a mismatch because the name will differ from the new one. The name
displayed on the screen is based on the workspace member entity when
available.
### Missing Components
Currently, this PR does not include a `createdBy` value for the `MAIL`
and `CALENDAR` sources. These records are created in a job, and at
present, we only have access to the workspaceId within the job. To
address this, we should use a function similar to
`loadServiceWithContext`, which was recently removed from `TwentyORM`.
This function would allow us to pass the `authContext` to the jobs
without disrupting existing jobs.
Another PR will be created to handle these cases.
### Related Issues
Fixes issue #5155.
### Additional Notes
This PR doesn't include the migrations of the current records and views.
Everything works properly when the database is reset but this part is
still missing for now. We'll add that in another PR.
- There is a minor issue: front-end tests are broken since this commit:
[80c0fc7ff1).
---------
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
- Refactored components in table
- Added a isTableRecordScrolledLeftState and
isTableRecordScrolledTopState to subscribe to table scroll
- Added a zIndex logic that subscribes to those new states in new tinier
components
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
This PR was first here to fix the issue related to ticket #5004, after
some testing it seems that changing the name of a relation is actually
properly working, if we rename `ONE-TO-MANY` side, the only things that
is going to be updated is the FieldMetadata as the `joinColumn` is
stored on the opposite object.
For `MANY-TO-ONE` relations, the `joinColumn` migration is properly
generated. We need to take care that if we rename a side of a relation,
sometimes the opposite side doesn't have `inverseSideFieldKey`
implemented and used by default the name of the opposite object, so this
is going to throw an error as the field can't be found in the object.
---------
Co-authored-by: Marie <51697796+ijreilly@users.noreply.github.com>
This PR is dropping the column `targetColumnMap` of fieldMetadata
entities.
The goal of this column was to properly map field to their respecting
column in the table.
We decide to drop it and instead compute the column name on the fly when
we need it, as it's more easier to support.
Some parts of the code has been refactored to try making implementation
of composite type more easier to understand and maintain.
Fix#3760
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* build: create a new vite project for chrome extension
* feat: configure theme per the frontend codebase for chrome extension
* feat: inject the add to twenty button into linkedin profile page
* feat: create the api key form ui and render it on the options page
* feat: inject the add to twenty button into linkedin company page
* feat: scrape required data from both the user profile and the company profile
* refactor: move modules into options because it is the only page using react for now
* fix: show add to twenty button without having to reload the single page application
* fix: extract domain of the business website instead of scrapping the industry type
* feat: store api key to local storage and open options page when trying to store data without setting a key
* feat: send data to the backend upon click and store it to the database
* fix: open options page upon clicking the extension icon
* fix: update terminology from user to person to match the codebase convention
* fix: adopt chrome extension to monorepo approach using nx and get the development server working
* fix: update vite config for build command to work per the requirement
* feat: add instructions in the readme file to install the extension for local testing
* fix: move server base url to a dotenv file and replace the hard-coded url
* feat: permit user to configure a custom route for the server from the options page
* fix: fetch api key and route from local storage and display on options page to inform users of their choices
* fix: move front base url to dotenv and replace the hard-coded url
* fix: remove the trailing slash from person and company linkedin username
* fix: improve code commenting to explain implementation somewhat better
* ci: introduce a workflow to build chrome extension to ensure it can be published
* fix: format files to display code in a consistent manner per the prettier configuration in codebase
* fix: improve the commenting significantly to explain important and hard-to-understand parts of the code
* fix: remove unused permissions from the manifest file for publishing to the chrome web store
* Add nx
* Fix vale
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* merge squashed
- A couple of CJS modules into ESM (config mostly)
- Vite complains about node.js modules: fixed `useIsMatchingLocation.ts`
> or use rollupOptions in vite.config.ts
> ref: f0e4f59d97/vite.config.js (L6)
- Adjust Storybook to work with Vite: use @storybook/test
- Use SWC for jest tranformations
- Remove unused deps:
- ts-jest: replaced with @swc/jest, typecheck by `tsc`
- babel plugins
- @svgr/plugin-jsx: not used
- @testing-library/user-event: handled by @storybook/test
- @typescript-eslint/utils: was not plugged in
- tsup, esbuild-plugin-svgr: will look into that later
- Install Vite required deps, and remove craco/webpack deps
- Adjust SVG to work with Vite as components
- Fixed `Step.tsx`: I dont know if one should be swaped for the other,
but there should be no slash
- Initial formating and linting:
- removed empty object params
- sorting imports, etc..
* prettier: fix pattern
* coverage: sb coverage report isnt working
* Add missing pieces
* `yarn lint --fix`
* fix: scripts permissions
* tsc: cut errors in half
* fix: remove `react-app-env.d.ts`
* tsc: all fixed, except `react-data-grid` types issue
* eslint: ignore env-config.js
* eslint: Align ci with config
* msw: bypass testing warnings
ref: https://stackoverflow.com/questions/68024935/msw-logging-warnings-for-unhandled-supertest-requests
* rebase: and fix things
* Adjust to current `graphql-codegen` no ESM support
* Remove vite plugin and use built-in methods
* rebase: and some fixes
* quick fix + `corepack use yarn@1.22.19`
* Fix build errors
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* added figma link to README.md
* added figma to the recommended extensions for the project
* updated useful tips in 'work with Figma' section of the docs to add Figma extension for VSCode
* removing yarn.lock
* modified Figma extension docs in 'Work with Figma'
* added Mdx Preview extension to recommended extensions
* Begin adding show view and refactoring threads to become notes
* Progress on design
* Progress redesign timeline
* Dropdown button, design improvement
* Open comment thread edit mode in drawer
* Autosave local storage and commentThreadcount
* Improve display and fix missing key issue
* Remove some hardcoded CSS properties
* Create button
* Split company show into ui/business + fix eslint
* Fix font weight
* Begin auto-save on edit mode
* Save server-side query result to Apollo cache
* Fix save behavior
* Refetch timeline after creating note
* Rename createCommentThreadWithComment
* Improve styling
* Revert "Improve styling"
This reverts commit 9fbbf2db00.
* Improve CSS styling
* Bring back border radius inadvertently removed
* padding adjustment
* Improve blocknote design
* Improve edit mode display
* Remove Comments.tsx
* Remove irrelevant comment stories
* Removed un-necessary panel component
* stop using fragment, move trash icon
* Add a basic story for CompanyShow
* Add a basic People show view
* Fix storybook tests
* Add very basic Person story
* Refactor PR1
* Refactor part 2
* Refactor part 3
* Refactor part 4
* Fix tests
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* Added prisma to suggested extension in container
* Added comments and authors on drawer with proper resolving
* Fix lint
* Fix console log
* Fixed generated front graphql from rebase
This PR is a bit messy:
adding graphql schema
adding create company creation on company select on People page
some frontend refactoring to be continued
---------
Co-authored-by: Charles Bochet <charles@twenty.com>
* Remove hasura and hasura-auth
* Move all models to prisma
* Start implementing graphql
* chore: clean package json
* chore: make the code build
* chore: get initial graphql.tsx file
* feature: use typegql as qgl server
* refactor: small refactoring
* refactor: clean tests
* bugfix: make all filters not case sensitive
* chore: remove unused imports
---------
Co-authored-by: Sammy Teillet <sammy.teillet@gmail.com>
* Ignore node_modules
* Use bash-compatible dotenv format
While still being compatible with dotenv, this
also allows sourcing the file to export all
variables in bash.
* Add prettier extension to recommendations
* Move to port 5001 to avoid conflict with macOS services
* Add workspace
* Add devcontainer
This automatically starts with all environment
variables available locally.
It brings up services which are dependent on each
other individually and verifies health before
moving on to the next service.
* Split init into clean, up, and logs tasks.
This allows the developer to set up .env and .npmrc
files before running services, and does not require
starting from a clean db every time the devcontainer
is restarted.
* Copy .env when creating codespace
* Automatically run UP command upon devcontainer creation
* Fix log message
---------
Co-authored-by: Felix Malfait <felix.malfait@gmail.com>