Files
sase.tr/apps/api/src/translations/translations.controller.ts
Fusion f4fea1e429
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
feat(FN-094): add comment line for deployment verification
- Added a comment line to main.ts for deployment verification purposes
2026-05-11 02:07:03 +00:00

39 lines
1.2 KiB
TypeScript

import { Body, Controller, Get, Param, Post, Put, Query, UseGuards } from "@nestjs/common";
import { Public } from "../common/decorators/public.decorator";
import { Roles } from "../common/decorators/roles.decorator";
import { RolesGuard } from "../common/guards/roles.guard";
import { TranslationsService } from "./translations.service";
@Controller("translations")
export class TranslationsController {
constructor(private translationsService: TranslationsService) {}
@Get("search")
@UseGuards(RolesGuard)
@Roles("admin")
async search(@Query("q") query: string) {
return this.translationsService.searchTranslations(query || "");
}
@Get(":key")
@Public()
async getTranslation(@Param("key") key: string) {
return this.translationsService.getTranslation(key);
}
@Post("batch")
async translateBatch(@Body() body: { items: { key: string; sourceText: string }[] }) {
return this.translationsService.translateBatch(body.items);
}
@Put(":key")
@UseGuards(RolesGuard)
@Roles("admin")
async setTranslation(
@Param("key") key: string,
@Body() body: { sourceText: string; translatedText: string },
) {
return this.translationsService.setTranslation(key, body.sourceText, body.translatedText);
}
}