import define from "../../../define.js";
import { Emojis } from "../../../../../models/index.js";
import { In } from "typeorm";
import { db } from "../../../../../db/postgre.js";
export const meta = {
    tags: [
        "admin"
    ],
    requireCredential: true,
    requireModerator: true
};
export const paramDef = {
    type: "object",
    properties: {
        ids: {
            type: "array",
            items: {
                type: "string",
                format: "misskey:id"
            }
        },
        aliases: {
            type: "array",
            items: {
                type: "string"
            }
        }
    },
    required: [
        "ids",
        "aliases"
    ]
};
export default define(meta, paramDef, async (ps)=>{
    const emojis = await Emojis.findBy({
        id: In(ps.ids)
    });
    for (const emoji of emojis){
        await Emojis.update(emoji.id, {
            updatedAt: new Date(),
            aliases: emoji.aliases.filter((x)=>!ps.aliases.includes(x))
        });
    }
    await db.queryResultCache.remove([
        "meta_emojis"
    ]);
});
