@opentiny/tiny-toolkit-pro
Version:
TinyPro Vue:开箱即用、前后端分离的 Vue 后台管理模板
87 lines (78 loc) • 2.12 kB
text/typescript
import {
Controller,
Get,
Post,
Body,
Patch,
Param,
Delete,
Query,
ParseIntPipe,
DefaultValuePipe,
ParseArrayPipe,
} from '@nestjs/common';
import { I18Service } from './i18.service';
import { CreateI18Dto } from './dto/create-i18.dto';
import { UpdateI18Dto } from './dto/update-i18.dto';
import { I18LangService } from './lang.service';
import { Permission } from '../public/permission.decorator';
import { Reject } from '../public/reject.decorator';
('i18')
export class I18Controller {
constructor(private readonly i18Service: I18Service) {}
()
('i18n::add')
()
create(() createI18Dto: CreateI18Dto) {
return this.i18Service.create(createI18Dto);
}
('format')
getFormat(('lang') lang: string) {
return this.i18Service.getFormat(lang);
}
('i18n::query')
()
findAll(
('page', new DefaultValuePipe(1), ParseIntPipe) page?: number,
('limit', new DefaultValuePipe(0), ParseIntPipe) limit?: number,
('all', ParseIntPipe) all?: number,
('lang', new DefaultValuePipe([]), ParseArrayPipe) lang?: number[],
('key') key?: string,
('content') content?: string
) {
return this.i18Service.findAll(
page,
limit,
Boolean(all),
lang,
content,
key
);
}
('i18n::query')
(':id')
findOne(('id', ParseIntPipe) id: number) {
return this.i18Service.findOne(id);
}
()
('i18n::update')
(':id')
update(
('id', ParseIntPipe) id: number,
() updateI18Dto: UpdateI18Dto
) {
return this.i18Service.update(id, updateI18Dto);
}
()
('i18n::remove')
(':id')
remove(('id', ParseIntPipe) id: number) {
return this.i18Service.remove(id);
}
()
('i18n::batch-remove')
('/batch')
batchRemove(() ids: number[]) {
return this.i18Service.batchRemove(ids);
}
}