Compare commits
5 Commits
ec8af843b5
...
e931822010
Author | SHA1 | Date | |
---|---|---|---|
e931822010 | |||
d3feeb6d6a | |||
fd1742e9dc | |||
392446fa06 | |||
f72b7ad9cb |
@ -77,24 +77,30 @@ export class FilesController {
|
||||
}
|
||||
|
||||
console.log("Executing save procedure...");
|
||||
return res
|
||||
// @ts-ignore
|
||||
.status(HttpStatus.CREATED)
|
||||
.send(await this.filesService.save(fileBuffer, Params));
|
||||
return (
|
||||
res
|
||||
// @ts-ignore
|
||||
.status(HttpStatus.CREATED)
|
||||
.send(await this.filesService.save(fileBuffer, Params))
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return res
|
||||
// @ts-ignore
|
||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.send(err);
|
||||
return (
|
||||
res
|
||||
// @ts-ignore
|
||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.send(err)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
req.on("error", (err) => {
|
||||
return res
|
||||
// @ts-ignore
|
||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.send(err);
|
||||
return (
|
||||
res
|
||||
// @ts-ignore
|
||||
.status(err.status || HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.send(err)
|
||||
);
|
||||
});
|
||||
|
||||
return;
|
||||
@ -107,7 +113,7 @@ export class FilesController {
|
||||
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
||||
@Query("search", new DefaultValuePipe("")) search: string,
|
||||
) {
|
||||
return this.filesService.search(limit, offset, search)
|
||||
return this.filesService.search(limit, offset, search);
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.FOUND)
|
||||
|
@ -7,42 +7,38 @@ import {
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Post,
|
||||
Query,
|
||||
} from "@nestjs/common";
|
||||
Query, UseGuards
|
||||
} from '@nestjs/common';
|
||||
import { CreateGroupDto } from "apps/backend/src/app/groups/groups.dto";
|
||||
import { ISearchQuery } from "apps/backend/src/app/groups/groups.types";
|
||||
import { GroupsService } from "./groups.service";
|
||||
import { AdminGuard } from 'apps/backend/src/app/auth/auth.guard';
|
||||
|
||||
@Controller("groups")
|
||||
export class GroupsController {
|
||||
constructor(private readonly groupsService: GroupsService) {}
|
||||
|
||||
//GET all groups with limit and offset + optional search
|
||||
@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,
|
||||
) {
|
||||
//TODO add service method
|
||||
}
|
||||
) {}
|
||||
|
||||
//POST a new group
|
||||
@Post("new")
|
||||
async newGroup(@Body() dto: CreateGroupDto) {}
|
||||
async newGroup() {}
|
||||
|
||||
//DELETE a group
|
||||
@UseGuards(AdminGuard)
|
||||
@Delete(":groupId")
|
||||
async deleteGroup(@Param("groupId") groupId: string) {}
|
||||
|
||||
//GET files associated to group with limit and offset
|
||||
@Get(":groupId")
|
||||
async getForGroup(
|
||||
//TODO Patch
|
||||
|
||||
@Get(":groupId/files")
|
||||
async getFilesForGroup(
|
||||
@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 };
|
||||
}
|
||||
) {}
|
||||
}
|
||||
|
@ -4,38 +4,41 @@ import {
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseBoolPipe,
|
||||
ParseIntPipe,
|
||||
Post,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from "@nestjs/common";
|
||||
import { AdminGuard } from "apps/backend/src/app/auth/auth.guard";
|
||||
import { MachinesService } from "apps/backend/src/app/machines/machines.service";
|
||||
|
||||
@Controller("machines")
|
||||
export class MachinesController {
|
||||
constructor(private readonly machineService: MachinesService) {}
|
||||
|
||||
@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 };
|
||||
}
|
||||
) {}
|
||||
|
||||
@UseGuards(AdminGuard)
|
||||
@Post("new")
|
||||
async newMachine() {}
|
||||
|
||||
@UseGuards(AdminGuard)
|
||||
@Delete(":machineId")
|
||||
async deleteGroup(@Param("machineId") machineId: string) {}
|
||||
async deleteMachine(@Param("machineId") machineId: string) {}
|
||||
|
||||
@Get(":groupId")
|
||||
async getForGroup(
|
||||
//TODO Patch
|
||||
|
||||
@Get(":machineId/files")
|
||||
async getFilesForMachine(
|
||||
@Query("limit", new DefaultValuePipe(20), ParseIntPipe) limit: number,
|
||||
@Query("offset", new DefaultValuePipe(0), ParseIntPipe) offset: number,
|
||||
@Query("search", new DefaultValuePipe("")) search: string,
|
||||
@Param("machineId") machineId: string,
|
||||
) {
|
||||
const query = { limit, offset, search };
|
||||
}
|
||||
) {}
|
||||
}
|
||||
|
@ -2,9 +2,10 @@ import { Module } from "@nestjs/common";
|
||||
import { DbModule } from "apps/backend/src/app/db/db.module";
|
||||
import { MachinesController } from "apps/backend/src/app/machines/machines.controller";
|
||||
import { MachinesService } from "apps/backend/src/app/machines/machines.service";
|
||||
import { CredentialsModule } from 'apps/backend/src/app/credentials/credentials.module';
|
||||
|
||||
@Module({
|
||||
imports: [DbModule],
|
||||
imports: [DbModule, CredentialsModule],
|
||||
controllers: [MachinesController],
|
||||
providers: [MachinesService],
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user