mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-11 15:48:09 +00:00
updated endpoint and validation to manage project entity in communty CRUD
This commit is contained in:
@ -19,6 +19,7 @@ import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route';
|
||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import { PaginationRequestGetListDto } from '@app/common/dto/pagination.request.dto';
|
||||
import { ProjectParam } from '../dtos';
|
||||
|
||||
@ApiTags('Community Module')
|
||||
@Controller({
|
||||
@ -36,9 +37,10 @@ export class CommunityController {
|
||||
description: ControllerRoute.COMMUNITY.ACTIONS.CREATE_COMMUNITY_DESCRIPTION,
|
||||
})
|
||||
async createCommunity(
|
||||
@Param() param: ProjectParam,
|
||||
@Body() addCommunityDto: AddCommunityDto,
|
||||
): Promise<BaseResponseDto> {
|
||||
return await this.communityService.createCommunity(addCommunityDto);
|
||||
return await this.communityService.createCommunity(param, addCommunityDto);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@ -52,7 +54,7 @@ export class CommunityController {
|
||||
async getCommunityByUuid(
|
||||
@Param() params: GetCommunityParams,
|
||||
): Promise<BaseResponseDto> {
|
||||
return await this.communityService.getCommunityById(params.communityUuid);
|
||||
return await this.communityService.getCommunityById(params);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@ -63,9 +65,10 @@ export class CommunityController {
|
||||
})
|
||||
@Get()
|
||||
async getCommunities(
|
||||
@Param() param: ProjectParam,
|
||||
@Query() query: PaginationRequestGetListDto,
|
||||
): Promise<BaseResponseDto> {
|
||||
return this.communityService.getCommunities(query);
|
||||
return this.communityService.getCommunities(param, query);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@ -76,13 +79,10 @@ export class CommunityController {
|
||||
})
|
||||
@Put('/:communityUuid')
|
||||
async updateCommunity(
|
||||
@Param() param: GetCommunityParams,
|
||||
@Param() params: GetCommunityParams,
|
||||
@Body() updateCommunityDto: UpdateCommunityNameDto,
|
||||
) {
|
||||
return this.communityService.updateCommunity(
|
||||
param.communityUuid,
|
||||
updateCommunityDto,
|
||||
);
|
||||
return this.communityService.updateCommunity(params, updateCommunityDto);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@ -93,8 +93,8 @@ export class CommunityController {
|
||||
description: ControllerRoute.COMMUNITY.ACTIONS.DELETE_COMMUNITY_DESCRIPTION,
|
||||
})
|
||||
async deleteCommunity(
|
||||
@Param() param: GetCommunityParams,
|
||||
@Param() params: GetCommunityParams,
|
||||
): Promise<BaseResponseDto> {
|
||||
return this.communityService.deleteCommunity(param.communityUuid);
|
||||
return this.communityService.deleteCommunity(params);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user