post.db.ts 579 Bytes
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
import { Posting, PostingType } from "../models";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { Post, PostType } from "../models";
Lee Soobeom's avatar
Lee Soobeom committed
3
4
5
6
7
8
9
10
11
12
13

export const createPosting = async (posting: PostingType) => {
  const newPosting = await Posting.create({
    title: posting.title,
    text: posting.text,
    theme: posting.theme,
    city: posting.city,
    username: posting.username,
  });
  return newPosting;
};
Lee Soobeom's avatar
Lee Soobeom committed
14
15
16
17
18
19
20
21
22
23

export const createPost = async (post: PostType) => {
  const newPost = await Post.create({
    title: post.title,
    theme: post.theme,
    city: post.city,
    date: post.date,
    counts: post.counts,
  });
};