const express = require("express") const router = express.Router() const adminService = require("../../services/adminService") router.post("/login", async (req, res) => { const { username, password } = req.body const result = await adminService.loginAdmin(username, password) return res.status(200).json(result) }) router.patch("/password", async (req, res) => { const token = req.headers.authorization.replace("Bearer ", "") const profile = await adminService.getAdminProfileByToken(token) const { newPassword } = req.body const result = await adminService.changeAdminPassword(profile.id, newPassword) return res.status(200).json(result) }) module.exports = router