diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index f10a8adb2c..c4f5dc5810 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -131,7 +131,7 @@ import * as ep___drive_folders_show from "./endpoints/drive/folders/show.js"; import * as ep___drive_folders_update from "./endpoints/drive/folders/update.js"; import * as ep___drive_stream from "./endpoints/drive/stream.js"; import * as ep___emailAddress_available from "./endpoints/email-address/available.js"; -import * as ep___emoji from './endpoints/emoji.js'; +import * as ep___emoji from "./endpoints/emoji.js"; import * as ep___endpoint from "./endpoints/endpoint.js"; import * as ep___endpoints from "./endpoints/endpoints.js"; import * as ep___exportCustomEmojis from "./endpoints/export-custom-emojis.js"; @@ -472,7 +472,7 @@ const eps = [ ["drive/folders/update", ep___drive_folders_update], ["drive/stream", ep___drive_stream], ["email-address/available", ep___emailAddress_available], - ['emoji', ep___emoji], + ["emoji", ep___emoji], ["endpoint", ep___endpoint], ["endpoints", ep___endpoints], ["export-custom-emojis", ep___exportCustomEmojis], diff --git a/packages/backend/src/server/api/endpoints/emoji.ts b/packages/backend/src/server/api/endpoints/emoji.ts index 681d3e649e..2ea0dd31a3 100644 --- a/packages/backend/src/server/api/endpoints/emoji.ts +++ b/packages/backend/src/server/api/endpoints/emoji.ts @@ -1,56 +1,39 @@ -import { IsNull } from 'typeorm'; -import { Inject, Injectable } from '@nestjs/common'; -import type { EmojisRepository } from '@/models/index.js'; -import { Endpoint } from '@/server/api/endpoint-base.js'; -import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js'; -import type { Config } from '@/config.js'; -import { DI } from '@/di-symbols.js'; +import { IsNull } from "typeorm"; +import { Emoji } from "@/models/entities/emoji.js"; +import { Emojis } from "@/models/index.js"; +import define from "../define.js"; export const meta = { - tags: ['meta'], + tags: ["meta"], requireCredential: false, allowGet: true, cacheSec: 3600, res: { - type: 'object', + type: "object", optional: false, nullable: false, - ref: 'EmojiDetailed', + ref: "Emoji", }, } as const; export const paramDef = { - type: 'object', + type: "object", properties: { name: { - type: 'string', + type: "string", }, }, - required: ['name'], + required: ["name"], } as const; -// eslint-disable-next-line import/no-default-export -@Injectable() -export default class extends Endpoint { - constructor( - @Inject(DI.config) - private config: Config, - - @Inject(DI.emojisRepository) - private emojisRepository: EmojisRepository, +export default define(meta, paramDef, async (ps, me) => { + const emoji = await Emojis.findOneOrFail({ + where: { + name: ps.name, + host: IsNull(), + }, + }); - private emojiEntityService: EmojiEntityService, - ) { - super(meta, paramDef, async (ps, me) => { - const emoji = await this.emojisRepository.findOneOrFail({ - where: { - name: ps.name, - host: IsNull(), - }, - }); - - return this.emojiEntityService.packDetailed(emoji); - }); - } -} + return Emojis.pack(emoji); +}); diff --git a/packages/client/src/pages/emojis.emoji.vue b/packages/client/src/pages/emojis.emoji.vue index 705064e565..c106fb2004 100644 --- a/packages/client/src/pages/emojis.emoji.vue +++ b/packages/client/src/pages/emojis.emoji.vue @@ -3,16 +3,16 @@
{{ emoji.name }}
-
{{ emoji.aliases.join(' ') }}
+
{{ emoji.aliases.join(" ") }}