25 lines
696 B
TypeScript
25 lines
696 B
TypeScript
|
|
import { Controller, Get } from "@nestjs/common";
|
||
|
|
import { WhmcsCurrencyService } from "../../integrations/whmcs/services/whmcs-currency.service";
|
||
|
|
|
||
|
|
@Controller("currency")
|
||
|
|
export class CurrencyController {
|
||
|
|
constructor(private readonly currencyService: WhmcsCurrencyService) {}
|
||
|
|
|
||
|
|
@Get("default")
|
||
|
|
getDefaultCurrency() {
|
||
|
|
const defaultCurrency = this.currencyService.getDefaultCurrency();
|
||
|
|
return {
|
||
|
|
code: defaultCurrency.code,
|
||
|
|
prefix: defaultCurrency.prefix,
|
||
|
|
suffix: defaultCurrency.suffix,
|
||
|
|
format: defaultCurrency.format,
|
||
|
|
rate: defaultCurrency.rate,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@Get("all")
|
||
|
|
getAllCurrencies() {
|
||
|
|
return this.currencyService.getAllCurrencies();
|
||
|
|
}
|
||
|
|
}
|