feat: wire admin workflows to real APIs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { TenantId } from '../common/tenant-id.decorator';
|
||||
import {
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
CreatePhoneSegmentDto,
|
||||
CreateSensitiveWordDto,
|
||||
DictionariesService,
|
||||
DictionaryStatusDto,
|
||||
} from './dictionaries.service';
|
||||
|
||||
@ApiTags('dictionaries')
|
||||
@@ -25,8 +26,8 @@ export class DictionariesController {
|
||||
}
|
||||
|
||||
@Get('sensitive-words')
|
||||
listSensitiveWords() {
|
||||
return this.dictionaries.listSensitiveWords();
|
||||
listSensitiveWords(@Query('keyword') keyword?: string, @Query('status') status?: string) {
|
||||
return this.dictionaries.listSensitiveWords({ keyword, status });
|
||||
}
|
||||
|
||||
@Post('sensitive-words')
|
||||
@@ -34,9 +35,19 @@ export class DictionariesController {
|
||||
return this.dictionaries.createSensitiveWord(body);
|
||||
}
|
||||
|
||||
@Post('sensitive-words/:id/status')
|
||||
changeSensitiveWordStatus(@Param('id') id: string, @Body() body: DictionaryStatusDto) {
|
||||
return this.dictionaries.changeSensitiveWordStatus(id, body);
|
||||
}
|
||||
|
||||
@Delete('sensitive-words/:id')
|
||||
deleteSensitiveWord(@Param('id') id: string) {
|
||||
return this.dictionaries.changeSensitiveWordStatus(id, { status: 'deleted' });
|
||||
}
|
||||
|
||||
@Get('blacklists/global')
|
||||
listGlobalBlacklist() {
|
||||
return this.dictionaries.listGlobalBlacklist();
|
||||
listGlobalBlacklist(@Query('keyword') keyword?: string, @Query('status') status?: string) {
|
||||
return this.dictionaries.listGlobalBlacklist({ keyword, status });
|
||||
}
|
||||
|
||||
@Post('blacklists/global')
|
||||
@@ -44,9 +55,19 @@ export class DictionariesController {
|
||||
return this.dictionaries.createGlobalBlacklist(body);
|
||||
}
|
||||
|
||||
@Post('blacklists/global/:id/status')
|
||||
changeGlobalBlacklistStatus(@Param('id') id: string, @Body() body: DictionaryStatusDto) {
|
||||
return this.dictionaries.changeGlobalBlacklistStatus(id, body);
|
||||
}
|
||||
|
||||
@Delete('blacklists/global/:id')
|
||||
deleteGlobalBlacklist(@Param('id') id: string) {
|
||||
return this.dictionaries.changeGlobalBlacklistStatus(id, { status: 'deleted' });
|
||||
}
|
||||
|
||||
@Get('blacklists/enterprise')
|
||||
listEnterpriseBlacklist(@TenantId() tenantId?: string) {
|
||||
return this.dictionaries.listEnterpriseBlacklist(tenantId);
|
||||
listEnterpriseBlacklist(@TenantId() tenantId?: string, @Query('keyword') keyword?: string, @Query('status') status?: string) {
|
||||
return this.dictionaries.listEnterpriseBlacklist({ tenantId, keyword, status });
|
||||
}
|
||||
|
||||
@Post('blacklists/enterprise')
|
||||
@@ -54,6 +75,16 @@ export class DictionariesController {
|
||||
return this.dictionaries.createEnterpriseBlacklist(body);
|
||||
}
|
||||
|
||||
@Post('blacklists/enterprise/:id/status')
|
||||
changeEnterpriseBlacklistStatus(@Param('id') id: string, @Body() body: DictionaryStatusDto) {
|
||||
return this.dictionaries.changeEnterpriseBlacklistStatus(id, body);
|
||||
}
|
||||
|
||||
@Delete('blacklists/enterprise/:id')
|
||||
deleteEnterpriseBlacklist(@Param('id') id: string) {
|
||||
return this.dictionaries.changeEnterpriseBlacklistStatus(id, { status: 'deleted' });
|
||||
}
|
||||
|
||||
@Get('drainage-fields')
|
||||
listDrainageFields() {
|
||||
return this.dictionaries.listDrainageFields();
|
||||
|
||||
Reference in New Issue
Block a user