Auth: WeChat login, JWT, roles guard (24 tests passing) User: profile CRUD, training stats with month/total calculations Studio: config management with auto-default creation
31 lines
768 B
TypeScript
31 lines
768 B
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Put,
|
|
UseGuards,
|
|
} from '@nestjs/common'
|
|
import { UserRole } from '@mp-pilates/shared'
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard'
|
|
import { Roles } from '../auth/roles.decorator'
|
|
import { RolesGuard } from '../auth/roles.guard'
|
|
import { UpdateStudioDto } from './dto/update-studio.dto'
|
|
import { StudioService } from './studio.service'
|
|
|
|
@Controller()
|
|
export class StudioController {
|
|
constructor(private readonly studioService: StudioService) {}
|
|
|
|
@Get('studio/info')
|
|
getInfo() {
|
|
return this.studioService.getInfo()
|
|
}
|
|
|
|
@Put('admin/studio/info')
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles(UserRole.ADMIN)
|
|
updateInfo(@Body() dto: UpdateStudioDto) {
|
|
return this.studioService.updateInfo(dto)
|
|
}
|
|
}
|