4c38a9dd2b
增加hq管理端日志
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { Body, Controller, Get, Param, Put, Query, UseGuards } from '@nestjs/common';
|
|
import { HqAuthGuard } from '../../common/guards/hq-auth.guard';
|
|
import { HqOperation } from '../../common/hq-operation/hq-operation.decorator';
|
|
import { HqOperationAction } from '../../common/hq-operation/hq-operation.constants';
|
|
import { AdminRedeemService, AdminDeliveriesService } from './admin-redeem.service';
|
|
import { AdminDeliveriesQueryDto, AdminRedeemRecordsQueryDto } from './dto/admin-query.dto';
|
|
import { UpdateDeliveryDto } from './dto/admin-mutate.dto';
|
|
|
|
@Controller('admin/redeem-records')
|
|
@UseGuards(HqAuthGuard)
|
|
export class AdminRedeemRecordsController {
|
|
constructor(private readonly service: AdminRedeemService) {}
|
|
|
|
@Get()
|
|
list(@Query() query: AdminRedeemRecordsQueryDto) {
|
|
return this.service.listRecords(query);
|
|
}
|
|
|
|
@Get(':id')
|
|
detail(@Param('id') id: string) {
|
|
return this.service.detailRecord(BigInt(id));
|
|
}
|
|
}
|
|
|
|
@Controller('admin/deliveries')
|
|
@UseGuards(HqAuthGuard)
|
|
export class AdminDeliveriesController {
|
|
constructor(private readonly service: AdminDeliveriesService) {}
|
|
|
|
@Get()
|
|
list(@Query() query: AdminDeliveriesQueryDto) {
|
|
return this.service.list(query);
|
|
}
|
|
|
|
@Get(':id')
|
|
detail(@Param('id') id: string) {
|
|
return this.service.detail(BigInt(id));
|
|
}
|
|
|
|
@Put(':id')
|
|
@HqOperation({
|
|
action: HqOperationAction.DELIVERY_UPDATE,
|
|
refType: 'DELIVERY',
|
|
refIdParam: 'id',
|
|
includeBody: true,
|
|
})
|
|
update(@Param('id') id: string, @Body() dto: UpdateDeliveryDto) {
|
|
return this.service.update(BigInt(id), dto);
|
|
}
|
|
}
|