feat: add update password functionality and DTO for partner service
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import { PartnerInfo } from '@/common/decorators/partnerInfo.decorator'
|
||||
import type { IPartnerPayload } from '@/common/models/partnerPayload.model'
|
||||
import { multerImageOptions } from '@/multer.config'
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Patch,
|
||||
Put,
|
||||
UploadedFile,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common'
|
||||
import { FileInterceptor } from '@nestjs/platform-express'
|
||||
import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'
|
||||
import { UpdatePartnerProfileDto } from './dto/partner.dto'
|
||||
import {
|
||||
PartnerServiceGetInfoResponseDto,
|
||||
PartnerServiceMeResponseDto,
|
||||
PartnerServiceUpdateInfoResponseDto,
|
||||
} from './dto/partners-response.dto'
|
||||
import { UpdatePartnerPasswordDto } from './dto/update-password-request.dto'
|
||||
import { PartnerService } from './partners.service'
|
||||
|
||||
@ApiTags('Partner')
|
||||
@@ -19,16 +27,20 @@ export class PartnerController {
|
||||
constructor(private service: PartnerService) {}
|
||||
|
||||
@Get('')
|
||||
async me(@PartnerInfo() { id, account_id }: IPartnerPayload): Promise<PartnerServiceMeResponseDto> {
|
||||
async me(
|
||||
@PartnerInfo() { id, account_id }: IPartnerPayload,
|
||||
): Promise<PartnerServiceMeResponseDto> {
|
||||
return this.service.me(id, account_id)
|
||||
}
|
||||
|
||||
@Get('info')
|
||||
async getInfo(@PartnerInfo('id') partnerId: string): Promise<PartnerServiceGetInfoResponseDto> {
|
||||
async getInfo(
|
||||
@PartnerInfo('id') partnerId: string,
|
||||
): Promise<PartnerServiceGetInfoResponseDto> {
|
||||
return this.service.getInfo(partnerId)
|
||||
}
|
||||
|
||||
@Patch('profile')
|
||||
@Patch('')
|
||||
@UseInterceptors(FileInterceptor('logo', multerImageOptions))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiBody({
|
||||
@@ -46,7 +58,13 @@ export class PartnerController {
|
||||
): Promise<PartnerServiceUpdateInfoResponseDto> {
|
||||
return this.service.updateInfo(partnerId, data, logo)
|
||||
}
|
||||
}
|
||||
|
||||
import type { IPartnerPayload } from '@/common/models/partnerPayload.model'
|
||||
import type { PartnerServiceGetInfoResponseDto, PartnerServiceMeResponseDto, PartnerServiceUpdateInfoResponseDto } from './dto/partners-response.dto'
|
||||
@Put('update-password')
|
||||
async updatePassword(
|
||||
@PartnerInfo('id') partnerId: string,
|
||||
@PartnerInfo('account_id') accountId: string,
|
||||
@Body() data: UpdatePartnerPasswordDto,
|
||||
) {
|
||||
return this.service.updatePassword(partnerId, accountId, data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user