refactor(api): 🏷️ Replace API types with those from @lysand-org/client

This commit is contained in:
Jesse Wierzbinski 2024-06-28 20:36:15 -10:00
parent 99b8c35f7b
commit 106e34848a
No known key found for this signature in database
81 changed files with 171 additions and 690 deletions

View file

@ -1,7 +1,7 @@
import type { Application as APIApplication } from "@lysand-org/client/types";
import type { InferSelectModel } from "drizzle-orm";
import { db } from "~/drizzle/db";
import type { Applications } from "~/drizzle/schema";
import type { Application as apiApplication } from "~/types/mastodon/application";
export type Application = InferSelectModel<typeof Applications>;
@ -27,7 +27,7 @@ export const getFromToken = async (
* Converts this application to an API application.
* @returns The API application representation of this application.
*/
export const applicationToApi = (app: Application): apiApplication => {
export const applicationToApi = (app: Application): APIApplication => {
return {
name: app.name,
website: app.website,

View file

@ -1,9 +1,9 @@
import type { Notification as ApiNotification } from "@lysand-org/client/types";
import type { InferSelectModel } from "drizzle-orm";
import { db } from "~/drizzle/db";
import type { Notifications } from "~/drizzle/schema";
import { Note } from "~/packages/database-interface/note";
import { User } from "~/packages/database-interface/user";
import type { Notification as apiNotification } from "~/types/mastodon/notification";
import type { StatusWithRelations } from "./status";
import {
type UserWithRelations,
@ -50,7 +50,7 @@ export const findManyNotifications = async (
export const notificationToApi = async (
notification: NotificationWithRelations,
): Promise<apiNotification> => {
): Promise<ApiNotification> => {
const account = new User(notification.account);
return {
account: account.toApi(),

View file

@ -1,8 +1,8 @@
import type { Relationship as ApiRelationship } from "@lysand-org/client/types";
import type { InferSelectModel } from "drizzle-orm";
import { db } from "~/drizzle/db";
import { Relationships } from "~/drizzle/schema";
import type { User } from "~/packages/database-interface/user";
import type { Relationship as apiRelationship } from "~/types/mastodon/relationship";
export type Relationship = InferSelectModel<typeof Relationships> & {
requestedBy: boolean;
@ -76,7 +76,7 @@ export const checkForBidirectionalRelationships = async (
* Converts the relationship to an API-friendly format.
* @returns The API-friendly relationship.
*/
export const relationshipToApi = (rel: Relationship): apiRelationship => {
export const relationshipToApi = (rel: Relationship): ApiRelationship => {
return {
blocked_by: rel.blockedBy,
blocking: rel.blocking,