post.controller.ts 541 Bytes
Newer Older
Kim, MinGyu's avatar
Kim, MinGyu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { postDb } from "../db";
import { asyncWrap } from "../helpers/asyncWrap";

export const postup = asyncWrap(async (req, res) => {
    const {id, title, date,body , theme, city }=req.body;

    if (theme == "테마") {
        return res.status(422).send("테마를 선택해주십시요.");
    }else if(city =="도시"){
        return res.status(422).send("도시를 선택해주십시요.");
    }
    const newPost = await postDb.createPost({
        id, title, date, body,theme, city
      });
      
      res.json(newPost);

})