import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common' import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard' import { CurrentUser } from '../../common/decorators/current-user.decorator' import { OrgsService } from './orgs.service' import { CreateOrgDto, UpdateOrgDto } from './dto/org.dto' @Controller('orgs') @UseGuards(JwtAuthGuard) export class OrgsController { constructor(private readonly orgsService: OrgsService) {} @Post() create(@Body() dto: CreateOrgDto) { return this.orgsService.create(dto) } @Get() findAll() { return this.orgsService.findAll() } @Get(':id') findOne(@Param('id') id: string) { return this.orgsService.findOne(id) } @Patch(':id') update(@Param('id') id: string, @Body() dto: UpdateOrgDto) { return this.orgsService.update(id, dto) } @Delete(':id') remove(@Param('id') id: string) { return this.orgsService.remove(id) } @Get(':id/me-access') myAccess(@Param('id') orgId: string, @CurrentUser() user: { userId: string }) { return this.orgsService.ensureUserInOrg(user.userId, orgId) } }