60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Patch,
|
|
Delete,
|
|
Param,
|
|
Body,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { TenantsService } from './tenants.service';
|
|
import { CreateTenantDto } from './dto/create-tenant.dto';
|
|
import { UpdateTenantDto } from './dto/update-tenant.dto';
|
|
import { TenantListQueryDto } from './dto/list-query.dto';
|
|
|
|
@Controller('tenants')
|
|
export class TenantsController {
|
|
constructor(private readonly service: TenantsService) {}
|
|
|
|
@Get()
|
|
findAll(@Query() query: TenantListQueryDto) {
|
|
return this.service.findAll(query);
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.service.findOne(id);
|
|
}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateTenantDto) {
|
|
return this.service.create(dto);
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(@Param('id') id: string, @Body() dto: UpdateTenantDto) {
|
|
return this.service.update(id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.service.remove(id);
|
|
}
|
|
|
|
@Patch(':id/activate')
|
|
activate(@Param('id') id: string) {
|
|
return this.service.activate(id);
|
|
}
|
|
|
|
@Patch(':id/deactivate')
|
|
deactivate(@Param('id') id: string) {
|
|
return this.service.deactivate(id);
|
|
}
|
|
|
|
@Get(':id/users')
|
|
getTenantUsers(@Param('id') tenantId: string) {
|
|
return this.service.getTenantUsers(tenantId);
|
|
}
|
|
}
|