mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(api): 🏷️ Replace API types with those from @lysand-org/client
This commit is contained in:
parent
99b8c35f7b
commit
106e34848a
81 changed files with 171 additions and 690 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue