mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
More work on converting old Prisma calls to Drizzle
This commit is contained in:
parent
66922faa51
commit
ad0bf1a350
82 changed files with 2580 additions and 5631 deletions
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue