Newer
Older
taehui / taehui-www / src / systems / commentary.ts
@Taehui Taehui on 6 Nov 874 bytes 2023-11-06 오후 10:13
import { getDatetime } from "taehui-ts/date";

import DB from "src/system/DB";
import { Commentary } from "src/Commentry";

export const getCommentary = async (): Promise<Commentary[]> => {
  return DB.getCommentary();
};

export const postCommentary = async (
  avatarName: string,
  avatarCipher: string,
  avatarIP: string,
  text: string,
) => {
  return (
    text &&
    avatarCipher &&
    DB.postCommentary(avatarName, avatarCipher, avatarIP, getDatetime(), text)
  );
};

export const doModifyCommentary = async (
  commentaryID: number,
  avatarCipher: string,
  text: string,
) => {
  return (
    avatarCipher &&
    text &&
    DB.doModifyCommentary(commentaryID, avatarCipher, text)
  );
};

export const wipeCommentary = async (
  commentaryID: number,
  avatarCipher: string,
) => {
  return avatarCipher && DB.wipeCommentary(commentaryID, avatarCipher);
};