50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
} from '@nestjs/common';
|
|
import { TransactionService } from './transaction.service';
|
|
import { DistributeTransactionDto } from './dto/distribute-transaction.dto';
|
|
import { OrderTransactionDto } from './dto/order-transaction.dto';
|
|
import { UpdateTransactionDto } from './dto/update-transaction.dto';
|
|
|
|
@Controller({
|
|
path: 'transaction',
|
|
version: '1',
|
|
})
|
|
export class TransactionController {
|
|
constructor(private readonly transactionService: TransactionService) {}
|
|
|
|
@Post('distribute')
|
|
create(@Body() createTransactionDto: DistributeTransactionDto) {
|
|
return this.transactionService.distributeDeposit(createTransactionDto);
|
|
}
|
|
|
|
@Post('order')
|
|
orderTransaction(@Body() orderTransactionDto: OrderTransactionDto) {
|
|
return this.transactionService.orderTransaction(orderTransactionDto);
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.transactionService.findOne(+id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(
|
|
@Param('id') id: string,
|
|
@Body() updateTransactionDto: UpdateTransactionDto,
|
|
) {
|
|
return this.transactionService.update(+id, updateTransactionDto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.transactionService.remove(+id);
|
|
}
|
|
}
|