Improve groups.controller with service integration
This commit adds service method calls for managing groups in the controller. It includes integration for fetching groups by name, creating a new group, deleting a group, and finding files for a group. These changes enhance the functionality and efficiency of the groups controller.
This commit is contained in:
parent
fc2f437556
commit
04cc2daf43
@ -24,15 +24,20 @@ export class GroupsController {
|
|||||||
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,
|
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,
|
||||||
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
||||||
@Query("search", new DefaultValuePipe("")) search: string,
|
@Query("search", new DefaultValuePipe("")) search: string,
|
||||||
) {}
|
) {
|
||||||
|
return await this.groupsService.getGroupsByName(limit, offset, search)
|
||||||
|
}
|
||||||
|
|
||||||
//TODO DTO
|
|
||||||
@Post("new")
|
@Post("new")
|
||||||
async newGroup() {}
|
async newGroup(@Body() body: CreateGroupDto) {
|
||||||
|
return await this.groupsService.newGroup(body.groupName)
|
||||||
|
}
|
||||||
|
|
||||||
@UseGuards(AdminGuard)
|
@UseGuards(AdminGuard)
|
||||||
@Delete(":groupId")
|
@Delete(":groupId")
|
||||||
async deleteGroup(@Param("groupId") groupId: string) {}
|
async deleteGroup(@Param("groupId") groupId: string) {
|
||||||
|
return await this.groupsService.deleteGroup(groupId)
|
||||||
|
}
|
||||||
|
|
||||||
//TODO Patch
|
//TODO Patch
|
||||||
|
|
||||||
@ -42,5 +47,7 @@ export class GroupsController {
|
|||||||
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
||||||
@Query("search", new DefaultValuePipe("")) search: string,
|
@Query("search", new DefaultValuePipe("")) search: string,
|
||||||
@Param("groupId") groupId: string,
|
@Param("groupId") groupId: string,
|
||||||
) {}
|
) {
|
||||||
|
return await this.groupsService.findFilesForGroup(limit, offset, search, groupId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user