More work on converting old Prisma calls to Drizzle

This commit is contained in:
Jesse Wierzbinski 2024-04-13 02:20:12 -10:00
parent 66922faa51
commit ad0bf1a350
No known key found for this signature in database
82 changed files with 2580 additions and 5631 deletions

View file

@ -1,11 +1,11 @@
import type { Config } from "config-manager";
import { MediaBackendType } from "media-manager";
import type { APIAsyncAttachment } from "~types/entities/async_attachment";
import type { APIAttachment } from "~types/entities/attachment";
import type { InferSelectModel } from "drizzle-orm";
import type * as Lysand from "lysand-types";
import { MediaBackendType } from "media-manager";
import { db } from "~drizzle/db";
import { attachment } from "~drizzle/schema";
import type { InferSelectModel } from "drizzle-orm";
import type { APIAsyncAttachment } from "~types/entities/async_attachment";
import type { APIAttachment } from "~types/entities/attachment";
export type Attachment = InferSelectModel<typeof attachment>;

View file

@ -1,9 +1,9 @@
import type { APIEmoji } from "~types/entities/emoji";
import { type InferSelectModel, and, eq } from "drizzle-orm";
import type * as Lysand from "lysand-types";
import { addInstanceIfNotExists } from "./Instance";
import { db } from "~drizzle/db";
import { emoji, instance } from "~drizzle/schema";
import { and, eq, type InferSelectModel } from "drizzle-orm";
import type { APIEmoji } from "~types/entities/emoji";
import { addInstanceIfNotExists } from "./Instance";
export type EmojiWithInstance = InferSelectModel<typeof emoji> & {
instance: InferSelectModel<typeof instance> | null;

View file

@ -1,6 +1,6 @@
import type * as Lysand from "lysand-types";
import { config } from "config-manager";
import { getUserUri, type User } from "./User";
import type * as Lysand from "lysand-types";
import { type User, getUserUri } from "./User";
export const objectToInboxRequest = async (
object: Lysand.Entity,

View file

@ -1,5 +1,5 @@
import { db } from "~drizzle/db";
import type * as Lysand from "lysand-types";
import { db } from "~drizzle/db";
import { instance } from "~drizzle/schema";
/**

View file

@ -1,10 +1,10 @@
import { config } from "config-manager";
import { type InferSelectModel, and, eq } from "drizzle-orm";
import type * as Lysand from "lysand-types";
import { db } from "~drizzle/db";
import { like, notification } from "~drizzle/schema";
import type { StatusWithRelations } from "./Status";
import type { UserWithRelations } from "./User";
import type * as Lysand from "lysand-types";
import { and, eq, type InferSelectModel } from "drizzle-orm";
import { notification, like } from "~drizzle/schema";
import { db } from "~drizzle/db";
export type Like = InferSelectModel<typeof like>;

View file

@ -1,19 +1,19 @@
import type { InferSelectModel } from "drizzle-orm";
import { db } from "~drizzle/db";
import type { notification } from "~drizzle/schema";
import type { APINotification } from "~types/entities/notification";
import {
type StatusWithRelations,
statusToAPI,
findFirstStatuses,
statusToAPI,
} from "./Status";
import {
type UserWithRelations,
userToAPI,
userRelations,
userExtrasTemplate,
transformOutputToUserWithRelations,
userExtrasTemplate,
userRelations,
userToAPI,
} from "./User";
import type { InferSelectModel } from "drizzle-orm";
import type { notification } from "~drizzle/schema";
import { db } from "~drizzle/db";
export type Notification = InferSelectModel<typeof notification>;

View file

@ -1,8 +1,8 @@
import type { InferSelectModel } from "drizzle-orm";
import type * as Lysand from "lysand-types";
import { db } from "~drizzle/db";
import { lysandObject } from "~drizzle/schema";
import { findFirstUser } from "./User";
import type * as Lysand from "lysand-types";
export type LysandObject = InferSelectModel<typeof lysandObject>;

View file

@ -1,9 +1,8 @@
import { client } from "~database/datasource";
import type { InferSelectModel } from "drizzle-orm";
import { db } from "~drizzle/db";
import { relationship } from "~drizzle/schema";
import type { APIRelationship } from "~types/entities/relationship";
import type { User } from "./User";
import type { InferSelectModel } from "drizzle-orm";
import { relationship } from "~drizzle/schema";
import { db } from "~drizzle/db";
export type Relationship = InferSelectModel<typeof relationship>;

View file

@ -1,13 +1,34 @@
import { sanitizeHtml } from "@sanitization";
import { config } from "config-manager";
import {
type InferSelectModel,
and,
eq,
inArray,
isNotNull,
isNull,
or,
sql,
} from "drizzle-orm";
import { htmlToText } from "html-to-text";
import linkifyHtml from "linkify-html";
import linkifyStr from "linkify-string";
import type * as Lysand from "lysand-types";
import { parse } from "marked";
import { db } from "~drizzle/db";
import {
type application,
attachment,
emojiToStatus,
instance,
type like,
status,
statusToUser,
user,
} from "~drizzle/schema";
import type { APIAttachment } from "~types/entities/attachment";
import type { APIStatus } from "~types/entities/status";
import type { Note } from "~types/lysand/Object";
import type * as Lysand from "lysand-types";
import { applicationToAPI } from "./Application";
import {
attachmentFromLysand,
@ -15,48 +36,27 @@ import {
attachmentToLysand,
} from "./Attachment";
import {
type EmojiWithInstance,
emojiToAPI,
emojiToLysand,
fetchEmoji,
parseEmojis,
type EmojiWithInstance,
} from "./Emoji";
import { objectToInboxRequest } from "./Federation";
import {
getUserUri,
resolveUser,
resolveWebFinger,
userToAPI,
userExtras,
userRelations,
userExtrasTemplate,
type User,
type UserWithRelations,
type UserWithRelationsAndRelationships,
transformOutputToUserWithRelations,
findManyUsers,
getUserUri,
resolveUser,
resolveWebFinger,
transformOutputToUserWithRelations,
userExtras,
userExtrasTemplate,
userRelations,
userToAPI,
} from "./User";
import { objectToInboxRequest } from "./Federation";
import {
and,
eq,
or,
type InferSelectModel,
sql,
isNotNull,
inArray,
isNull,
} from "drizzle-orm";
import {
status,
type application,
attachment,
type like,
user,
statusToUser,
emojiToStatus,
instance,
} from "~drizzle/schema";
import { db } from "~drizzle/db";
export type Status = InferSelectModel<typeof status>;

View file

@ -1,20 +1,10 @@
import { getBestContentType, urlToContentFormat } from "@content_types";
import { addUserToMeilisearch } from "@meilisearch";
import { type Config, config } from "config-manager";
import { type InferSelectModel, and, eq, sql } from "drizzle-orm";
import { htmlToText } from "html-to-text";
import type { APIAccount } from "~types/entities/account";
import type { APISource } from "~types/entities/source";
import type * as Lysand from "lysand-types";
import {
fetchEmoji,
emojiToAPI,
emojiToLysand,
type EmojiWithInstance,
} from "./Emoji";
import { addInstanceIfNotExists } from "./Instance";
import { createNewRelationship } from "./Relationship";
import { getBestContentType, urlToContentFormat } from "@content_types";
import { objectToInboxRequest } from "./Federation";
import { and, eq, sql, type InferSelectModel } from "drizzle-orm";
import { db } from "~drizzle/db";
import {
emojiToUser,
instance,
@ -22,7 +12,17 @@ import {
relationship,
user,
} from "~drizzle/schema";
import { db } from "~drizzle/db";
import type { APIAccount } from "~types/entities/account";
import type { APISource } from "~types/entities/source";
import {
type EmojiWithInstance,
emojiToAPI,
emojiToLysand,
fetchEmoji,
} from "./Emoji";
import { objectToInboxRequest } from "./Federation";
import { addInstanceIfNotExists } from "./Instance";
import { createNewRelationship } from "./Relationship";
export type User = InferSelectModel<typeof user> & {
endpoints?: Partial<{