44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
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 { CreateStudioUploadCredentialDto } from './dto/create-studio-upload-credential.dto'
|
|
import { UpdateStudioDto } from './dto/update-studio.dto'
|
|
import { StudioService } from './studio.service'
|
|
import { StudioUploadService } from './studio-upload.service'
|
|
|
|
@Controller()
|
|
export class StudioController {
|
|
constructor(
|
|
private readonly studioService: StudioService,
|
|
private readonly studioUploadService: StudioUploadService,
|
|
) {}
|
|
|
|
@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)
|
|
}
|
|
|
|
@Post('admin/studio/upload-credentials')
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles(UserRole.ADMIN)
|
|
createUploadCredential(@Body() dto: CreateStudioUploadCredentialDto) {
|
|
return this.studioUploadService.createUploadCredential(dto)
|
|
}
|
|
}
|