mirror of
https://github.com/fergalmoran/opengifame.git
synced 2026-01-03 07:26:03 +00:00
18 lines
448 B
TypeScript
18 lines
448 B
TypeScript
import type { Gif as modelGif } from "@models";
|
|
import { Gif } from "@prisma/client";
|
|
|
|
export const mapGif = (
|
|
gif: Gif & { _count: { upVotes: number; downVotes: number } }
|
|
): modelGif => {
|
|
return {
|
|
id: gif.id,
|
|
title: gif.title,
|
|
description: gif.description,
|
|
fileName: gif.fileName,
|
|
dateCreated: gif.createdAt.toISOString(),
|
|
upVotes: gif._count.upVotes,
|
|
downVotes: gif._count.downVotes,
|
|
hasVoted: false,
|
|
};
|
|
};
|