Skip to content

Commit

Permalink
fix(assetsMigrateTenant): add type for frontend and fix admin only
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mauran committed Sep 29, 2023
1 parent c24f942 commit e249f13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/modules/asset/AssetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class AssetService {
return lock(`engine:${engineId}:${newEngineId}`, async () => {
const recovery = new RecoveryQueue();

if (user.profileIds.includes("admin")) {
if (!user.profileIds.includes("admin")) {
throw new BadRequestError(
`User ${user._id} is not authorized to migrate assets`
);
Expand Down
11 changes: 11 additions & 0 deletions lib/modules/asset/types/AssetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,14 @@ export interface ApiAssetExportRequest extends AssetsControllerRequest {
export type ApiAssetExportResult = {
link: string;
};

export interface ApiAssetMigrateTenantRequest extends AssetsControllerRequest {
action: "migrateTenant";
engineId: string;
body: {
assetsList: string[];
newEngineId: string;
};
}

export type ApiAssetMigrateTenantResult = void;

0 comments on commit e249f13

Please sign in to comment.