mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-27 01:05:08 +03:00
6432ad39b9
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>
107 lines
2.5 KiB
Plaintext
107 lines
2.5 KiB
Plaintext
{
|
|
"folders": [
|
|
{
|
|
"name": "ROOT",
|
|
"path": "../"
|
|
},
|
|
{
|
|
"name": "packages/twenty-chrome-extension",
|
|
"path": "../packages/twenty-chrome-extension"
|
|
},
|
|
{
|
|
"name": "packages/twenty-docker",
|
|
"path": "../packages/twenty-docker"
|
|
},
|
|
{
|
|
"name": "packages/twenty-front",
|
|
"path": "../packages/twenty-front"
|
|
},
|
|
{
|
|
"name": "packages/twenty-ui",
|
|
"path": "../packages/twenty-ui"
|
|
},
|
|
{
|
|
"name": "packages/twenty-postgres",
|
|
"path": "../packages/twenty-postgres"
|
|
},
|
|
{
|
|
"name": "packages/twenty-server",
|
|
"path": "../packages/twenty-server"
|
|
},
|
|
{
|
|
"name": "packages/twenty-utils",
|
|
"path": "../packages/twenty-utils"
|
|
},
|
|
{
|
|
"name": "packages/twenty-zapier",
|
|
"path": "../packages/twenty-zapier"
|
|
},
|
|
{
|
|
"name": "tools/eslint-rules",
|
|
"path": "../tools/eslint-rules"
|
|
},
|
|
],
|
|
"settings": {
|
|
"editor.formatOnSave": false,
|
|
"files.eol": "auto",
|
|
"[typescript]": {
|
|
"editor.formatOnSave": false,
|
|
"editor.codeActionsOnSave": {
|
|
"source.fixAll.eslint": "explicit",
|
|
"source.addMissingImports": "always"
|
|
}
|
|
},
|
|
"[javascript]": {
|
|
"editor.formatOnSave": false,
|
|
"editor.codeActionsOnSave": {
|
|
"source.fixAll.eslint": "explicit",
|
|
"source.addMissingImports": "always"
|
|
}
|
|
},
|
|
"[typescriptreact]": {
|
|
"editor.formatOnSave": false,
|
|
"editor.codeActionsOnSave": {
|
|
"source.fixAll.eslint": "explicit",
|
|
"source.addMissingImports": "always"
|
|
}
|
|
},
|
|
"[json]": {
|
|
"editor.formatOnSave": true
|
|
},
|
|
"javascript.format.enable": false,
|
|
"typescript.format.enable": false,
|
|
"cSpell.enableFiletypes": [
|
|
"!javascript",
|
|
"!json",
|
|
"!typescript",
|
|
"!typescriptreact",
|
|
"md",
|
|
"mdx"
|
|
],
|
|
"cSpell.words": [
|
|
"twentyhq"
|
|
],
|
|
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
"[javascript][typescript][typescriptreact]": {
|
|
"editor.codeActionsOnSave": {
|
|
"source.fixAll.eslint": "explicit",
|
|
"source.addMissingImports": "always"
|
|
}
|
|
},
|
|
"search.exclude": {
|
|
"**/.yarn": true,
|
|
},
|
|
"files.exclude": {
|
|
"packages/": true
|
|
},
|
|
"jest.runMode": "on-demand",
|
|
"jest.disabledWorkspaceFolders": [
|
|
"ROOT",
|
|
"packages/twenty-zapier",
|
|
"packages/twenty-docker",
|
|
"packages/twenty-utils",
|
|
"packages/twenty-postgres"
|
|
]
|
|
}
|
|
}
|