- Country 加 sort_order(默认 0 保持 id 序);PATCH /countries/sort 批量保存 顺序(对齐 /tags/sort 模式);findAll 与公开 /public/countries 均按 sortOrder 排序 - CountriesView 表格改为可拖拽行列表:拖动松开即全量保存新顺序,失败回滚 - 商品编辑弹窗成员展开面板:同步详情按钮常驻(已同步显示 重新同步详情), 不再只在未同步态出现 - goods.service.spec 的 FamilyRecomputeService mock 补齐 syncFamilyTags 等 方法(全量并行时其他套件的扫名归族会把本套件夹具收进族,create/update 会调用到,mock 缺方法导致偶发 TypeError) - api 164/164、admin typecheck+22/22+构建全绿
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
Param,
|
|
ParseIntPipe,
|
|
Patch,
|
|
Post,
|
|
UseGuards,
|
|
} from '@nestjs/common';
|
|
import {
|
|
ApiBearerAuth,
|
|
ApiOperation,
|
|
ApiTags,
|
|
} from '@nestjs/swagger';
|
|
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
|
import { CountriesService } from './countries.service';
|
|
import { CreateCountryDto } from './dto/create-country.dto';
|
|
import { UpdateCountryDto } from './dto/update-country.dto';
|
|
import { ReorderCountriesDto } from './dto/reorder-countries.dto';
|
|
|
|
@ApiTags('countries')
|
|
@ApiBearerAuth()
|
|
@UseGuards(JwtAuthGuard)
|
|
@Controller('countries')
|
|
export class CountriesController {
|
|
constructor(private readonly service: CountriesService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'List all countries' })
|
|
findAll() {
|
|
return this.service.findAll();
|
|
}
|
|
|
|
// 注意:'sort' 静态路由必须声明在 ':id' 之前,否则会被参数路由吞掉
|
|
@Patch('sort')
|
|
@ApiOperation({ summary: 'Batch update country sort order (drag reorder)' })
|
|
reorder(@Body() dto: ReorderCountriesDto) {
|
|
return this.service.reorder(dto);
|
|
}
|
|
|
|
@Get(':id')
|
|
@ApiOperation({ summary: 'Get one country' })
|
|
findOne(@Param('id', ParseIntPipe) id: string) {
|
|
return this.service.findOne(BigInt(id));
|
|
}
|
|
|
|
@Post()
|
|
@ApiOperation({ summary: 'Create a country' })
|
|
create(@Body() dto: CreateCountryDto) {
|
|
return this.service.create(dto);
|
|
}
|
|
|
|
@Patch(':id')
|
|
@ApiOperation({ summary: 'Update a country' })
|
|
update(
|
|
@Param('id', ParseIntPipe) id: string,
|
|
@Body() dto: UpdateCountryDto,
|
|
) {
|
|
return this.service.update(BigInt(id), dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
@ApiOperation({ summary: 'Delete a country' })
|
|
remove(@Param('id', ParseIntPipe) id: string) {
|
|
return this.service.remove(BigInt(id));
|
|
}
|
|
}
|