Implement featured note API

This commit is contained in:
syuilo
2018-10-25 07:04:15 +09:00
parent 407467a236
commit 380f5a972c
4 changed files with 65 additions and 8 deletions

View File

@ -22,11 +22,11 @@ Note.createIndex('userId');
Note.createIndex('mentions');
Note.createIndex('visibleUserIds');
Note.createIndex('tagsLower');
Note.createIndex('_user.host');
Note.createIndex('_files._id');
Note.createIndex('_files.contentType');
Note.createIndex({
createdAt: -1
});
Note.createIndex({ createdAt: -1 });
Note.createIndex({ score: -1 }, { sparse: true });
export default Note;
export function isValidText(text: string): boolean {
@ -85,8 +85,14 @@ export type INote = {
heading: number;
speed: number;
};
uri: string;
/**
* 人気の投稿度合いを表すスコア
*/
score: number;
// 非正規化
_reply?: {
userId: mongo.ObjectID;
@ -298,6 +304,7 @@ export const pack = async (
delete _note.prev;
delete _note.next;
delete _note.tagsLower;
delete _note.score;
delete _note._user;
delete _note._reply;
delete _note._renote;