This commit is contained in:
xiaojunnuo
2024-10-03 01:29:12 +08:00
parent aeed24e87d
commit c9d18f6d8a
17 changed files with 100 additions and 34 deletions
+13 -10
View File
@@ -17,18 +17,21 @@
# password: root
# database: postgres
typeorm:
dataSource:
default:
database: './data/db-comm.sqlite'
#plus:
# server:
# baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
plus:
server:
baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
#typeorm:
# dataSource:
# default:
# database: './data/db2.sqlite'
#account:
# server:
# baseUrl: 'http://127.0.0.1:1017/subject'
baseUrls: ['http://127.0.0.1:11007']
account:
server:
baseUrl: 'https://ai.handsfree.work/subject'
baseUrl: 'http://127.0.0.1:1017/subject'
#account:
# server:
# baseUrl: 'https://ai.handsfree.work/subject'
+1
View File
@@ -24,6 +24,7 @@
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.25.9",
"@certd/lib-huawei": "^1.25.9",
"@certd/commcial-core": "^1.25.9",
"@certd/lib-jdcloud": "^1.25.9",
"@certd/lib-k8s": "^1.25.9",
"@certd/midway-flyway-js": "^1.25.9",
@@ -49,6 +49,9 @@ export class RoleController extends CrudController<RoleService> {
@Query('id')
id: number
) {
if (id === 1) {
throw new Error('不能删除默认的管理员角色');
}
return await super.delete(id);
}
@@ -73,8 +73,11 @@ export class UserController extends CrudController<UserService> {
@Post('/delete', { summary: 'sys:auth:user:remove' })
async delete(
@Query('id')
id : number
id: number
) {
if (id === 1) {
throw new Error('不能删除默认的管理员用户');
}
return await super.delete(id);
}
@@ -66,4 +66,6 @@ export class UserEntity {
static of(user: Partial<UserEntity>) {
return Object.assign(new UserEntity(), user);
}
roleIds: number[];
}
@@ -3,6 +3,7 @@ import { BaseController } from '../../../basic/base-controller.js';
import { Constants } from '../../../basic/constants.js';
import { UserService } from '../../authority/service/user-service.js';
import { getPlusInfo } from '@certd/pipeline';
import { RoleService } from '../../authority/service/role-service.js';
/**
*/
@@ -11,10 +12,13 @@ import { getPlusInfo } from '@certd/pipeline';
export class MineController extends BaseController {
@Inject()
userService: UserService;
@Inject()
roleService: RoleService;
@Post('/info', { summary: Constants.per.authOnly })
public async info() {
const userId = this.getUserId();
const user = await this.userService.info(userId);
user.roleIds = await this.roleService.getRoleIdsByUserId(userId);
delete user.password;
return this.ok(user);
}
@@ -27,4 +27,5 @@ export class UserSettingsEntity {
default: () => 'CURRENT_TIMESTAMP',
})
updateTime: Date;
}