Commit bc24bfb5 authored by Kim, Subin's avatar Kim, Subin
Browse files

getAll & remove 완성

parent c6dc0753
...@@ -2,8 +2,8 @@ import { TicketFee } from "../db/index.js"; ...@@ -2,8 +2,8 @@ import { TicketFee } from "../db/index.js";
const getAll = async (req, res) => { const getAll = async (req, res) => {
try { try {
const findAll = await TicketFee.findAll() const findAll = await TicketFee.findAll({ attributes: { exclude: ['createdAt', 'updatedAt'] } })
console.log("find==",findAll) return res.json(findAll)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "관람료 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "관람료 정보 가져오는 중 에러 발생")
} }
...@@ -41,8 +41,9 @@ const edit = async (req, res) => { ...@@ -41,8 +41,9 @@ const edit = async (req, res) => {
const remove = async (req, res) => { const remove = async (req, res) => {
try { try {
const { theaterType } = req.query const { theaterType } = req.query
const delTicketFee = await TicketFee.destroy({ where: { theaterType: theaterType } }) const delNum = await TicketFee.destroy({ where: { theaterType: theaterType } })
console.log("del==",delTicketFee) if (delNum) res.json(delNum)
else throw new Error("해당 정보를 서버에서 삭제하는데 실패했습니다.");
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "관람료 정보 삭제 중 에러 발생") return res.status(500).send(error.message || "관람료 정보 삭제 중 에러 발생")
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment