mirror of
https://github.com/GithubOrgProjectPiza/server.git
synced 2026-09-04 08:36:10 +02:00
Fix naming issues in routers and remove unnecessary files
This commit is contained in:
@@ -79,7 +79,7 @@ export const getOrder = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const order = await prisma.restaurant.findUnique({
|
const order = await prisma.order.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const addOrganization = async (req: Request, res: Response) => {
|
|||||||
if (typeof req.body.name !== "string" || typeof req.body.domain !== "string") {
|
if (typeof req.body.name !== "string" || typeof req.body.domain !== "string") {
|
||||||
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
||||||
name: DataType.STRING,
|
name: DataType.STRING,
|
||||||
description: DataType.STRING,
|
domain: DataType.STRING,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ export const updateOrganization = async (req: Request, res: Response) => {
|
|||||||
} else if (typeof req.body.name !== "string" || typeof req.body.domain !== "string") {
|
} else if (typeof req.body.name !== "string" || typeof req.body.domain !== "string") {
|
||||||
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
res.status(HttpStatusCodes.BAD_REQUEST).json({
|
||||||
name: DataType.STRING,
|
name: DataType.STRING,
|
||||||
description: DataType.STRING,
|
domain: DataType.STRING,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ export const getOrganization = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const organization = await prisma.restaurant.findUnique({
|
const organization = await prisma.organization.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { Request, Response } from "express";
|
|
||||||
|
|
||||||
export const sayHello = async (request: Request, response: Response) => {
|
|
||||||
response.status(200).send("Hello!");
|
|
||||||
};
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const testRoutes = require("./routes/testrouter.route");
|
|
||||||
const ordersRoutes = require("./routes/orders.route");
|
const ordersRoutes = require("./routes/orders.route");
|
||||||
const organizationsRoutes = require("./routes/organisations.route");
|
const organizationsRoutes = require("./routes/organisations.route");
|
||||||
const pizzasRoutes = require("./routes/pizzas.route");
|
const pizzasRoutes = require("./routes/pizzas.route");
|
||||||
const restaurantsRoutes = require("./routes/restaurants.route");
|
const restaurantsRoutes = require("./routes/restaurants.route");
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use("/tests", testRoutes);
|
|
||||||
app.use("/order", ordersRoutes);
|
app.use("/order", ordersRoutes);
|
||||||
app.use("/organization", organizationsRoutes);
|
app.use("/organization", organizationsRoutes);
|
||||||
app.use("/pizza", pizzasRoutes);
|
app.use("/pizza", pizzasRoutes);
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import express from "express";
|
|
||||||
import { sayHello } from "../controller/testcontroller.controller";
|
|
||||||
|
|
||||||
export const router = express.Router();
|
|
||||||
|
|
||||||
router.get("/", (request: Request, response: Response) => {
|
|
||||||
response.status(200).send("Cool test stuff!");
|
|
||||||
});
|
|
||||||
|
|
||||||
router.post("/test1", sayHello);
|
|
||||||
|
|
||||||
module.exports = router;
|
|
||||||
Reference in New Issue
Block a user