diff --git a/apps/backend/src/app/author/author.controller.spec.ts b/apps/backend/src/app/author/author.controller.spec.ts new file mode 100644 index 0000000..44cffa6 --- /dev/null +++ b/apps/backend/src/app/author/author.controller.spec.ts @@ -0,0 +1,20 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AuthorController } from './author.controller'; +import { AuthorService } from './author.service'; + +describe('AuthorController', () => { + let controller: AuthorController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [AuthorController], + providers: [AuthorService], + }).compile(); + + controller = module.get(AuthorController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/apps/backend/src/app/author/author.controller.ts b/apps/backend/src/app/author/author.controller.ts new file mode 100644 index 0000000..3b60c69 --- /dev/null +++ b/apps/backend/src/app/author/author.controller.ts @@ -0,0 +1,41 @@ +import { Controller, DefaultValuePipe, Delete, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common'; +import { AuthorService } from './author.service'; + +@Controller('author') +export class AuthorController { + constructor(private readonly authorService: AuthorService) {} + + @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 newAuthor() { + + } + + //DELETE a group + @Delete(":authorId") + async deleteAuthor(@Param('authorId') authorId: string) { + + } + + //GET files associated to author with limit and offset + @Get(":authorId") + async getForAuthor( + @Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number, + @Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number, + @Query("search", new DefaultValuePipe("")) search: string, + @Param('authorId') authorId: string + ) { + const query = {limit, offset, search} + + } +} diff --git a/apps/backend/src/app/author/author.module.ts b/apps/backend/src/app/author/author.module.ts new file mode 100644 index 0000000..e0e32c6 --- /dev/null +++ b/apps/backend/src/app/author/author.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { AuthorService } from './author.service'; +import { AuthorController } from './author.controller'; + +@Module({ + controllers: [AuthorController], + providers: [AuthorService], +}) +export class AuthorModule {} diff --git a/apps/backend/src/app/author/author.service.spec.ts b/apps/backend/src/app/author/author.service.spec.ts new file mode 100644 index 0000000..4a56e64 --- /dev/null +++ b/apps/backend/src/app/author/author.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AuthorService } from './author.service'; + +describe('AuthorService', () => { + let service: AuthorService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [AuthorService], + }).compile(); + + service = module.get(AuthorService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/backend/src/app/author/author.service.ts b/apps/backend/src/app/author/author.service.ts new file mode 100644 index 0000000..fd036d1 --- /dev/null +++ b/apps/backend/src/app/author/author.service.ts @@ -0,0 +1,4 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class AuthorService {}