Files
oneuptime/App/FeatureSet/Workers/DataMigrations/UpdateObserverRoleToAllowMultipleUsers.ts
Nawaz Dhandala ea71c8bd75 feat: Implement Workflow API and Queue Management
- Added ManualAPI for manually triggering workflows via GET and POST requests.
- Introduced WorkflowAPI for updating workflows with authorization checks.
- Created documentation for JavaScript and Webhook components.
- Established WorkflowFeatureSet to initialize routing and job processing.
- Developed QueueWorkflow service for managing workflow queue operations.
- Implemented RunWorkflow service to execute workflows with error handling and logging.
- Added utility for loading component metadata dynamically.
2026-04-01 22:05:19 +01:00

50 lines
1.3 KiB
TypeScript

import DataMigrationBase from "./DataMigrationBase";
import { LIMIT_INFINITY } from "Common/Types/Database/LimitMax";
import IncidentRoleService from "Common/Server/Services/IncidentRoleService";
import IncidentRole from "Common/Models/DatabaseModels/IncidentRole";
export default class UpdateObserverRoleToAllowMultipleUsers extends DataMigrationBase {
public constructor() {
super("UpdateObserverRoleToAllowMultipleUsers");
}
public override async migrate(): Promise<void> {
// Get all Observer roles across all projects
const observerRoles: Array<IncidentRole> = await IncidentRoleService.findBy(
{
query: {
name: "Observer",
},
select: {
_id: true,
canAssignMultipleUsers: true,
},
skip: 0,
limit: LIMIT_INFINITY,
props: {
isRoot: true,
},
},
);
for (const role of observerRoles) {
// Update the role to allow multiple users
if (!role.canAssignMultipleUsers) {
await IncidentRoleService.updateOneById({
id: role.id!,
data: {
canAssignMultipleUsers: true,
},
props: {
isRoot: true,
},
});
}
}
}
public override async rollback(): Promise<void> {
return;
}
}