mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 12:19:16 +00:00
added eslint and prrettier config files
This commit is contained in:
23
backend/src/routes/index.ts
Normal file
23
backend/src/routes/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Router } from "express";
|
||||
|
||||
import userRoutes from "./userRoutes";
|
||||
|
||||
// const AuthRoutes = require("./routes/auth");
|
||||
// const TicketsRoutes = require("./routes/tickets");
|
||||
// const MessagesRoutes = require("./routes/messages");
|
||||
// const ContactsRoutes = require("./routes/contacts");
|
||||
// const WhatsRoutes = require("./routes/whatsapp");
|
||||
// const UsersRoutes = require("./routes/users");
|
||||
// const SettingsRoutes = require("./routes/settings");
|
||||
|
||||
const routes = Router();
|
||||
|
||||
routes.use(userRoutes);
|
||||
// routes.use("/auth", AuthRoutes);
|
||||
// routes.use(TicketsRoutes);
|
||||
// routes.use(MessagesRoutes);
|
||||
// routes.use(ContactsRoutes);
|
||||
// routes.use(WhatsRoutes);
|
||||
// routes.use(SettingsRoutes);
|
||||
|
||||
export default routes;
|
||||
16
backend/src/routes/routes/auth.js
Normal file
16
backend/src/routes/routes/auth.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const express = require("express");
|
||||
const SessionController = require("../../controllers/SessionController");
|
||||
const UserController = require("../../controllers/UserController");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.post("/signup", UserController.store);
|
||||
|
||||
routes.post("/login", SessionController.store);
|
||||
|
||||
routes.get("/check", isAuth, (req, res) => {
|
||||
res.status(200).json({ authenticated: true });
|
||||
});
|
||||
|
||||
module.exports = routes;
|
||||
21
backend/src/routes/routes/contacts.js
Normal file
21
backend/src/routes/routes/contacts.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const ContactController = require("../../controllers/ContactController");
|
||||
const ImportPhoneContactsController = require("../../controllers/ImportPhoneContactsController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.post("/contacts/import", isAuth, ImportPhoneContactsController.store);
|
||||
|
||||
routes.get("/contacts", isAuth, ContactController.index);
|
||||
|
||||
routes.get("/contacts/:contactId", isAuth, ContactController.show);
|
||||
|
||||
routes.post("/contacts", isAuth, ContactController.store);
|
||||
|
||||
routes.put("/contacts/:contactId", isAuth, ContactController.update);
|
||||
|
||||
routes.delete("/contacts/:contactId", isAuth, ContactController.delete);
|
||||
|
||||
module.exports = routes;
|
||||
12
backend/src/routes/routes/messages.js
Normal file
12
backend/src/routes/routes/messages.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const MessageController = require("../../controllers/MessageController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/messages/:ticketId", isAuth, MessageController.index);
|
||||
|
||||
routes.post("/messages/:ticketId", isAuth, MessageController.store);
|
||||
|
||||
module.exports = routes;
|
||||
14
backend/src/routes/routes/settings.js
Normal file
14
backend/src/routes/routes/settings.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const SettingController = require("../../controllers/SettingController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/settings", isAuth, SettingController.index);
|
||||
|
||||
// routes.get("/settings/:settingKey", isAuth, SettingsController.show);
|
||||
|
||||
routes.put("/settings/:settingKey", isAuth, SettingController.update);
|
||||
|
||||
module.exports = routes;
|
||||
16
backend/src/routes/routes/tickets.js
Normal file
16
backend/src/routes/routes/tickets.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const TicketController = require("../../controllers/TicketController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/tickets", isAuth, TicketController.index);
|
||||
|
||||
routes.post("/tickets", isAuth, TicketController.store);
|
||||
|
||||
routes.put("/tickets/:ticketId", isAuth, TicketController.update);
|
||||
|
||||
routes.delete("/tickets/:ticketId", isAuth, TicketController.delete);
|
||||
|
||||
module.exports = routes;
|
||||
18
backend/src/routes/routes/whatsapp.js
Normal file
18
backend/src/routes/routes/whatsapp.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const WhatsAppController = require("../../controllers/WhatsAppController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/whatsapp/", isAuth, WhatsAppController.index);
|
||||
|
||||
routes.post("/whatsapp/", isAuth, WhatsAppController.store);
|
||||
|
||||
routes.get("/whatsapp/:whatsappId", isAuth, WhatsAppController.show);
|
||||
|
||||
routes.put("/whatsapp/:whatsappId", isAuth, WhatsAppController.update);
|
||||
|
||||
routes.delete("/whatsapp/:whatsappId", isAuth, WhatsAppController.delete);
|
||||
|
||||
module.exports = routes;
|
||||
20
backend/src/routes/routes/whatsappsessions.js
Normal file
20
backend/src/routes/routes/whatsappsessions.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const express = require("express");
|
||||
const isAuth = require("../../middleware/is-auth");
|
||||
|
||||
const WhatsAppSessionController = require("../../controllers/WhatsAppSessionController");
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get(
|
||||
"/whatsappsession/:whatsappId",
|
||||
isAuth,
|
||||
WhatsAppSessionController.show
|
||||
);
|
||||
|
||||
routes.delete(
|
||||
"/whatsappsession/:whatsappId",
|
||||
isAuth,
|
||||
WhatsAppSessionController.delete
|
||||
);
|
||||
|
||||
module.exports = routes;
|
||||
20
backend/src/routes/userRoutes.ts
Normal file
20
backend/src/routes/userRoutes.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Router } from "express";
|
||||
|
||||
// const isAuth = require("../../middleware/is-auth");
|
||||
// const UserController = require("../../controllers/UserController");
|
||||
|
||||
const userRoutes = Router();
|
||||
|
||||
userRoutes.get("/users", (req, res) =>
|
||||
res.json({ meessage: "lets do some prettier shit here" })
|
||||
);
|
||||
|
||||
// routes.post("/users", isAuth, UserController.store);
|
||||
|
||||
// routes.put("/users/:userId", isAuth, UserController.update);
|
||||
|
||||
// routes.get("/users/:userId", isAuth, UserController.show);
|
||||
|
||||
// routes.delete("/users/:userId", isAuth, UserController.delete);
|
||||
|
||||
export default userRoutes;
|
||||
Reference in New Issue
Block a user