Compare commits

...

3 Commits

Author SHA1 Message Date
0c94d16b19
Refactor authors controller and add admin guard
Renamed routes and incorporated `AdminGuard` for deletion. Adjusted parameter names and simplified function bodies to improve readability and security.
2024-10-08 13:38:29 +02:00
d69589c781
Add a TODO comment in groups.controller.ts
Inserted a TODO comment to indicate the need for a DTO in the newGroup method. This serves as a reminder for future development and enhances code readability and maintainability.
2024-10-08 13:38:21 +02:00
d171c72dcf
Add TODO comments for future improvements
Inserted TODO comments to signal necessary future additions like DTOs, patches, and CRUD operations associated with machine file types. These placeholders will help guide the development of these features.
2024-10-08 13:38:07 +02:00
3 changed files with 19 additions and 17 deletions

View File

@ -6,39 +6,37 @@ import {
Param,
ParseIntPipe,
Post,
Query,
} from "@nestjs/common";
Query, UseGuards
} from '@nestjs/common';
import { AuthorsService } from "apps/backend/src/app/authors/authors.service";
import { AdminGuard } from 'apps/backend/src/app/auth/auth.guard';
@Controller("authors")
export class AuthorsController {
constructor(private readonly authorService: AuthorsService) {}
@Get()
@Get("find")
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
//TODO DTO
@Post("new")
async newAuthor() {}
//DELETE a group
@Delete(":authorId")
async deleteAuthor(@Param("authorId") authorId: string) {}
@UseGuards(AdminGuard)
@Delete(":autor")
async deleteAuthor(@Param("machineId") machineId: string) {}
//GET files associated to authors with limit and offset
@Get(":authorId")
async getForAuthor(
//TODO Patch
@Get(":author/files")
async getFilesForAuthor(
@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 };
}
@Param("machineId") machineId: string,
) {}
}

View File

@ -25,6 +25,7 @@ export class GroupsController {
@Query("search", new DefaultValuePipe("")) search: string,
) {}
//TODO DTO
@Post("new")
async newGroup() {}

View File

@ -24,6 +24,7 @@ export class MachinesController {
@Query("search", new DefaultValuePipe("")) search: string,
) {}
//TODO DTO
@UseGuards(AdminGuard)
@Post("new")
async newMachine() {}
@ -34,6 +35,8 @@ export class MachinesController {
//TODO Patch
//TODO CRUD fileType associated to machine
@Get(":machineId/files")
async getFilesForMachine(
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,