fix: ensure HttpCode annotations for specific endpoints in users and groups controllers refactor: enhance person handling logic in groups service for better e2e test support fix: improve CORS configuration for handling additional origins feat: add @Public decorator to app controller's root endpoint refactor: modify projects controller to return JSON responses for check-access endpoint
79 lines
1.5 KiB
TypeScript
79 lines
1.5 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
HttpCode,
|
|
HttpStatus,
|
|
} from '@nestjs/common';
|
|
import { UsersService } from '../services/users.service';
|
|
import { CreateUserDto } from '../dto/create-user.dto';
|
|
import { UpdateUserDto } from '../dto/update-user.dto';
|
|
|
|
@Controller('users')
|
|
export class UsersController {
|
|
constructor(private readonly usersService: UsersService) {}
|
|
|
|
/**
|
|
* Create a new user
|
|
*/
|
|
@Post()
|
|
@HttpCode(HttpStatus.CREATED)
|
|
create(@Body() createUserDto: CreateUserDto) {
|
|
return this.usersService.create(createUserDto);
|
|
}
|
|
|
|
/**
|
|
* Get all users
|
|
*/
|
|
@Get()
|
|
findAll() {
|
|
return this.usersService.findAll();
|
|
}
|
|
|
|
/**
|
|
* Get a user by ID
|
|
*/
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.usersService.findById(id);
|
|
}
|
|
|
|
/**
|
|
* Update a user
|
|
*/
|
|
@Patch(':id')
|
|
update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) {
|
|
return this.usersService.update(id, updateUserDto);
|
|
}
|
|
|
|
/**
|
|
* Delete a user
|
|
*/
|
|
@Delete(':id')
|
|
@HttpCode(HttpStatus.NO_CONTENT)
|
|
remove(@Param('id') id: string) {
|
|
return this.usersService.remove(id);
|
|
}
|
|
|
|
/**
|
|
* Update GDPR consent timestamp
|
|
*/
|
|
@Post(':id/gdpr-consent')
|
|
@HttpCode(HttpStatus.OK)
|
|
updateGdprConsent(@Param('id') id: string) {
|
|
return this.usersService.updateGdprConsent(id);
|
|
}
|
|
|
|
/**
|
|
* Export user data (for GDPR compliance)
|
|
*/
|
|
@Get(':id/export-data')
|
|
exportUserData(@Param('id') id: string) {
|
|
return this.usersService.exportUserData(id);
|
|
}
|
|
}
|