update models and create consumer domain accounts permissions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { PosInfo } from '@/common/decorators/posInfo.decorator'
|
||||
import { Controller, Get } from '@nestjs/common'
|
||||
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||||
import { Controller, Get, Res } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { PosService } from './pos.service'
|
||||
|
||||
@@ -9,7 +10,24 @@ export class PosController {
|
||||
constructor(private service: PosService) {}
|
||||
|
||||
@Get()
|
||||
async getInfo(@PosInfo('pos_id') pos_id: string) {
|
||||
return await this.service.getInfo(pos_id)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user