mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-21 13:19:21 +00:00
changed contacts routes to typescript
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Router } from "express";
|
||||
import { Router, Request, Response } from "express";
|
||||
import SessionController from "../controllers/SessionController";
|
||||
import isAuth from "../middleware/isAuth";
|
||||
import * as UserController from "../controllers/UserController";
|
||||
|
||||
const authRoutes = Router();
|
||||
@@ -8,4 +9,8 @@ authRoutes.post("/signup", UserController.store);
|
||||
|
||||
authRoutes.post("/login", SessionController);
|
||||
|
||||
authRoutes.get("/check", isAuth, (req: Request, res: Response) => {
|
||||
res.status(200).json({ authenticated: true });
|
||||
});
|
||||
|
||||
export default authRoutes;
|
||||
|
||||
21
backend/src/routes/contactRoutes.ts
Normal file
21
backend/src/routes/contactRoutes.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import express from "express";
|
||||
import isAuth from "../middleware/isAuth";
|
||||
|
||||
import * as ContactController from "../controllers/ContactController";
|
||||
// import ImportPhoneContactsController from "../controllers/ImportPhoneContactsController";
|
||||
|
||||
const contactRoutes = express.Router();
|
||||
|
||||
// contactRoutes.post("/contacts/import", isAuth, ImportPhoneContactsController.store);
|
||||
|
||||
contactRoutes.get("/contacts", isAuth, ContactController.index);
|
||||
|
||||
contactRoutes.get("/contacts/:contactId", isAuth, ContactController.show);
|
||||
|
||||
contactRoutes.post("/contacts", isAuth, ContactController.store);
|
||||
|
||||
contactRoutes.put("/contacts/:contactId", isAuth, ContactController.update);
|
||||
|
||||
contactRoutes.delete("/contacts/:contactId", isAuth, ContactController.remove);
|
||||
|
||||
export default contactRoutes;
|
||||
@@ -3,10 +3,10 @@ import { Router } from "express";
|
||||
import userRoutes from "./userRoutes";
|
||||
import authRoutes from "./authRoutes";
|
||||
import settingRoutes from "./settingRoutes";
|
||||
import contactRoutes from "./contactRoutes";
|
||||
|
||||
// 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");
|
||||
|
||||
@@ -15,9 +15,9 @@ const routes = Router();
|
||||
routes.use(userRoutes);
|
||||
routes.use("/auth", authRoutes);
|
||||
routes.use(settingRoutes);
|
||||
routes.use(contactRoutes);
|
||||
// routes.use(TicketsRoutes);
|
||||
// routes.use(MessagesRoutes);
|
||||
// routes.use(ContactsRoutes);
|
||||
// routes.use(WhatsRoutes);
|
||||
|
||||
export default routes;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
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;
|
||||
@@ -1,21 +0,0 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user