64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
UseGuards,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { PageLayoutService } from './page-layout.service';
|
|
import { CreatePageLayoutDto, UpdatePageLayoutDto, PageLayoutType } from './dto/page-layout.dto';
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
import { TenantId } from '../tenant/tenant.decorator';
|
|
|
|
@Controller('page-layouts')
|
|
@UseGuards(JwtAuthGuard)
|
|
export class PageLayoutController {
|
|
constructor(private readonly pageLayoutService: PageLayoutService) {}
|
|
|
|
@Post()
|
|
create(@TenantId() tenantId: string, @Body() createPageLayoutDto: CreatePageLayoutDto) {
|
|
return this.pageLayoutService.create(tenantId, createPageLayoutDto);
|
|
}
|
|
|
|
@Get()
|
|
findAll(
|
|
@TenantId() tenantId: string,
|
|
@Query('objectId') objectId?: string,
|
|
@Query('layoutType') layoutType?: PageLayoutType,
|
|
) {
|
|
return this.pageLayoutService.findAll(tenantId, objectId, layoutType);
|
|
}
|
|
|
|
@Get('default/:objectId')
|
|
findDefaultByObject(
|
|
@TenantId() tenantId: string,
|
|
@Param('objectId') objectId: string,
|
|
@Query('layoutType') layoutType?: PageLayoutType,
|
|
) {
|
|
return this.pageLayoutService.findDefaultByObject(tenantId, objectId, layoutType || 'detail');
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@TenantId() tenantId: string, @Param('id') id: string) {
|
|
return this.pageLayoutService.findOne(tenantId, id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(
|
|
@TenantId() tenantId: string,
|
|
@Param('id') id: string,
|
|
@Body() updatePageLayoutDto: UpdatePageLayoutDto,
|
|
) {
|
|
return this.pageLayoutService.update(tenantId, id, updatePageLayoutDto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@TenantId() tenantId: string, @Param('id') id: string) {
|
|
return this.pageLayoutService.remove(tenantId, id);
|
|
}
|
|
}
|