-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathcost-centers.controller.ts
More file actions
54 lines (38 loc) · 1.18 KB
/
Copy pathcost-centers.controller.ts
File metadata and controls
54 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import { CostCentersService } from './cost-centers.service';
import { CreateCostCenterDto } from './dto/create-cost-center.dto';
import { UpdateCostCenterDto } from './dto/update-cost-center.dto';
@Controller('cost-centers')
export class CostCentersController {
constructor(private readonly svc: CostCentersService) {}
@Post()
create(@Body() dto: CreateCostCenterDto) {
return this.svc.create(dto);
}
@Get()
findAll() {
return this.svc.findAll();
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.svc.findOne(id);
}
@Patch(':id')
update(@Param('id') id: string, @Body() dto: UpdateCostCenterDto) {
return this.svc.update(id, dto);
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.svc.remove(id);
}
// Link existing asset to cost center
@Post(':id/assets/:assetId')
attachAsset(@Param('id') id: string, @Param('assetId') assetId: string) {
return this.svc.attachAsset(id, assetId);
}
// Link existing expense to cost center
@Post(':id/expenses/:expenseId')
attachExpense(@Param('id') id: string, @Param('expenseId') expenseId: string) {
return this.svc.attachExpense(id, expenseId);
}
}