Files
psp_api/src/modules/pos/pos.controller.ts
T

34 lines
955 B
TypeScript
Raw Normal View History

2026-03-29 18:06:41 +03:30
import { PosInfo } from '@/common/decorators/posInfo.decorator'
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
import { Controller, Get, Res } from '@nestjs/common'
2026-03-29 18:06:41 +03:30
import { ApiTags } from '@nestjs/swagger'
import { PosService } from './pos.service'
@ApiTags('Pos')
@Controller('pos')
export class PosController {
constructor(private service: PosService) {}
@Get()
async getInfo(@PosInfo('pos_id') pos_id: string, @Res({ passthrough: true }) res) {
const result = await this.service.getInfo(pos_id)
if (result) {
// @ts-ignore
res.cookie('posId', pos_id, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'lax',
maxAge: 1000 * 60 * 60 * 24 * 7, // 7 days
})
}
return result
}
@Get('/accessible')
async getAccessiblePos(@TokenAccount('account_id') account_id) {
return await this.service.getAccessible(account_id)
2026-03-29 18:06:41 +03:30
}
}