2018-11-03 19:18:32 +01:00
|
|
|
import $ from 'cafy';
|
|
|
|
import define from '../../../define';
|
2019-04-07 14:50:36 +02:00
|
|
|
import { Emojis } from '../../../../../models';
|
2020-01-29 20:37:25 +01:00
|
|
|
import { makePaginationQuery } from '../../../common/make-pagination-query';
|
|
|
|
import { ID } from '../../../../../misc/cafy-id';
|
2018-11-03 19:18:32 +01:00
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
desc: {
|
|
|
|
'ja-JP': 'カスタム絵文字を取得します。'
|
|
|
|
},
|
|
|
|
|
2019-02-23 03:20:58 +01:00
|
|
|
tags: ['admin'],
|
|
|
|
|
2020-02-15 13:33:32 +01:00
|
|
|
requireCredential: true as const,
|
2018-11-14 20:15:42 +01:00
|
|
|
requireModerator: true,
|
2018-11-03 19:18:32 +01:00
|
|
|
|
|
|
|
params: {
|
2020-01-29 20:37:25 +01:00
|
|
|
limit: {
|
|
|
|
validator: $.optional.num.range(1, 100),
|
|
|
|
default: 10
|
|
|
|
},
|
|
|
|
|
|
|
|
sinceId: {
|
|
|
|
validator: $.optional.type(ID),
|
|
|
|
},
|
|
|
|
|
|
|
|
untilId: {
|
|
|
|
validator: $.optional.type(ID),
|
2018-11-03 19:18:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
export default define(meta, async (ps) => {
|
2020-01-29 20:37:25 +01:00
|
|
|
const emojis = await makePaginationQuery(Emojis.createQueryBuilder('emoji'), ps.sinceId, ps.untilId)
|
|
|
|
.andWhere(`emoji.host IS NULL`)
|
|
|
|
.take(ps.limit!)
|
|
|
|
.getMany();
|
2018-11-03 19:18:32 +01:00
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
return emojis.map(e => ({
|
2019-04-07 14:50:36 +02:00
|
|
|
id: e.id,
|
2018-11-03 19:18:32 +01:00
|
|
|
name: e.name,
|
2019-10-20 17:43:39 +02:00
|
|
|
category: e.category,
|
2018-11-03 19:18:32 +01:00
|
|
|
aliases: e.aliases,
|
|
|
|
host: e.host,
|
|
|
|
url: e.url
|
2019-02-22 03:46:58 +01:00
|
|
|
}));
|
|
|
|
});
|