import { Body, Controller, Headers, HttpCode, Post } from '@nestjs/common'
import { NotifyService } from './notify.service'
import { Public } from '../auth/public.decorator'
import { ApiTags } from '@nestjs/swagger'

@ApiTags('notify')
@Controller('/notify')
export class NotifyController {
    constructor(private readonly notifyService: NotifyService) {}

    @Public()
    @Post('/weixin')
    @HttpCode(200)
    public async weixin(@Headers() headers, @Body() body: WechatPay.NotifyEvent) {
        await this.notifyService.handleWeixinNotify(headers, body)
    }
}
