Seed company workflow for email upserts (#18909)

@thomtrp

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Thomas des Francs
2026-03-27 13:47:07 +01:00
committed by GitHub
parent 56056b885d
commit 50ea560e57
20 changed files with 1350 additions and 467 deletions
@@ -3,6 +3,7 @@ import { Injectable } from '@nestjs/common';
import crypto from 'crypto';
import { promises as fs } from 'fs';
import { dirname, join } from 'path';
import { type QueryRunner } from 'typeorm';
import { FileFolder } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
@@ -40,6 +41,7 @@ type UpdateSourceFilesParams = Omit<
'builtHandlerPath'
> & {
sourceHandlerCode: string;
queryRunner?: QueryRunner;
};
type GetSourceCodeParams = Identifier & {
@@ -128,6 +130,7 @@ export class LogicFunctionResourceService {
workspaceId,
applicationUniversalIdentifier,
sourceHandlerCode,
queryRunner,
}: UpdateSourceFilesParams): Promise<void> {
await this.fileStorageService.writeFile({
workspaceId,
@@ -137,6 +140,20 @@ export class LogicFunctionResourceService {
sourceFile: sourceHandlerCode,
settings: { isTemporaryFile: false, toDelete: false },
mimeType: 'application/typescript',
queryRunner,
});
}
async deleteSourceFile({
sourceHandlerPath,
workspaceId,
applicationUniversalIdentifier,
}: GetSourceCodeParams): Promise<void> {
await this.fileStorageService.delete({
workspaceId,
applicationUniversalIdentifier,
fileFolder: FileFolder.Source,
resourcePath: sourceHandlerPath,
});
}