a722d97724
This Pr - adds a `route` table to the core schema - adds a controller to trigger route For now, we need to add a `/s/<workspace_id>` prefix to all routes We plan to create a custom domain table in order to let the users create subdomains for their workspace, and so to link their routes to a subdomain. Thank to that, we will be able to identify workspace_id from domain name, and the prefix could be `/s`. If we create a native dedicated subdomain for routes for each workspaces, the prefix could be completely removed! Here the follow up ticket to do that -> https://github.com/twentyhq/twenty/issues/14240
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
Relation,
|
|
Index,
|
|
} from 'typeorm';
|
|
|
|
import { SyncableEntity } from 'src/engine/workspace-manager/workspace-sync/interfaces/syncable-entity.interface';
|
|
|
|
import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity';
|
|
|
|
export type CronTriggerSettings = {
|
|
pattern: string;
|
|
};
|
|
|
|
@Entity({ name: 'cronTrigger', schema: 'core' })
|
|
@Index('IDX_CRON_TRIGGER_WORKSPACE_ID', ['workspaceId'])
|
|
export class CronTrigger extends SyncableEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: false, type: 'jsonb' })
|
|
settings: CronTriggerSettings;
|
|
|
|
@ManyToOne(
|
|
() => ServerlessFunctionEntity,
|
|
(serverlessFunction) => serverlessFunction.cronTriggers,
|
|
{ onDelete: 'CASCADE' },
|
|
)
|
|
@JoinColumn({ name: 'serverlessFunctionId' })
|
|
serverlessFunction: Relation<ServerlessFunctionEntity>;
|
|
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
workspaceId: string;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
}
|