Commit Graph

13 Commits

Author SHA1 Message Date
e3f7cec82f Fix import twenty-shared (#9754)
In this PR:
- removing rootDir / baseUrl from any tsconfig.json
- we need to keep it in tsconfig.spec.json and also specify rootDir in
jest.config.ts moduleMapper because of the way nx jest executor works
(automatically moving back to root)
- we need to explictly specify the depencies to twenty-shared /
twenty-emails (built packages) in packages package.json to help nx
understand dependencies
2025-01-20 23:10:39 +01:00
7d7955fc65 Move capitalize into twenty-shared (#9414)
capitalize had been moved into twenty-shared. Let's remove the
duplicates in server and front !
2025-01-07 14:25:29 +00:00
2651379ccc Add automatic company logo fetching during workspace creation (#9158)
Closes #9151 

## Description
This PR automatically sets a workspace's logo based on the user's work
email domain during signup. When a user creates a new workspace using
their work email (e.g., @airbnb.com), the system will fetch and set
their company logo from twenty-icons.com as the default workspace logo.

## Implementation Details
- Added a new `CompanyEnrichmentService` to handle company-related data
enrichment
- Created a modular architecture that supports future enrichment
features (e.g., company name, details)
- Integrated with existing work email detection
- Maintains user ability to override the logo later

## Testing

https://github.com/user-attachments/assets/f7855c99-462a-4053-9e52-29649e954275


I tested the following scenarios:
- Signing up with a work email (e.g., @company.com) → Logo is
automatically set
- Signing up with a personal email (e.g., @gmail.com) → No logo is set
- User can still upload a custom logo after automatic setting

## Technical Notes
- Uses existing `isWorkEmail` utility
- Structured for future extensibility (additional company data
enrichment)
- No breaking changes to existing functionality

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2024-12-22 09:24:27 +01:00
eef7f1661d feat: add integration tests (#6923)
### Summary

This PR introduces several integration tests, a mix of manually written
tests and those generated using the `generate-integration-tests` Python
script located in the `scripts` folder.

### Tests Added:
- **Authentication tests**: Validating login, registration, and token
handling.
- **FindMany queries**: Fetching multiple records for all existing
entities that do not require input arguments.

### How the Integration Tests Work:
- A `setupTest` function is called during the Jest test run. This
function initializes a test instance of the application and exposes it
on a dedicated port.
- Since tests are executed in isolated workers, they do not have direct
access to the in-memory app instance. Instead, the tests query the
application through the exposed port.
- A static accessToken is used, this one as a big expiration time so it
will never expire (365 years)
- The queries are executed, and the results are validated against
expected outcomes.

### Current State and Next Steps:
- These tests currently run using the existing development seed data. We
plan to introduce more comprehensive test data using `faker` to improve
coverage.
- At the moment, the only mutation tests implemented are for
authentication. Future updates should include broader mutation testing
for other entities.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-09-20 11:02:52 +02:00
088d061b3e feat: twenty orm for standard and custom objects (#6178)
### Overview

This PR builds upon #5153, adding the ability to get a repository for
custom objects. The `entitySchema` is now generated for both standard
and custom objects based on metadata stored in the database instead of
the decorated `WorkspaceEntity` in the code. This change ensures that
standard objects with custom fields and relations can also support
custom objects.

### Implementation Details

#### Key Changes:

- **Dynamic Schema Generation:** The `entitySchema` for standard and
custom objects is now dynamically generated from the metadata stored in
the database. This shift allows for greater flexibility and
adaptability, particularly for standard objects with custom fields and
relations.
  
- **Custom Object Repository Retrieval:** A repository for a custom
object can be retrieved using `TwentyORMManager` based on the object's
name. Here's an example of how this can be achieved:

  ```typescript
const repository = await this.twentyORMManager.getRepository('custom');
  /*
* `repository` variable will be typed as follows, ensuring that standard
fields and relations are properly typed:
   * const repository: WorkspaceRepository<CustomWorkspaceEntity & {
   *    [key: string]: any;
   * }>
   */
  const res = await repository.find({});
  ```

Fix #6179

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Weiko <corentin@twenty.com>
2024-07-19 18:23:52 +02:00
27fdb00d07 4586 fix workspace member feature (#4680)
* Fix import

* Handle delete workspace member consequences

* Add a patch to request deleted workspace member's userId

* Remove useless relations

* Handle delete workspace + refactor

* Add missing migration

* Fix test

* Code review returns

* Add missing operation in migration file

* Fix code review return update

* Fix workspaceMember<>ConnectedAccount relation
2024-03-28 17:59:48 +01:00
41bed57be9 [backend] add cache storage module (#4320)
* [backend] add cache storage module

* update docs

* update default TTL to a week
2024-03-07 14:07:01 +01:00
ec20117e80 chore: make twenty-server nest command scripts depend on twenty-email… (#4055)
chore: make twenty-server nest command scripts depend on twenty-emails build

Closes #4013
2024-02-20 14:35:09 +01:00
a654205dbc chore: set up twenty-emails config so build isn't needed in development (#3619)
* chore: set up twenty-emails config so build isn't needed in development

* fix: fix script dependency

* chore: use @vitejs/plugin-react-swc

* Remove useless dependancy

* Fix typing

* chore: use baseUrl in twenty-emails

* chore: fix docker server prod build

* refactor: optimize Docker file and tsconfig

* fix: fix WORKDIR in docker

---------

Co-authored-by: martmull <martmull@hotmail.fr>
2024-01-29 06:17:12 -03:00
e358d677f9 Move emails to dedicated package (#3542)
* Add new package

* Add twenty-emails package

* Use generated files from twenty-emails in twenty-server

* Fix deleted file

* Import emails templates properly
2024-01-22 16:21:56 +01:00
b3d9bed91d Enforce email templating (#3355)
* Add react-email

* WIP

* Fix import error

* Rename services

* Update logging

* Update email template

* Update email template

* Add Base Email template

* Move to proper place

* Remove test files

* Update logo

* Add email theme

* Revert "Remove test files"

This reverts commit fe062dd05166b95125cf99f2165cc20efb6c275a.

* Add email theme 2

* Revert "Revert "Remove test files""

This reverts commit 6c6471273ad765788f2eaf5a5614209edfb965ce.

* Revert "Revert "Revert "Remove test files"""

This reverts commit f851333c24e9cfe3f425c9cbbd1e079efce5c3dd.

* Revert "Revert "Revert "Revert "Remove test files""""

This reverts commit 7838e19e88e269026e24803f26cd52b467b4ef36.

* Fix theme
2024-01-11 20:29:20 +01:00
8483cf0b4b POC: chore: use Nx workspace lint rules (#3163)
* chore: use Nx workspace lint rules

Closes #3162

* Fix lint

* Fix lint on BE

* Fix tests

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-01-03 23:07:25 +01:00
5bdca9de6c Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00