46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { Body, Controller, Delete, Get, Param, Post, Put, UseGuards } from '@nestjs/common';
|
|
import { JwtAuthGuard, AuthUser } from '../../common/guards/jwt-auth.guard';
|
|
import { PartnerPrimaryGuard } from '../../common/guards/partner-primary.guard';
|
|
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
|
import { PartnerStaffService } from './partner-staff.service';
|
|
import {
|
|
CreatePartnerStaffDto,
|
|
SendPartnerStaffPhoneSmsDto,
|
|
UpdatePartnerStaffDto,
|
|
} from './dto/partner-staff.dto';
|
|
|
|
@Controller('partner/staff')
|
|
@UseGuards(JwtAuthGuard, PartnerPrimaryGuard)
|
|
export class PartnerStaffController {
|
|
constructor(private readonly staffService: PartnerStaffService) {}
|
|
|
|
@Get()
|
|
list(@CurrentUser() user: AuthUser) {
|
|
return this.staffService.listStaff(user.actorId);
|
|
}
|
|
|
|
@Post('send-phone-sms')
|
|
sendPhoneSms(@CurrentUser() user: AuthUser, @Body() dto: SendPartnerStaffPhoneSmsDto) {
|
|
return this.staffService.sendStaffPhoneSms(user, dto.phone);
|
|
}
|
|
|
|
@Post()
|
|
create(@CurrentUser() user: AuthUser, @Body() dto: CreatePartnerStaffDto) {
|
|
return this.staffService.createStaff(user, dto);
|
|
}
|
|
|
|
@Put(':id')
|
|
update(
|
|
@CurrentUser() user: AuthUser,
|
|
@Param('id') id: string,
|
|
@Body() dto: UpdatePartnerStaffDto,
|
|
) {
|
|
return this.staffService.updateStaff(user, BigInt(id), dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
|
return this.staffService.deleteStaff(user, BigInt(id));
|
|
}
|
|
}
|