feat(SPG-1236): implement otp checker guard on active and confirm user
parent
de43f0f28b
commit
822cfe606a
|
@ -6,6 +6,7 @@ import {
|
||||||
Patch,
|
Patch,
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { UserDataOrchestrator } from '../domain/usecases/user-data.orchestrator';
|
import { UserDataOrchestrator } from '../domain/usecases/user-data.orchestrator';
|
||||||
import { UserDto } from './dto/user.dto';
|
import { UserDto } from './dto/user.dto';
|
||||||
|
@ -17,6 +18,7 @@ import { BatchIdsDto } from 'src/core/modules/infrastructure/dto/base-batch.dto'
|
||||||
import { Public } from 'src/core/guards';
|
import { Public } from 'src/core/guards';
|
||||||
import { UpdateUserDto } from './dto/update-user.dto';
|
import { UpdateUserDto } from './dto/update-user.dto';
|
||||||
import { UpdatePasswordUserDto } from './dto/update-password-user.dto';
|
import { UpdatePasswordUserDto } from './dto/update-password-user.dto';
|
||||||
|
import { OtpCheckerGuard } from 'src/core/guards/domain/otp-checker.guard';
|
||||||
|
|
||||||
@ApiTags(`${MODULE_NAME.USER.split('-').join(' ')} - data`)
|
@ApiTags(`${MODULE_NAME.USER.split('-').join(' ')} - data`)
|
||||||
@Controller(`v1/${MODULE_NAME.USER}`)
|
@Controller(`v1/${MODULE_NAME.USER}`)
|
||||||
|
@ -36,25 +38,23 @@ export class UserDataController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id/active')
|
@Patch(':id/active')
|
||||||
// TODO => simpan OTP update yang disikim dari request ini
|
@UseGuards(OtpCheckerGuard)
|
||||||
async active(@Param('id') dataId: string): Promise<string> {
|
async active(@Param('id') dataId: string): Promise<string> {
|
||||||
return await this.orchestrator.active(dataId);
|
return await this.orchestrator.active(dataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put('/batch-active')
|
@Put('/batch-active')
|
||||||
// TODO => simpan OTP update yang disikim dari request ini
|
|
||||||
async batchActive(@Body() body: BatchIdsDto): Promise<BatchResult> {
|
async batchActive(@Body() body: BatchIdsDto): Promise<BatchResult> {
|
||||||
return await this.orchestrator.batchActive(body.ids);
|
return await this.orchestrator.batchActive(body.ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id/confirm')
|
@Patch(':id/confirm')
|
||||||
// TODO => simpan OTP update yang disikim dari request ini
|
@UseGuards(OtpCheckerGuard)
|
||||||
async confirm(@Param('id') dataId: string): Promise<string> {
|
async confirm(@Param('id') dataId: string): Promise<string> {
|
||||||
return await this.orchestrator.confirm(dataId);
|
return await this.orchestrator.confirm(dataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put('/batch-confirm')
|
@Put('/batch-confirm')
|
||||||
// TODO => simpan OTP update yang disikim dari request ini
|
|
||||||
async batchConfirm(@Body() body: BatchIdsDto): Promise<BatchResult> {
|
async batchConfirm(@Body() body: BatchIdsDto): Promise<BatchResult> {
|
||||||
return await this.orchestrator.batchConfirm(body.ids);
|
return await this.orchestrator.batchConfirm(body.ids);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue