From bca9c54923774c06c9ebd28aea5d0764f878d891 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 26 May 2023 07:20:14 +0000 Subject: [PATCH] wip --- .../endpoints/admin/emoji/set-license-bulk.ts | 27 +++---------------- packages/misskey-js/src/endpoints.ts | 23 ++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts index b90b9757be..434f38f722 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts @@ -2,35 +2,14 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { CustomEmojiService } from '@/core/CustomEmojiService.js'; -export const meta = { - tags: ['admin'], - - requireCredential: true, - requireRolePolicy: 'canManageCustomEmojis', -} as const; - -export const paramDef = { - type: 'object', - properties: { - ids: { type: 'array', items: { - type: 'string', format: 'misskey:id', - } }, - license: { - type: 'string', - nullable: true, - description: 'Use `null` to reset the license.', - }, - }, - required: ['ids'], -} as const; - // eslint-disable-next-line import/no-default-export @Injectable() -export default class extends Endpoint { +export default class extends Endpoint<'admin/emoji/set-license-bulk'> { + name = 'admin/emoji/set-license-bulk' as const; constructor( private customEmojiService: CustomEmojiService, ) { - super(meta, paramDef, async (ps, me) => { + super(async (ps, me) => { await this.customEmojiService.setLicenseBulk(ps.ids, ps.license ?? null); }); } diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index 1bb1d0aee1..be495f7c12 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -725,6 +725,29 @@ export const endpoints = { res: undefined, }], }, + 'admin/emoji/set-license-bulk': { + tags: ['admin'], + + requireCredential: true, + requireRolePolicy: 'canManageCustomEmojis', + + defines: [{ + req: { + type: 'object', + properties: { + ids: { type: 'array', items: { + type: 'string', format: 'misskey:id', + } }, + license: { + type: ['string', 'null'], + description: 'Use `null` to reset the license.', + }, + }, + required: ['ids'], + }, + res: undefined, + }], + }, } as const satisfies { [x: string]: IEndpointMeta; }; export function getEndpointSchema(reqres: 'req' | 'res', key: keyof typeof endpoints) {