mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
20 lines
540 B
TypeScript
20 lines
540 B
TypeScript
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
import { Like as LysandLike } from "~types/lysand/Object";
|
|
import { getConfig } from "@config";
|
|
import { Like } from "@prisma/client";
|
|
|
|
/**
|
|
* Represents a Like entity in the database.
|
|
*/
|
|
|
|
export const toLysand = (like: Like): LysandLike => {
|
|
return {
|
|
id: like.id,
|
|
author: (like as any).liker?.uri,
|
|
type: "Like",
|
|
created_at: new Date(like.createdAt).toISOString(),
|
|
object: (like as any).liked?.uri,
|
|
uri: `${getConfig().http.base_url}/actions/${like.id}`,
|
|
};
|
|
};
|