Refactor backend folder structure (#4505)

* Refactor backend folder structure

Co-authored-by: Charles Bochet <charles@twenty.com>

* fix tests

* fix

* move yoga hooks

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Weiko
2024-03-15 18:37:09 +01:00
committed by GitHub
parent afb9b3e375
commit 2c09096edd
523 changed files with 1386 additions and 1856 deletions
@@ -0,0 +1 @@
export * from './message-queue.interface';
@@ -0,0 +1,13 @@
export interface MessageQueueJob<T extends MessageQueueJobData | undefined> {
handle(data: T): Promise<void> | void;
}
export interface MessageQueueCronJobData<
T extends MessageQueueJobData | undefined,
> {
handle(data: T): Promise<void> | void;
}
export interface MessageQueueJobData {
[key: string]: any;
}
@@ -0,0 +1,37 @@
import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
import { BullMQDriverOptions } from 'src/engine/integrations/message-queue/drivers/bullmq.driver';
import { PgBossDriverOptions } from 'src/engine/integrations/message-queue/drivers/pg-boss.driver';
export enum MessageQueueDriverType {
PgBoss = 'pg-boss',
BullMQ = 'bull-mq',
Sync = 'sync',
}
export interface PgBossDriverFactoryOptions {
type: MessageQueueDriverType.PgBoss;
options: PgBossDriverOptions;
}
export interface BullMQDriverFactoryOptions {
type: MessageQueueDriverType.BullMQ;
options: BullMQDriverOptions;
}
export interface SyncDriverFactoryOptions {
type: MessageQueueDriverType.Sync;
options: Record<string, any>;
}
export type MessageQueueModuleOptions =
| PgBossDriverFactoryOptions
| BullMQDriverFactoryOptions
| SyncDriverFactoryOptions;
export type MessageQueueModuleAsyncOptions = {
useFactory: (
...args: any[]
) => MessageQueueModuleOptions | Promise<MessageQueueModuleOptions>;
} & Pick<ModuleMetadata, 'imports'> &
Pick<FactoryProvider, 'inject'>;