refactor: 🚚 Rename functions, move getUrl to Attachment

This commit is contained in:
Jesse Wierzbinski 2024-06-28 17:50:56 -10:00
parent 11c3931007
commit d09f74e58a
No known key found for this signature in database
60 changed files with 93 additions and 96 deletions

View file

@ -3,9 +3,9 @@ import chalk from "chalk";
import { and, eq, isNull } from "drizzle-orm";
import ora from "ora";
import { BaseCommand } from "~/cli/base";
import { getUrl } from "~/database/entities/attachment";
import { Emojis } from "~/drizzle/schema";
import { config } from "~/packages/config-manager";
import { Attachment } from "~/packages/database-interface/attachment";
import { Emoji } from "~/packages/database-interface/emoji";
import { MediaBackend } from "~/packages/media-manager";
@ -118,7 +118,7 @@ export default class EmojiAdd extends BaseCommand<typeof EmojiAdd> {
await Emoji.insert({
shortcode: args.shortcode,
url: getUrl(uploaded.path, config),
url: Attachment.getUrl(uploaded.path),
visibleInPicker: true,
contentType: uploaded.uploadedFile.type,
});
@ -127,7 +127,7 @@ export default class EmojiAdd extends BaseCommand<typeof EmojiAdd> {
`${chalk.green("✓")} Created emoji ${chalk.green(
args.shortcode,
)} with url ${chalk.blue(
chalk.underline(getUrl(uploaded.path, config)),
chalk.underline(Attachment.getUrl(uploaded.path)),
)}`,
);

View file

@ -5,9 +5,9 @@ import { lookup } from "mime-types";
import ora from "ora";
import { unzip } from "unzipit";
import { BaseCommand } from "~/cli/base";
import { getUrl } from "~/database/entities/attachment";
import { Emojis } from "~/drizzle/schema";
import { config } from "~/packages/config-manager";
import { Attachment } from "~/packages/database-interface/attachment";
import { Emoji } from "~/packages/database-interface/emoji";
import { MediaBackend } from "~/packages/media-manager";
@ -215,7 +215,7 @@ export default class EmojiImport extends BaseCommand<typeof EmojiImport> {
await Emoji.insert({
shortcode: emoji.emoji.name,
url: getUrl(uploaded.path, config),
url: Attachment.getUrl(uploaded.path),
visibleInPicker: true,
contentType: uploaded.uploadedFile.type,
});