35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
|||
|
|
import { LedgerService } from './ledger.service';
|
||
|
|
import { PostGoldRepaymentDto } from './dto/post-gold-repayment.dto';
|
||
|
|
import { PostRialRepaymentDto } from './dto/post-rial-repayment.dto';
|
||
|
|
|
||
|
|
@Controller('accounting')
|
||
|
|
export class AccountingController {
|
||
|
|
constructor(private readonly ledger: LedgerService) {}
|
||
|
|
|
||
|
|
@Get('customers/:customerId/balance')
|
||
|
|
getBalance(@Param('customerId') customerId: string) {
|
||
|
|
return this.ledger.getBalance(customerId);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post('customers/:customerId/reconcile')
|
||
|
|
reconcile(@Param('customerId') customerId: string) {
|
||
|
|
return this.ledger.reconcileBalance(customerId);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post('repayments/gold')
|
||
|
|
postGoldRepayment(@Body() dto: PostGoldRepaymentDto) {
|
||
|
|
return this.ledger.postGoldRepayment(dto);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post('repayments/rial')
|
||
|
|
postRialRepayment(@Body() dto: PostRialRepaymentDto) {
|
||
|
|
return this.ledger.postRialRepayment(dto);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post('entries/:entryId/confirm')
|
||
|
|
confirmEntry(@Param('entryId') entryId: string) {
|
||
|
|
return this.ledger.confirmEntry(entryId);
|
||
|
|
}
|
||
|
|
}
|