mirror of
https://github.com/certd/certd.git
synced 2026-07-12 16:27:34 +08:00
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
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";
|
|
import { ApiTags } from "@midwayjs/swagger";
|
|
import { AuditType } from "../../../modules/sys/enterprise/service/audit-constants.js";
|
|
|
|
/**
|
|
*/
|
|
@Provide()
|
|
@Controller("/api/enterprise/transfer")
|
|
@ApiTags(["enterprise-project"])
|
|
export class TransferController extends BaseController {
|
|
@Inject()
|
|
service: TransferService;
|
|
|
|
getService(): TransferService {
|
|
return this.service;
|
|
}
|
|
|
|
getAuditType(): string {
|
|
return AuditType.enterprise;
|
|
}
|
|
|
|
/**
|
|
* 我自己的资源
|
|
* @param body
|
|
* @returns
|
|
*/
|
|
@Post("/selfResources", { description: Constants.per.authOnly, summary: "查询我自己的资源" })
|
|
async selfResources() {
|
|
const userId = this.getUserId();
|
|
const res = await this.service.getUserResources(userId);
|
|
return this.ok(res);
|
|
}
|
|
|
|
/**
|
|
* 迁移项目
|
|
* @param body
|
|
* @returns
|
|
*/
|
|
@Post("/doTransfer", { description: Constants.per.authOnly, summary: "迁移项目资源" })
|
|
async doTransfer() {
|
|
const { projectId } = await this.getProjectUserIdRead();
|
|
const userId = this.getUserId();
|
|
await this.service.transferAll(userId, projectId);
|
|
this.auditLog({ content: "迁移了项目资源" });
|
|
return this.ok();
|
|
}
|
|
}
|