31 lines
610 B
TypeScript
31 lines
610 B
TypeScript
import { Body, Controller, Get, Post } from '@nestjs/common';
|
|
import { IsOptional, IsString } from 'class-validator';
|
|
import { TenantService } from './tenant.service';
|
|
|
|
class CreateTenantDto {
|
|
@IsString()
|
|
name: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
taxId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
status?: string;
|
|
}
|
|
|
|
@Controller('tenants')
|
|
export class TenantController {
|
|
constructor(private readonly tenantService: TenantService) {}
|
|
|
|
@Post()
|
|
create(@Body() body: CreateTenantDto) {
|
|
return this.tenantService.create(body);
|
|
}
|
|
|
|
@Get()
|
|
list() {
|
|
return this.tenantService.list();
|
|
}
|
|
}
|