oauth.db.ts 535 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
2
3
4
5
6
7
8
9
10
11
12
import { Oauth, IOauth } from "../models";

export const createSocialKey = async (socialKeys: IOauth) => {
  const newOauth = new Oauth({
    socialType: socialKeys.socialType,
    REST_API_KEY: socialKeys.REST_API_KEY,
    REDIRECT_URI: socialKeys.REDIRECT_URI,
    CLIENT_SECRET_KEY: socialKeys.CLIENT_SECRET_KEY,
  });
  const oauth = await newOauth.save();
  return oauth;
};
Jiwon Yoon's avatar
Jiwon Yoon committed
13
14
15
16
17

export const getSocialKey = async (socialType: string) => {
  const socialKeys = await Oauth.findOne({ socialType: socialType });
  return socialKeys;
};