wangqifan 2 years ago
parent
commit
fb0b9cbd9d

+ 2 - 2
src/api-users/api-user.controller.ts

@@ -11,7 +11,7 @@ import {
     Req,
     Req,
     Post
     Post
 } from '@nestjs/common'
 } from '@nestjs/common'
-import { HasRoles } from '../auth/roles.decorator'
+import { HasAnyRoles, HasRoles } from '../auth/roles.decorator'
 import { Role } from '../model/role.enum'
 import { Role } from '../model/role.enum'
 import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
 import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
 import { PageRequest } from '../common/dto/page-request'
 import { PageRequest } from '../common/dto/page-request'
@@ -48,7 +48,7 @@ export class ApiUserController {
     }
     }
 
 
     @Put('/:id')
     @Put('/:id')
-    @HasRoles(Role.Api)
+    @HasAnyRoles(Role.Api, Role.Admin)
     public async update(@Param('id') id: string, @Body() apiUser: ApiUser) {
     public async update(@Param('id') id: string, @Body() apiUser: ApiUser) {
         try {
         try {
             await this.apiUserService.update(Number(id), apiUser)
             await this.apiUserService.update(Number(id), apiUser)

+ 6 - 0
src/api-users/entities/api-user.entity.ts

@@ -22,6 +22,12 @@ export class ApiUser {
     @Column()
     @Column()
     desc: string
     desc: string
 
 
+    @Column()
+    logo: string
+
+    @Column()
+    company: string
+
     @Column({ nullable: true })
     @Column({ nullable: true })
     code: string
     code: string