2026-03-09 23:34:11 +08:00
|
|
|
import { BaseController, Constants } from '@certd/lib-server';
|
|
|
|
|
import { Controller, Inject, Post, Provide } from '@midwayjs/core';
|
|
|
|
|
import { TransferService } from '../../../modules/sys/enterprise/service/transfer-service.js';
|
2026-03-15 14:01:34 +08:00
|
|
|
import { ApiTags } from '@midwayjs/swagger';
|
2026-03-09 23:34:11 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
@Provide()
|
|
|
|
|
@Controller('/api/enterprise/transfer')
|
2026-03-15 14:01:34 +08:00
|
|
|
@ApiTags(['enterprise-project'])
|
2026-03-09 23:34:11 +08:00
|
|
|
export class TransferController extends BaseController {
|
|
|
|
|
@Inject()
|
|
|
|
|
service: TransferService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getService(): TransferService {
|
|
|
|
|
return this.service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 我自己的资源
|
|
|
|
|
* @param body
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
2026-03-15 18:26:49 +08:00
|
|
|
@Post('/selfResources', { description: Constants.per.authOnly, summary: "查询我自己的资源" })
|
2026-03-09 23:34:11 +08:00
|
|
|
async selfResources() {
|
|
|
|
|
const userId = this.getUserId();
|
|
|
|
|
const res = await this.service.getUserResources(userId);
|
|
|
|
|
return this.ok(res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 迁移项目
|
|
|
|
|
* @param body
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
2026-03-15 18:26:49 +08:00
|
|
|
@Post('/doTransfer', { description: Constants.per.authOnly, summary: "迁移项目资源" })
|
2026-03-09 23:34:11 +08:00
|
|
|
async doTransfer() {
|
|
|
|
|
const {projectId} = await this.getProjectUserIdRead();
|
|
|
|
|
const userId = this.getUserId();
|
|
|
|
|
await this.service.transferAll(userId,projectId);
|
|
|
|
|
return this.ok();
|
|
|
|
|
}
|
|
|
|
|
}
|