chore: add industry crud
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from "@nestjs/common";
|
||||
|
||||
import { CreateIndustryDto } from "./DTO/create-industry.dto";
|
||||
import { IndustryListQueryDto } from "./DTO/industry-list-query.dto";
|
||||
import { UpdateIndustryDto } from "./DTO/update-industry.dto";
|
||||
import { IndustriesService } from "./services/industries.service";
|
||||
import { ParamDto } from "../../common/DTO/param.dto";
|
||||
|
||||
@Controller("industries")
|
||||
export class IndustriesController {
|
||||
constructor(private readonly industriesService: IndustriesService) {}
|
||||
|
||||
@Post()
|
||||
create(@Body() createIndustryDto: CreateIndustryDto) {
|
||||
return this.industriesService.create(createIndustryDto);
|
||||
}
|
||||
|
||||
@Get(":id")
|
||||
getIndustryById(@Param() paramDto: ParamDto) {
|
||||
return this.industriesService.getIndustriesById(paramDto.id);
|
||||
}
|
||||
|
||||
@Patch(":id")
|
||||
updateIndustry(@Param() paramDto: ParamDto, @Body() updateIndustryDto: UpdateIndustryDto) {
|
||||
return this.industriesService.updateIndustry(paramDto.id, updateIndustryDto);
|
||||
}
|
||||
|
||||
@Delete(":id")
|
||||
deleteIndustry(@Param() paramDto: ParamDto) {
|
||||
return this.industriesService.deleteIndustry(paramDto.id);
|
||||
}
|
||||
|
||||
@Get("list")
|
||||
getIndustriesForAdmin(@Query() query: IndustryListQueryDto) {
|
||||
return this.industriesService.getIndustriesListForAdmin(query);
|
||||
}
|
||||
|
||||
@Patch(":id/toggle-status")
|
||||
toggleStatus(@Param() paramDto: ParamDto) {
|
||||
return this.industriesService.toggleStatus(paramDto.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user