Correct formatting

This commit is contained in:
Stone_Red
2022-04-02 18:51:49 +02:00
parent 608710be60
commit 22d7865065
11 changed files with 41 additions and 29 deletions
+5 -5
View File
@@ -15,8 +15,8 @@ export const addOrganization = async (req: Request, res: Response) => {
const organization = await prisma.organization.create({
data: {
name: req.body.name,
domain: req.body.domain
}
domain: req.body.domain,
},
});
res.status(HttpStatusCodes.CREATED).json(organization);
@@ -43,7 +43,7 @@ export const updateOrganization = async (req: Request, res: Response) => {
},
data: {
name: req.body.name,
domain: req.body.domain
domain: req.body.domain,
},
});
@@ -62,7 +62,7 @@ export const deleteOrganization = async (req: Request, res: Response) => {
await prisma.organization.delete({
where: {
id: id,
}
},
});
res.status(HttpStatusCodes.NO_CONTENT).json();
@@ -80,7 +80,7 @@ export const getOrganization = async (req: Request, res: Response) => {
const organization = await prisma.restaurant.findUnique({
where: {
id: id,
}
},
});
res.status(HttpStatusCodes.OK).json(organization);
+16 -8
View File
@@ -4,11 +4,15 @@ import { DataType } from "../datatypes";
import prisma from "../lib/prisma.lib";
export const addPizza = async (req: Request, res: Response) => {
if (typeof req.body.name !== "string" || typeof req.body.description !== "string" || typeof req.body.restaurantId !== "number") {
if (
typeof req.body.name !== "string" ||
typeof req.body.description !== "string" ||
typeof req.body.restaurantId !== "number"
) {
res.status(HttpStatusCodes.BAD_REQUEST).json({
name: DataType.STRING,
description: DataType.STRING,
restaurantId: DataType.NUMBER
restaurantId: DataType.NUMBER,
});
return;
}
@@ -17,7 +21,7 @@ export const addPizza = async (req: Request, res: Response) => {
data: {
name: req.body.name,
description: req.body.description,
restaurantId: req.body.restaurantId
restaurantId: req.body.restaurantId,
},
});
@@ -31,11 +35,15 @@ export const updatePizza = async (req: Request, res: Response) => {
res.status(HttpStatusCodes.BAD_REQUEST).json({
id: DataType.NUMBER,
});
} else if (typeof req.body.name !== "string" || typeof req.body.description !== "string" || typeof req.body.restaurantId !== "number") {
} else if (
typeof req.body.name !== "string" ||
typeof req.body.description !== "string" ||
typeof req.body.restaurantId !== "number"
) {
res.status(HttpStatusCodes.BAD_REQUEST).json({
name: DataType.STRING,
description: DataType.STRING,
restaurantId: DataType.NUMBER
restaurantId: DataType.NUMBER,
});
return;
}
@@ -65,7 +73,7 @@ export const deletePizza = async (req: Request, res: Response) => {
await prisma.pizza.delete({
where: {
id: id,
}
},
});
res.status(HttpStatusCodes.NO_CONTENT).json();
@@ -82,8 +90,8 @@ export const getPizza = async (req: Request, res: Response) => {
const pizza = await prisma.pizza.findUnique({
where: {
id: id
}
id: id,
},
});
res.status(HttpStatusCodes.OK).json(pizza);
+3 -3
View File
@@ -62,7 +62,7 @@ export const deleteRestaurant = async (req: Request, res: Response) => {
await prisma.restaurant.delete({
where: {
id: id,
}
},
});
res.status(HttpStatusCodes.NO_CONTENT).json();
@@ -79,8 +79,8 @@ export const getRestaurant = async (req: Request, res: Response) => {
const restaurant = await prisma.restaurant.findUnique({
where: {
id: id
}
id: id,
},
});
res.status(HttpStatusCodes.OK).json(restaurant);
+2 -3
View File
@@ -1,6 +1,5 @@
import { Request, Response } from "express";
export const sayHello = async (request: Request, response: Response) =>
{
export const sayHello = async (request: Request, response: Response) => {
response.status(200).send("Hello!");
}
};
+1 -1
View File
@@ -1,4 +1,4 @@
import express, { Request, Response } from "express";
import express from "express";
import { addOrder, deleteOrder, getOrder, updateOrder } from "../controller/orders.controller";
const router = express.Router();
+7 -2
View File
@@ -1,5 +1,10 @@
import express, { Request, Response } from "express";
import { addOrganization, deleteOrganization, getOrganization, updateOrganization } from "../controller/organisations.controller";
import express from "express";
import {
addOrganization,
deleteOrganization,
getOrganization,
updateOrganization,
} from "../controller/organisations.controller";
const router = express.Router();
+2 -2
View File
@@ -1,5 +1,5 @@
import express, { Request, Response } from "express";
import { addPizza, deletePizza, getPizza, updatePizza } from "..///controller/pizzas.controller";
import express from "express";
import { addPizza, deletePizza, getPizza, updatePizza } from "../controller/pizzas.controller";
const router = express.Router();
+1 -1
View File
@@ -1,4 +1,4 @@
import express, { Request, Response } from "express";
import express from "express";
import { addRestaurant, deleteRestaurant, getRestaurant, updateRestaurant } from "../controller/restaurants.controller";
const router = express.Router();
+1 -1
View File
@@ -1,4 +1,4 @@
import express, { Request, Response } from "express";
import express from "express";
import { sayHello } from "../controller/testcontroller.controller";
export const router = express.Router();