Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Dec 20, 2024
1 parent 08d23a9 commit f1a616c
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .vscode/twenty.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"name": "packages/twenty-emails",
"path": "../packages/twenty-emails"
},
{
"name": "packages/twenty-shared",
"path": "../packages/twenty-shared"
},
{
"name": "packages/twenty-server",
"path": "../packages/twenty-server"
Expand Down
1 change: 1 addition & 0 deletions packages/twenty-server/jest-integration.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const jestConfig: JestConfigWithTsJest = {
}),
'^test/(.*)$': '<rootDir>/test/$1',
'twenty-emails': '<rootDir>/../twenty-emails/dist/index.js',
'twenty-shared': '<rootDir>/../twenty-shared/dist/index.js',
},
fakeTimers: {
enableGlobally: true,
Expand Down
3 changes: 2 additions & 1 deletion packages/twenty-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"tsconfig-paths": "^4.2.0",
"typeorm": "patch:[email protected]#./patches/typeorm+0.3.20.patch",
"unzipper": "^0.12.3",
"zod-to-json-schema": "^3.23.1"
"zod-to-json-schema": "^3.23.1",
"@twenty/twenty-shared": "0.40.0-canary"
},
"devDependencies": {
"@nestjs/cli": "10.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { UserModule } from 'src/engine/core-modules/user/user.module';
import { WorkspaceInvitationModule } from 'src/engine/core-modules/workspace-invitation/workspace-invitation.module';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { WorkspaceModule } from 'src/engine/core-modules/workspace/workspace.module';
import { CompanyEnrichmentModule } from 'src/engine/core-modules/company-enrichment/company-enrichment.module';
import { DataSourceModule } from 'src/engine/metadata-modules/data-source/data-source.module';
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module';
import { WorkspaceManagerModule } from 'src/engine/workspace-manager/workspace-manager.module';
Expand Down Expand Up @@ -80,7 +79,6 @@ import { JwtAuthStrategy } from './strategies/jwt.auth.strategy';
WorkspaceSSOModule,
FeatureFlagModule,
WorkspaceInvitationModule,
CompanyEnrichmentModule,
],
controllers: [
GoogleAuthController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { InjectRepository } from '@nestjs/typeorm';

import { isDefined } from 'class-validator';
import FileType from 'file-type';
import { TWENTY_ICONS_BASE_URL } from 'twenty-shared';
import { Repository } from 'typeorm';
import { v4 } from 'uuid';

Expand All @@ -23,18 +24,19 @@ import { EnvironmentService } from 'src/engine/core-modules/environment/environm
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service';
import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service';
import { UserService } from 'src/engine/core-modules/user/services/user.service';
import { User } from 'src/engine/core-modules/user/user.entity';
import { userValidator } from 'src/engine/core-modules/user/user.validate';
import { WorkspaceInvitationService } from 'src/engine/core-modules/workspace-invitation/services/workspace-invitation.service';
import { WorkspaceAuthProvider } from 'src/engine/core-modules/workspace/types/workspace.type';
import {
Workspace,
WorkspaceActivationStatus,
} from 'src/engine/core-modules/workspace/workspace.entity';
import { workspaceValidator } from 'src/engine/core-modules/workspace/workspace.validate';
import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email';
import { getImageBufferFromUrl } from 'src/utils/image';
import { WorkspaceAuthProvider } from 'src/engine/core-modules/workspace/types/workspace.type';
import { UserService } from 'src/engine/core-modules/user/services/user.service';
import { CompanyEnrichmentService } from 'src/engine/core-modules/company-enrichment/company-enrichment.service';
import { isWorkEmail } from 'src/utils/is-work-email';

export type SignInUpServiceInput = {
email: string;
Expand Down Expand Up @@ -65,7 +67,6 @@ export class SignInUpService {
private readonly environmentService: EnvironmentService,
private readonly domainManagerService: DomainManagerService,
private readonly userService: UserService,
private readonly companyEnrichmentService: CompanyEnrichmentService,
) {}

async signInUp({
Expand Down Expand Up @@ -335,16 +336,17 @@ export class SignInUpService {
}
}

const logoUrl =
await this.companyEnrichmentService.getCompanyLogoUrl(email);
const logo = isWorkEmail(email)
? `${TWENTY_ICONS_BASE_URL}/${getDomainNameByEmail(email)}`
: undefined;

const workspaceToCreate = this.workspaceRepository.create({
subdomain: await this.domainManagerService.generateSubdomain(),
displayName: '',
domainName: '',
inviteHash: v4(),
logo: logoUrl,
activationStatus: WorkspaceActivationStatus.PENDING_CREATION,
logo,
});

const workspace = await this.workspaceRepository.save(workspaceToCreate);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';

import axios, { AxiosInstance } from 'axios';
import uniqBy from 'lodash.uniqby';
import { TWENTY_COMPANIES_BASE_URL } from 'twenty-shared';
import { DeepPartial, EntityManager, ILike } from 'typeorm';

import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
Expand All @@ -25,7 +26,7 @@ export class CreateCompanyService {

constructor(private readonly twentyORMGlobalManager: TwentyORMGlobalManager) {
this.httpService = axios.create({
baseURL: 'https://twenty-companies.com',
baseURL: TWENTY_COMPANIES_BASE_URL,
});
}

Expand Down
3 changes: 2 additions & 1 deletion packages/twenty-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"paths": {
"src/*": ["packages/twenty-server/src/*"],
"test/*": ["packages/twenty-server/test/*"],
"twenty-emails": ["packages/twenty-emails/dist"]
"twenty-emails": ["packages/twenty-emails/dist"],
"twenty-shared": ["packages/twenty-shared/dist"]
}
},
"ts-node": {
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-shared/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "twenty-shared",
"name": "@twenty/twenty-shared",
"version": "0.40.0-canary",
"license": "AGPL-3.0",
"main": "./dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TWENTY_COMPANIES_BASE_URL = 'https://twenty-companies.com';
1 change: 1 addition & 0 deletions packages/twenty-shared/src/constants/TwentyIconsBaseUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TWENTY_ICONS_BASE_URL = 'https://twenty-icons.com';
2 changes: 2 additions & 0 deletions packages/twenty-shared/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './constants/TwentyCompaniesBaseUrl';
export * from './constants/TwentyIconsBaseUrl';
export * from './utils/image/getImageAbsoluteURI';

0 comments on commit f1a616c

Please sign in to comment.