mizzkey/src/models/emoji.ts

28 lines
467 B
TypeScript
Raw Normal View History

import db from '../db/mongodb';
const Emoji = db.get<IEmoji>('emoji');
2018-11-02 04:08:28 +01:00
Emoji.createIndex('name');
Emoji.createIndex('host');
Emoji.createIndex(['name', 'host'], { unique: true });
export default Emoji;
export type IEmoji = {
name: string;
host: string;
url: string;
aliases?: string[];
updatedAt?: Date;
};
export const packEmojis = async (
host: string,
// MeiTODO: filter
) => {
2018-11-03 07:21:07 +01:00
return await Emoji.find({ host }, {
fields: {
_id: false
}
});
};