mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-14 09:57:28 +00:00
Add API operation descriptions and update route paths
This commit is contained in:
@ -9,7 +9,7 @@ import {
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
|
||||
import {
|
||||
UpdateNameDto,
|
||||
@ -20,11 +20,12 @@ import {
|
||||
import { CheckProfilePictureGuard } from 'src/guards/profile.picture.guard';
|
||||
import { SuperAdminRoleGuard } from 'src/guards/super.admin.role.guard';
|
||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route';
|
||||
|
||||
@ApiTags('User Module')
|
||||
@Controller({
|
||||
version: EnableDisableStatusEnum.ENABLED,
|
||||
path: 'user',
|
||||
path: ControllerRoute.USER.ROUTE,
|
||||
})
|
||||
export class UserController {
|
||||
constructor(private readonly userService: UserService) {}
|
||||
@ -32,12 +33,22 @@ export class UserController {
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':userUuid')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.GET_USER_DETAILS_SUMMARY,
|
||||
description: ControllerRoute.USER.ACTIONS.GET_USER_DETAILS_DESCRIPTION,
|
||||
})
|
||||
async getUserDetailsByUserUuid(@Param('userUuid') userUuid: string) {
|
||||
return await this.userService.getUserDetailsByUserUuid(userUuid);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard, CheckProfilePictureGuard)
|
||||
@Put('/profile-picture/:userUuid')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.UPDATE_PROFILE_PICTURE_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.USER.ACTIONS.UPDATE_PROFILE_PICTURE_DESCRIPTION,
|
||||
})
|
||||
async updateProfilePictureByUserUuid(
|
||||
@Param('userUuid') userUuid: string,
|
||||
@Body() updateProfilePictureDataDto: UpdateProfilePictureDataDto,
|
||||
@ -49,13 +60,18 @@ export class UserController {
|
||||
return {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
success: true,
|
||||
message: 'profile picture updated successfully',
|
||||
message: 'Profile picture updated successfully',
|
||||
data: userData,
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Put('/region/:userUuid')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.UPDATE_REGION_SUMMARY,
|
||||
description: ControllerRoute.USER.ACTIONS.UPDATE_REGION_DESCRIPTION,
|
||||
})
|
||||
async updateRegionByUserUuid(
|
||||
@Param('userUuid') userUuid: string,
|
||||
@Body() updateRegionDataDto: UpdateRegionDataDto,
|
||||
@ -67,14 +83,19 @@ export class UserController {
|
||||
return {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
success: true,
|
||||
message: 'region updated successfully',
|
||||
message: 'Region updated successfully',
|
||||
data: userData,
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Put('/timezone/:userUuid')
|
||||
async updateNameByUserUuid(
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.UPDATE_TIMEZONE_SUMMARY,
|
||||
description: ControllerRoute.USER.ACTIONS.UPDATE_TIMEZONE_DESCRIPTION,
|
||||
})
|
||||
async updateTimezoneByUserUuid(
|
||||
@Param('userUuid') userUuid: string,
|
||||
@Body() updateTimezoneDataDto: UpdateTimezoneDataDto,
|
||||
) {
|
||||
@ -85,14 +106,19 @@ export class UserController {
|
||||
return {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
success: true,
|
||||
message: 'timezone updated successfully',
|
||||
message: 'Timezone updated successfully',
|
||||
data: userData,
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Put('/name/:userUuid')
|
||||
async updateTimezoneByUserUuid(
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.UPDATE_NAME_SUMMARY,
|
||||
description: ControllerRoute.USER.ACTIONS.UPDATE_NAME_DESCRIPTION,
|
||||
})
|
||||
async updateNameByUserUuid(
|
||||
@Param('userUuid') userUuid: string,
|
||||
@Body() updateNameDto: UpdateNameDto,
|
||||
) {
|
||||
@ -103,13 +129,18 @@ export class UserController {
|
||||
return {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
success: true,
|
||||
message: 'name updated successfully',
|
||||
message: 'Name updated successfully',
|
||||
data: userData,
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(SuperAdminRoleGuard)
|
||||
@Delete('/:userUuid')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.USER.ACTIONS.DELETE_USER_SUMMARY,
|
||||
description: ControllerRoute.USER.ACTIONS.DELETE_USER_DESCRIPTION,
|
||||
})
|
||||
async userDelete(@Param('userUuid') userUuid: string) {
|
||||
await this.userService.deleteUser(userUuid);
|
||||
return {
|
||||
@ -117,7 +148,7 @@ export class UserController {
|
||||
data: {
|
||||
userUuid,
|
||||
},
|
||||
message: 'User Deleted Successfully',
|
||||
message: 'User deleted successfully',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user