diff --git a/apps/backend/src/app/groups/groups.controller.ts b/apps/backend/src/app/groups/groups.controller.ts index 728e29e..85569e5 100644 --- a/apps/backend/src/app/groups/groups.controller.ts +++ b/apps/backend/src/app/groups/groups.controller.ts @@ -1,7 +1,43 @@ -import { Controller } from '@nestjs/common'; +import { Controller, DefaultValuePipe, Delete, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common'; import { GroupsService } from './groups.service'; +import { ISearchQuery } from 'apps/backend/src/app/groups/groups.types'; @Controller('groups') export class GroupsController { constructor(private readonly groupsService: GroupsService) {} + + //GET all groups with limit and offset + optional search + @Get() + async findMany( + @Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number, + @Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number, + @Query("search", new DefaultValuePipe("")) search: string + ) { + const query = {limit, offset, search} + + } + + //POST a new group + @Post("new") + async newGroup() { + + } + + //DELETE a group + @Delete(":groupId") + async deleteGroup(@Param('groupId') groupId: string) { + + } + + //GET files associated to group with limit and offset + @Get(":groupId") + async getForGroup( + @Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number, + @Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number, + @Query("search", new DefaultValuePipe("")) search: string, + @Param('groupId') groupId: string + ) { + const query = {limit, offset, search} + + } } diff --git a/apps/backend/src/app/groups/groups.dto.ts b/apps/backend/src/app/groups/groups.dto.ts new file mode 100644 index 0000000..e69de29 diff --git a/apps/backend/src/app/groups/groups.types.ts b/apps/backend/src/app/groups/groups.types.ts new file mode 100644 index 0000000..5fcc2ee --- /dev/null +++ b/apps/backend/src/app/groups/groups.types.ts @@ -0,0 +1,5 @@ +export interface ISearchQuery { + limit: number; + offset: number; + search?: string; +} \ No newline at end of file