chore: change workflow column name (#24349)

chore-change-workflow-column-name
This commit is contained in:
Alex
2025-12-02 14:40:17 -06:00
committed by GitHub
parent f07d1441ea
commit f5df5fa98d
13 changed files with 127 additions and 100 deletions

View File

@@ -14,7 +14,7 @@ class WorkflowActionItemDto {
/// Returns a new [WorkflowActionItemDto] instance. /// Returns a new [WorkflowActionItemDto] instance.
WorkflowActionItemDto({ WorkflowActionItemDto({
this.actionConfig, this.actionConfig,
required this.actionId, required this.pluginActionId,
}); });
/// ///
@@ -25,21 +25,21 @@ class WorkflowActionItemDto {
/// ///
Object? actionConfig; Object? actionConfig;
String actionId; String pluginActionId;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WorkflowActionItemDto && bool operator ==(Object other) => identical(this, other) || other is WorkflowActionItemDto &&
other.actionConfig == actionConfig && other.actionConfig == actionConfig &&
other.actionId == actionId; other.pluginActionId == pluginActionId;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(actionConfig == null ? 0 : actionConfig!.hashCode) + (actionConfig == null ? 0 : actionConfig!.hashCode) +
(actionId.hashCode); (pluginActionId.hashCode);
@override @override
String toString() => 'WorkflowActionItemDto[actionConfig=$actionConfig, actionId=$actionId]'; String toString() => 'WorkflowActionItemDto[actionConfig=$actionConfig, pluginActionId=$pluginActionId]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -48,7 +48,7 @@ class WorkflowActionItemDto {
} else { } else {
// json[r'actionConfig'] = null; // json[r'actionConfig'] = null;
} }
json[r'actionId'] = this.actionId; json[r'pluginActionId'] = this.pluginActionId;
return json; return json;
} }
@@ -62,7 +62,7 @@ class WorkflowActionItemDto {
return WorkflowActionItemDto( return WorkflowActionItemDto(
actionConfig: mapValueOfType<Object>(json, r'actionConfig'), actionConfig: mapValueOfType<Object>(json, r'actionConfig'),
actionId: mapValueOfType<String>(json, r'actionId')!, pluginActionId: mapValueOfType<String>(json, r'pluginActionId')!,
); );
} }
return null; return null;
@@ -110,7 +110,7 @@ class WorkflowActionItemDto {
/// The list of required keys that must be present in a JSON. /// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{ static const requiredKeys = <String>{
'actionId', 'pluginActionId',
}; };
} }

View File

@@ -14,41 +14,41 @@ class WorkflowActionResponseDto {
/// Returns a new [WorkflowActionResponseDto] instance. /// Returns a new [WorkflowActionResponseDto] instance.
WorkflowActionResponseDto({ WorkflowActionResponseDto({
required this.actionConfig, required this.actionConfig,
required this.actionId,
required this.id, required this.id,
required this.order, required this.order,
required this.pluginActionId,
required this.workflowId, required this.workflowId,
}); });
Object? actionConfig; Object? actionConfig;
String actionId;
String id; String id;
num order; num order;
String pluginActionId;
String workflowId; String workflowId;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WorkflowActionResponseDto && bool operator ==(Object other) => identical(this, other) || other is WorkflowActionResponseDto &&
other.actionConfig == actionConfig && other.actionConfig == actionConfig &&
other.actionId == actionId &&
other.id == id && other.id == id &&
other.order == order && other.order == order &&
other.pluginActionId == pluginActionId &&
other.workflowId == workflowId; other.workflowId == workflowId;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(actionConfig == null ? 0 : actionConfig!.hashCode) + (actionConfig == null ? 0 : actionConfig!.hashCode) +
(actionId.hashCode) +
(id.hashCode) + (id.hashCode) +
(order.hashCode) + (order.hashCode) +
(pluginActionId.hashCode) +
(workflowId.hashCode); (workflowId.hashCode);
@override @override
String toString() => 'WorkflowActionResponseDto[actionConfig=$actionConfig, actionId=$actionId, id=$id, order=$order, workflowId=$workflowId]'; String toString() => 'WorkflowActionResponseDto[actionConfig=$actionConfig, id=$id, order=$order, pluginActionId=$pluginActionId, workflowId=$workflowId]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -57,9 +57,9 @@ class WorkflowActionResponseDto {
} else { } else {
// json[r'actionConfig'] = null; // json[r'actionConfig'] = null;
} }
json[r'actionId'] = this.actionId;
json[r'id'] = this.id; json[r'id'] = this.id;
json[r'order'] = this.order; json[r'order'] = this.order;
json[r'pluginActionId'] = this.pluginActionId;
json[r'workflowId'] = this.workflowId; json[r'workflowId'] = this.workflowId;
return json; return json;
} }
@@ -74,9 +74,9 @@ class WorkflowActionResponseDto {
return WorkflowActionResponseDto( return WorkflowActionResponseDto(
actionConfig: mapValueOfType<Object>(json, r'actionConfig'), actionConfig: mapValueOfType<Object>(json, r'actionConfig'),
actionId: mapValueOfType<String>(json, r'actionId')!,
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
order: num.parse('${json[r'order']}'), order: num.parse('${json[r'order']}'),
pluginActionId: mapValueOfType<String>(json, r'pluginActionId')!,
workflowId: mapValueOfType<String>(json, r'workflowId')!, workflowId: mapValueOfType<String>(json, r'workflowId')!,
); );
} }
@@ -126,9 +126,9 @@ class WorkflowActionResponseDto {
/// The list of required keys that must be present in a JSON. /// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{ static const requiredKeys = <String>{
'actionConfig', 'actionConfig',
'actionId',
'id', 'id',
'order', 'order',
'pluginActionId',
'workflowId', 'workflowId',
}; };
} }

View File

@@ -14,7 +14,7 @@ class WorkflowFilterItemDto {
/// Returns a new [WorkflowFilterItemDto] instance. /// Returns a new [WorkflowFilterItemDto] instance.
WorkflowFilterItemDto({ WorkflowFilterItemDto({
this.filterConfig, this.filterConfig,
required this.filterId, required this.pluginFilterId,
}); });
/// ///
@@ -25,21 +25,21 @@ class WorkflowFilterItemDto {
/// ///
Object? filterConfig; Object? filterConfig;
String filterId; String pluginFilterId;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WorkflowFilterItemDto && bool operator ==(Object other) => identical(this, other) || other is WorkflowFilterItemDto &&
other.filterConfig == filterConfig && other.filterConfig == filterConfig &&
other.filterId == filterId; other.pluginFilterId == pluginFilterId;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(filterConfig == null ? 0 : filterConfig!.hashCode) + (filterConfig == null ? 0 : filterConfig!.hashCode) +
(filterId.hashCode); (pluginFilterId.hashCode);
@override @override
String toString() => 'WorkflowFilterItemDto[filterConfig=$filterConfig, filterId=$filterId]'; String toString() => 'WorkflowFilterItemDto[filterConfig=$filterConfig, pluginFilterId=$pluginFilterId]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -48,7 +48,7 @@ class WorkflowFilterItemDto {
} else { } else {
// json[r'filterConfig'] = null; // json[r'filterConfig'] = null;
} }
json[r'filterId'] = this.filterId; json[r'pluginFilterId'] = this.pluginFilterId;
return json; return json;
} }
@@ -62,7 +62,7 @@ class WorkflowFilterItemDto {
return WorkflowFilterItemDto( return WorkflowFilterItemDto(
filterConfig: mapValueOfType<Object>(json, r'filterConfig'), filterConfig: mapValueOfType<Object>(json, r'filterConfig'),
filterId: mapValueOfType<String>(json, r'filterId')!, pluginFilterId: mapValueOfType<String>(json, r'pluginFilterId')!,
); );
} }
return null; return null;
@@ -110,7 +110,7 @@ class WorkflowFilterItemDto {
/// The list of required keys that must be present in a JSON. /// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{ static const requiredKeys = <String>{
'filterId', 'pluginFilterId',
}; };
} }

View File

@@ -14,41 +14,41 @@ class WorkflowFilterResponseDto {
/// Returns a new [WorkflowFilterResponseDto] instance. /// Returns a new [WorkflowFilterResponseDto] instance.
WorkflowFilterResponseDto({ WorkflowFilterResponseDto({
required this.filterConfig, required this.filterConfig,
required this.filterId,
required this.id, required this.id,
required this.order, required this.order,
required this.pluginFilterId,
required this.workflowId, required this.workflowId,
}); });
Object? filterConfig; Object? filterConfig;
String filterId;
String id; String id;
num order; num order;
String pluginFilterId;
String workflowId; String workflowId;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WorkflowFilterResponseDto && bool operator ==(Object other) => identical(this, other) || other is WorkflowFilterResponseDto &&
other.filterConfig == filterConfig && other.filterConfig == filterConfig &&
other.filterId == filterId &&
other.id == id && other.id == id &&
other.order == order && other.order == order &&
other.pluginFilterId == pluginFilterId &&
other.workflowId == workflowId; other.workflowId == workflowId;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(filterConfig == null ? 0 : filterConfig!.hashCode) + (filterConfig == null ? 0 : filterConfig!.hashCode) +
(filterId.hashCode) +
(id.hashCode) + (id.hashCode) +
(order.hashCode) + (order.hashCode) +
(pluginFilterId.hashCode) +
(workflowId.hashCode); (workflowId.hashCode);
@override @override
String toString() => 'WorkflowFilterResponseDto[filterConfig=$filterConfig, filterId=$filterId, id=$id, order=$order, workflowId=$workflowId]'; String toString() => 'WorkflowFilterResponseDto[filterConfig=$filterConfig, id=$id, order=$order, pluginFilterId=$pluginFilterId, workflowId=$workflowId]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -57,9 +57,9 @@ class WorkflowFilterResponseDto {
} else { } else {
// json[r'filterConfig'] = null; // json[r'filterConfig'] = null;
} }
json[r'filterId'] = this.filterId;
json[r'id'] = this.id; json[r'id'] = this.id;
json[r'order'] = this.order; json[r'order'] = this.order;
json[r'pluginFilterId'] = this.pluginFilterId;
json[r'workflowId'] = this.workflowId; json[r'workflowId'] = this.workflowId;
return json; return json;
} }
@@ -74,9 +74,9 @@ class WorkflowFilterResponseDto {
return WorkflowFilterResponseDto( return WorkflowFilterResponseDto(
filterConfig: mapValueOfType<Object>(json, r'filterConfig'), filterConfig: mapValueOfType<Object>(json, r'filterConfig'),
filterId: mapValueOfType<String>(json, r'filterId')!,
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
order: num.parse('${json[r'order']}'), order: num.parse('${json[r'order']}'),
pluginFilterId: mapValueOfType<String>(json, r'pluginFilterId')!,
workflowId: mapValueOfType<String>(json, r'workflowId')!, workflowId: mapValueOfType<String>(json, r'workflowId')!,
); );
} }
@@ -126,9 +126,9 @@ class WorkflowFilterResponseDto {
/// The list of required keys that must be present in a JSON. /// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{ static const requiredKeys = <String>{
'filterConfig', 'filterConfig',
'filterId',
'id', 'id',
'order', 'order',
'pluginFilterId',
'workflowId', 'workflowId',
}; };
} }

View File

@@ -23162,13 +23162,13 @@
"actionConfig": { "actionConfig": {
"type": "object" "type": "object"
}, },
"actionId": { "pluginActionId": {
"format": "uuid", "format": "uuid",
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"actionId" "pluginActionId"
], ],
"type": "object" "type": "object"
}, },
@@ -23178,24 +23178,24 @@
"nullable": true, "nullable": true,
"type": "object" "type": "object"
}, },
"actionId": {
"type": "string"
},
"id": { "id": {
"type": "string" "type": "string"
}, },
"order": { "order": {
"type": "number" "type": "number"
}, },
"pluginActionId": {
"type": "string"
},
"workflowId": { "workflowId": {
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"actionConfig", "actionConfig",
"actionId",
"id", "id",
"order", "order",
"pluginActionId",
"workflowId" "workflowId"
], ],
"type": "object" "type": "object"
@@ -23244,13 +23244,13 @@
"filterConfig": { "filterConfig": {
"type": "object" "type": "object"
}, },
"filterId": { "pluginFilterId": {
"format": "uuid", "format": "uuid",
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"filterId" "pluginFilterId"
], ],
"type": "object" "type": "object"
}, },
@@ -23260,24 +23260,24 @@
"nullable": true, "nullable": true,
"type": "object" "type": "object"
}, },
"filterId": {
"type": "string"
},
"id": { "id": {
"type": "string" "type": "string"
}, },
"order": { "order": {
"type": "number" "type": "number"
}, },
"pluginFilterId": {
"type": "string"
},
"workflowId": { "workflowId": {
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"filterConfig", "filterConfig",
"filterId",
"id", "id",
"order", "order",
"pluginFilterId",
"workflowId" "workflowId"
], ],
"type": "object" "type": "object"

View File

@@ -1729,16 +1729,16 @@ export type CreateProfileImageResponseDto = {
}; };
export type WorkflowActionResponseDto = { export type WorkflowActionResponseDto = {
actionConfig: object | null; actionConfig: object | null;
actionId: string;
id: string; id: string;
order: number; order: number;
pluginActionId: string;
workflowId: string; workflowId: string;
}; };
export type WorkflowFilterResponseDto = { export type WorkflowFilterResponseDto = {
filterConfig: object | null; filterConfig: object | null;
filterId: string;
id: string; id: string;
order: number; order: number;
pluginFilterId: string;
workflowId: string; workflowId: string;
}; };
export type WorkflowResponseDto = { export type WorkflowResponseDto = {
@@ -1754,11 +1754,11 @@ export type WorkflowResponseDto = {
}; };
export type WorkflowActionItemDto = { export type WorkflowActionItemDto = {
actionConfig?: object; actionConfig?: object;
actionId: string; pluginActionId: string;
}; };
export type WorkflowFilterItemDto = { export type WorkflowFilterItemDto = {
filterConfig?: object; filterConfig?: object;
filterId: string; pluginFilterId: string;
}; };
export type WorkflowCreateDto = { export type WorkflowCreateDto = {
actions: WorkflowActionItemDto[]; actions: WorkflowActionItemDto[];

View File

@@ -301,14 +301,14 @@ export type Workflow = Selectable<WorkflowTable> & {
export type WorkflowFilter = Selectable<WorkflowFilterTable> & { export type WorkflowFilter = Selectable<WorkflowFilterTable> & {
workflowId: string; workflowId: string;
filterId: string; pluginFilterId: string;
filterConfig: FilterConfig | null; filterConfig: FilterConfig | null;
order: number; order: number;
}; };
export type WorkflowAction = Selectable<WorkflowActionTable> & { export type WorkflowAction = Selectable<WorkflowActionTable> & {
workflowId: string; workflowId: string;
actionId: string; pluginActionId: string;
actionConfig: ActionConfig | null; actionConfig: ActionConfig | null;
order: number; order: number;
}; };

View File

@@ -7,7 +7,7 @@ import { Optional, ValidateBoolean, ValidateEnum } from 'src/validation';
export class WorkflowFilterItemDto { export class WorkflowFilterItemDto {
@IsUUID() @IsUUID()
filterId!: string; pluginFilterId!: string;
@IsObject() @IsObject()
@Optional() @Optional()
@@ -16,7 +16,7 @@ export class WorkflowFilterItemDto {
export class WorkflowActionItemDto { export class WorkflowActionItemDto {
@IsUUID() @IsUUID()
actionId!: string; pluginActionId!: string;
@IsObject() @IsObject()
@Optional() @Optional()
@@ -86,7 +86,7 @@ export class WorkflowResponseDto {
export class WorkflowFilterResponseDto { export class WorkflowFilterResponseDto {
id!: string; id!: string;
workflowId!: string; workflowId!: string;
filterId!: string; pluginFilterId!: string;
filterConfig!: FilterConfig | null; filterConfig!: FilterConfig | null;
order!: number; order!: number;
} }
@@ -94,7 +94,7 @@ export class WorkflowFilterResponseDto {
export class WorkflowActionResponseDto { export class WorkflowActionResponseDto {
id!: string; id!: string;
workflowId!: string; workflowId!: string;
actionId!: string; pluginActionId!: string;
actionConfig!: ActionConfig | null; actionConfig!: ActionConfig | null;
order!: number; order!: number;
} }
@@ -103,7 +103,7 @@ export function mapWorkflowFilter(filter: WorkflowFilter): WorkflowFilterRespons
return { return {
id: filter.id, id: filter.id,
workflowId: filter.workflowId, workflowId: filter.workflowId,
filterId: filter.filterId, pluginFilterId: filter.pluginFilterId,
filterConfig: filter.filterConfig, filterConfig: filter.filterConfig,
order: filter.order, order: filter.order,
}; };
@@ -113,7 +113,7 @@ export function mapWorkflowAction(action: WorkflowAction): WorkflowActionRespons
return { return {
id: action.id, id: action.id,
workflowId: action.workflowId, workflowId: action.workflowId,
actionId: action.actionId, pluginActionId: action.pluginActionId,
actionConfig: action.actionConfig, actionConfig: action.actionConfig,
order: action.order, order: action.order,
}; };

View File

@@ -0,0 +1,27 @@
import { Kysely, sql } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await sql`DROP INDEX "workflow_filter_filterId_idx";`.execute(db);
await sql`DROP INDEX "workflow_action_actionId_idx";`.execute(db);
await sql`ALTER TABLE "workflow_filter" DROP CONSTRAINT "workflow_filter_filterId_fkey";`.execute(db);
await sql`ALTER TABLE "workflow_action" DROP CONSTRAINT "workflow_action_actionId_fkey";`.execute(db);
await sql`ALTER TABLE "workflow_filter" RENAME COLUMN "filterId" TO "pluginFilterId";`.execute(db);
await sql`ALTER TABLE "workflow_action" RENAME COLUMN "actionId" TO "pluginActionId";`.execute(db);
await sql`ALTER TABLE "workflow_filter" ADD CONSTRAINT "workflow_filter_pluginFilterId_fkey" FOREIGN KEY ("pluginFilterId") REFERENCES "plugin_filter" ("id") ON UPDATE CASCADE ON DELETE CASCADE;`.execute(db);
await sql`ALTER TABLE "workflow_action" ADD CONSTRAINT "workflow_action_pluginActionId_fkey" FOREIGN KEY ("pluginActionId") REFERENCES "plugin_action" ("id") ON UPDATE CASCADE ON DELETE CASCADE;`.execute(db);
await sql`CREATE INDEX "workflow_filter_pluginFilterId_idx" ON "workflow_filter" ("pluginFilterId");`.execute(db);
await sql`CREATE INDEX "workflow_action_pluginActionId_idx" ON "workflow_action" ("pluginActionId");`.execute(db);
}
export async function down(db: Kysely<any>): Promise<void> {
await sql`DROP INDEX "workflow_filter_pluginFilterId_idx";`.execute(db);
await sql`DROP INDEX "workflow_action_pluginActionId_idx";`.execute(db);
await sql`ALTER TABLE "workflow_filter" DROP CONSTRAINT "workflow_filter_pluginFilterId_fkey";`.execute(db);
await sql`ALTER TABLE "workflow_action" DROP CONSTRAINT "workflow_action_pluginActionId_fkey";`.execute(db);
await sql`ALTER TABLE "workflow_filter" RENAME COLUMN "pluginFilterId" TO "filterId";`.execute(db);
await sql`ALTER TABLE "workflow_action" RENAME COLUMN "pluginActionId" TO "actionId";`.execute(db);
await sql`ALTER TABLE "workflow_filter" ADD CONSTRAINT "workflow_filter_filterId_fkey" FOREIGN KEY ("filterId") REFERENCES "plugin_filter" ("id") ON UPDATE CASCADE ON DELETE CASCADE;`.execute(db);
await sql`ALTER TABLE "workflow_action" ADD CONSTRAINT "workflow_action_actionId_fkey" FOREIGN KEY ("actionId") REFERENCES "plugin_action" ("id") ON UPDATE CASCADE ON DELETE CASCADE;`.execute(db);
await sql`CREATE INDEX "workflow_filter_filterId_idx" ON "workflow_filter" ("filterId");`.execute(db);
await sql`CREATE INDEX "workflow_action_actionId_idx" ON "workflow_action" ("actionId");`.execute(db);
}

View File

@@ -38,7 +38,7 @@ export class WorkflowTable {
} }
@Index({ columns: ['workflowId', 'order'] }) @Index({ columns: ['workflowId', 'order'] })
@Index({ columns: ['filterId'] }) @Index({ columns: ['pluginFilterId'] })
@Table('workflow_filter') @Table('workflow_filter')
export class WorkflowFilterTable { export class WorkflowFilterTable {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn('uuid')
@@ -48,7 +48,7 @@ export class WorkflowFilterTable {
workflowId!: Generated<string>; workflowId!: Generated<string>;
@ForeignKeyColumn(() => PluginFilterTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' }) @ForeignKeyColumn(() => PluginFilterTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
filterId!: string; pluginFilterId!: string;
@Column({ type: 'jsonb', nullable: true }) @Column({ type: 'jsonb', nullable: true })
filterConfig!: FilterConfig | null; filterConfig!: FilterConfig | null;
@@ -58,7 +58,7 @@ export class WorkflowFilterTable {
} }
@Index({ columns: ['workflowId', 'order'] }) @Index({ columns: ['workflowId', 'order'] })
@Index({ columns: ['actionId'] }) @Index({ columns: ['pluginActionId'] })
@Table('workflow_action') @Table('workflow_action')
export class WorkflowActionTable { export class WorkflowActionTable {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn('uuid')
@@ -68,7 +68,7 @@ export class WorkflowActionTable {
workflowId!: Generated<string>; workflowId!: Generated<string>;
@ForeignKeyColumn(() => PluginActionTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' }) @ForeignKeyColumn(() => PluginActionTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
actionId!: string; pluginActionId!: string;
@Column({ type: 'jsonb', nullable: true }) @Column({ type: 'jsonb', nullable: true })
actionConfig!: ActionConfig | null; actionConfig!: ActionConfig | null;

View File

@@ -247,9 +247,9 @@ export class PluginService extends BaseService {
private async executeFilters(workflowFilters: WorkflowFilter[], context: WorkflowContext): Promise<boolean> { private async executeFilters(workflowFilters: WorkflowFilter[], context: WorkflowContext): Promise<boolean> {
for (const workflowFilter of workflowFilters) { for (const workflowFilter of workflowFilters) {
const filter = await this.pluginRepository.getFilter(workflowFilter.filterId); const filter = await this.pluginRepository.getFilter(workflowFilter.pluginFilterId);
if (!filter) { if (!filter) {
this.logger.error(`Filter ${workflowFilter.filterId} not found`); this.logger.error(`Filter ${workflowFilter.pluginFilterId} not found`);
return false; return false;
} }
@@ -291,9 +291,9 @@ export class PluginService extends BaseService {
private async executeActions(workflowActions: WorkflowAction[], context: WorkflowContext): Promise<void> { private async executeActions(workflowActions: WorkflowAction[], context: WorkflowContext): Promise<void> {
for (const workflowAction of workflowActions) { for (const workflowAction of workflowActions) {
const action = await this.pluginRepository.getAction(workflowAction.actionId); const action = await this.pluginRepository.getAction(workflowAction.pluginActionId);
if (!action) { if (!action) {
throw new Error(`Action ${workflowAction.actionId} not found`); throw new Error(`Action ${workflowAction.pluginActionId} not found`);
} }
const pluginInstance = this.loadedPlugins.get(action.pluginId); const pluginInstance = this.loadedPlugins.get(action.pluginId);

View File

@@ -78,13 +78,13 @@ export class WorkflowService extends BaseService {
} }
private async validateAndMapFilters( private async validateAndMapFilters(
filters: Array<{ filterId: string; filterConfig?: any }>, filters: Array<{ pluginFilterId: string; filterConfig?: any }>,
requiredContext: PluginContext, requiredContext: PluginContext,
) { ) {
for (const dto of filters) { for (const dto of filters) {
const filter = await this.pluginRepository.getFilter(dto.filterId); const filter = await this.pluginRepository.getFilter(dto.pluginFilterId);
if (!filter) { if (!filter) {
throw new BadRequestException(`Invalid filter ID: ${dto.filterId}`); throw new BadRequestException(`Invalid filter ID: ${dto.pluginFilterId}`);
} }
if (!filter.supportedContexts.includes(requiredContext)) { if (!filter.supportedContexts.includes(requiredContext)) {
@@ -95,20 +95,20 @@ export class WorkflowService extends BaseService {
} }
return filters.map((dto, index) => ({ return filters.map((dto, index) => ({
filterId: dto.filterId, pluginFilterId: dto.pluginFilterId,
filterConfig: dto.filterConfig || null, filterConfig: dto.filterConfig || null,
order: index, order: index,
})); }));
} }
private async validateAndMapActions( private async validateAndMapActions(
actions: Array<{ actionId: string; actionConfig?: any }>, actions: Array<{ pluginActionId: string; actionConfig?: any }>,
requiredContext: PluginContext, requiredContext: PluginContext,
) { ) {
for (const dto of actions) { for (const dto of actions) {
const action = await this.pluginRepository.getAction(dto.actionId); const action = await this.pluginRepository.getAction(dto.pluginActionId);
if (!action) { if (!action) {
throw new BadRequestException(`Invalid action ID: ${dto.actionId}`); throw new BadRequestException(`Invalid action ID: ${dto.pluginActionId}`);
} }
if (!action.supportedContexts.includes(requiredContext)) { if (!action.supportedContexts.includes(requiredContext)) {
throw new BadRequestException( throw new BadRequestException(
@@ -118,7 +118,7 @@ export class WorkflowService extends BaseService {
} }
return actions.map((dto, index) => ({ return actions.map((dto, index) => ({
actionId: dto.actionId, pluginActionId: dto.pluginActionId,
actionConfig: dto.actionConfig || null, actionConfig: dto.actionConfig || null,
order: index, order: index,
})); }));

View File

@@ -113,13 +113,13 @@ describe(WorkflowService.name, () => {
enabled: true, enabled: true,
filters: [ filters: [
{ {
filterId: testFilterId, pluginFilterId: testFilterId,
filterConfig: { key: 'value' }, filterConfig: { key: 'value' },
}, },
], ],
actions: [ actions: [
{ {
actionId: testActionId, pluginActionId: testActionId,
actionConfig: { action: 'test' }, actionConfig: { action: 'test' },
}, },
], ],
@@ -137,7 +137,7 @@ describe(WorkflowService.name, () => {
expect(workflow.filters[0]).toMatchObject({ expect(workflow.filters[0]).toMatchObject({
id: expect.any(String), id: expect.any(String),
workflowId: workflow.id, workflowId: workflow.id,
filterId: testFilterId, pluginFilterId: testFilterId,
filterConfig: { key: 'value' }, filterConfig: { key: 'value' },
order: 0, order: 0,
}); });
@@ -146,7 +146,7 @@ describe(WorkflowService.name, () => {
expect(workflow.actions[0]).toMatchObject({ expect(workflow.actions[0]).toMatchObject({
id: expect.any(String), id: expect.any(String),
workflowId: workflow.id, workflowId: workflow.id,
actionId: testActionId, pluginActionId: testActionId,
actionConfig: { action: 'test' }, actionConfig: { action: 'test' },
order: 0, order: 0,
}); });
@@ -163,7 +163,7 @@ describe(WorkflowService.name, () => {
name: 'invalid-workflow', name: 'invalid-workflow',
description: 'A workflow with invalid filter', description: 'A workflow with invalid filter',
enabled: true, enabled: true,
filters: [{ filterId: factory.uuid(), filterConfig: { key: 'value' } }], filters: [{ pluginFilterId: factory.uuid(), filterConfig: { key: 'value' } }],
actions: [], actions: [],
}), }),
).rejects.toThrow('Invalid filter ID'); ).rejects.toThrow('Invalid filter ID');
@@ -181,7 +181,7 @@ describe(WorkflowService.name, () => {
description: 'A workflow with invalid action', description: 'A workflow with invalid action',
enabled: true, enabled: true,
filters: [], filters: [],
actions: [{ actionId: factory.uuid(), actionConfig: { action: 'test' } }], actions: [{ pluginActionId: factory.uuid(), actionConfig: { action: 'test' } }],
}), }),
).rejects.toThrow('Invalid action ID'); ).rejects.toThrow('Invalid action ID');
}); });
@@ -220,7 +220,7 @@ describe(WorkflowService.name, () => {
name: 'invalid-context-workflow', name: 'invalid-context-workflow',
description: 'A workflow with context mismatch', description: 'A workflow with context mismatch',
enabled: true, enabled: true,
filters: [{ filterId: result.filters[0].id }], filters: [{ pluginFilterId: result.filters[0].id }],
actions: [], actions: [],
}), }),
).rejects.toThrow('does not support asset context'); ).rejects.toThrow('does not support asset context');
@@ -261,7 +261,7 @@ describe(WorkflowService.name, () => {
description: 'A workflow with context mismatch', description: 'A workflow with context mismatch',
enabled: true, enabled: true,
filters: [], filters: [],
actions: [{ actionId: result.actions[0].id }], actions: [{ pluginActionId: result.actions[0].id }],
}), }),
).rejects.toThrow('does not support asset context'); ).rejects.toThrow('does not support asset context');
}); });
@@ -277,13 +277,13 @@ describe(WorkflowService.name, () => {
description: 'A workflow with multiple filters and actions', description: 'A workflow with multiple filters and actions',
enabled: true, enabled: true,
filters: [ filters: [
{ filterId: testFilterId, filterConfig: { step: 1 } }, { pluginFilterId: testFilterId, filterConfig: { step: 1 } },
{ filterId: testFilterId, filterConfig: { step: 2 } }, { pluginFilterId: testFilterId, filterConfig: { step: 2 } },
], ],
actions: [ actions: [
{ actionId: testActionId, actionConfig: { step: 1 } }, { pluginActionId: testActionId, actionConfig: { step: 1 } },
{ actionId: testActionId, actionConfig: { step: 2 } }, { pluginActionId: testActionId, actionConfig: { step: 2 } },
{ actionId: testActionId, actionConfig: { step: 3 } }, { pluginActionId: testActionId, actionConfig: { step: 3 } },
], ],
}); });
@@ -378,8 +378,8 @@ describe(WorkflowService.name, () => {
name: 'test-workflow', name: 'test-workflow',
description: 'A test workflow', description: 'A test workflow',
enabled: true, enabled: true,
filters: [{ filterId: testFilterId, filterConfig: { key: 'value' } }], filters: [{ pluginFilterId: testFilterId, filterConfig: { key: 'value' } }],
actions: [{ actionId: testActionId, actionConfig: { action: 'test' } }], actions: [{ pluginActionId: testActionId, actionConfig: { action: 'test' } }],
}); });
const workflow = await sut.get(auth, created.id); const workflow = await sut.get(auth, created.id);
@@ -461,14 +461,14 @@ describe(WorkflowService.name, () => {
name: 'test-workflow', name: 'test-workflow',
description: 'Test', description: 'Test',
enabled: true, enabled: true,
filters: [{ filterId: testFilterId, filterConfig: { old: 'config' } }], filters: [{ pluginFilterId: testFilterId, filterConfig: { old: 'config' } }],
actions: [], actions: [],
}); });
const updated = await sut.update(auth, created.id, { const updated = await sut.update(auth, created.id, {
filters: [ filters: [
{ filterId: testFilterId, filterConfig: { new: 'config' } }, { pluginFilterId: testFilterId, filterConfig: { new: 'config' } },
{ filterId: testFilterId, filterConfig: { second: 'filter' } }, { pluginFilterId: testFilterId, filterConfig: { second: 'filter' } },
], ],
}); });
@@ -488,13 +488,13 @@ describe(WorkflowService.name, () => {
description: 'Test', description: 'Test',
enabled: true, enabled: true,
filters: [], filters: [],
actions: [{ actionId: testActionId, actionConfig: { old: 'config' } }], actions: [{ pluginActionId: testActionId, actionConfig: { old: 'config' } }],
}); });
const updated = await sut.update(auth, created.id, { const updated = await sut.update(auth, created.id, {
actions: [ actions: [
{ actionId: testActionId, actionConfig: { new: 'config' } }, { pluginActionId: testActionId, actionConfig: { new: 'config' } },
{ actionId: testActionId, actionConfig: { second: 'action' } }, { pluginActionId: testActionId, actionConfig: { second: 'action' } },
], ],
}); });
@@ -513,7 +513,7 @@ describe(WorkflowService.name, () => {
name: 'test-workflow', name: 'test-workflow',
description: 'Test', description: 'Test',
enabled: true, enabled: true,
filters: [{ filterId: testFilterId, filterConfig: { key: 'value' } }], filters: [{ pluginFilterId: testFilterId, filterConfig: { key: 'value' } }],
actions: [], actions: [],
}); });
@@ -588,7 +588,7 @@ describe(WorkflowService.name, () => {
await expect( await expect(
sut.update(auth, created.id, { sut.update(auth, created.id, {
filters: [{ filterId: factory.uuid(), filterConfig: {} }], filters: [{ pluginFilterId: factory.uuid(), filterConfig: {} }],
}), }),
).rejects.toThrow(); ).rejects.toThrow();
}); });
@@ -608,7 +608,7 @@ describe(WorkflowService.name, () => {
}); });
await expect( await expect(
sut.update(auth, created.id, { actions: [{ actionId: factory.uuid(), actionConfig: {} }] }), sut.update(auth, created.id, { actions: [{ pluginActionId: factory.uuid(), actionConfig: {} }] }),
).rejects.toThrow(); ).rejects.toThrow();
}); });
}); });
@@ -643,8 +643,8 @@ describe(WorkflowService.name, () => {
name: 'test-workflow', name: 'test-workflow',
description: 'Test', description: 'Test',
enabled: true, enabled: true,
filters: [{ filterId: testFilterId, filterConfig: {} }], filters: [{ pluginFilterId: testFilterId, filterConfig: {} }],
actions: [{ actionId: testActionId, actionConfig: {} }], actions: [{ pluginActionId: testActionId, actionConfig: {} }],
}); });
await sut.delete(auth, workflow.id); await sut.delete(auth, workflow.id);