-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1670 from OneUptime/master
Release
- Loading branch information
Showing
82 changed files
with
2,981 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
App/FeatureSet/Workers/DataMigrations/AddDefaultCopilotActionTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import DataMigrationBase from "./DataMigrationBase"; | ||
import LIMIT_MAX from "Common/Types/Database/LimitMax"; | ||
import CopilotCodeRepository from "Common/Models/DatabaseModels/CopilotCodeRepository"; | ||
import CopilotCodeRepositoryService from "Common/Server/Services/CopilotCodeRepositoryService"; | ||
import { | ||
CopilotActionTypeData, | ||
CopilotActionTypeUtil, | ||
} from "Common/Types/Copilot/CopilotActionType"; | ||
import CopilotActionTypePriority from "Common/Models/DatabaseModels/CopilotActionTypePriority"; | ||
import CopilotActionTypePriorityService from "Common/Server/Services/CopilotActionTypePriorityService"; | ||
|
||
export default class AddDefaultCopilotActionTypes extends DataMigrationBase { | ||
public constructor() { | ||
super("AddDefaultCopilotActionTypes"); | ||
} | ||
|
||
public override async migrate(): Promise<void> { | ||
// get all the users with email isVerified true. | ||
|
||
const repositories: Array<CopilotCodeRepository> = | ||
await CopilotCodeRepositoryService.findBy({ | ||
query: {}, | ||
select: { | ||
_id: true, | ||
projectId: true, | ||
}, | ||
skip: 0, | ||
limit: LIMIT_MAX, | ||
props: { | ||
isRoot: true, | ||
}, | ||
}); | ||
|
||
for (const repo of repositories) { | ||
const defaultCopilotActionTypes: Array<CopilotActionTypeData> = | ||
CopilotActionTypeUtil.getAllCopilotActionTypes(); | ||
|
||
for (const defaultAction of defaultCopilotActionTypes) { | ||
const copilotActionTypePriority: CopilotActionTypePriority = | ||
new CopilotActionTypePriority(); | ||
copilotActionTypePriority.projectId = repo.projectId!; | ||
copilotActionTypePriority.actionType = defaultAction.type; | ||
copilotActionTypePriority.priority = defaultAction.defaultPriority; | ||
copilotActionTypePriority.codeRepositoryId = repo.id!; | ||
|
||
await CopilotActionTypePriorityService.create({ | ||
data: copilotActionTypePriority, | ||
props: { | ||
isRoot: true, | ||
}, | ||
}); | ||
} | ||
} | ||
} | ||
|
||
public override async rollback(): Promise<void> { | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.