mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-28 11:33:08 +02:00
6909add1ec
Resolve #3935 Closes #2226 Closes #1946
27 lines
587 B
TypeScript
27 lines
587 B
TypeScript
import * as mongo from 'mongodb';
|
|
import db from '../db/mongodb';
|
|
|
|
const Following = db.get<IFollowing>('following');
|
|
Following.createIndex('followerId');
|
|
Following.createIndex('followeeId');
|
|
Following.createIndex(['followerId', 'followeeId'], { unique: true });
|
|
export default Following;
|
|
|
|
export type IFollowing = {
|
|
_id: mongo.ObjectID;
|
|
createdAt: Date;
|
|
followeeId: mongo.ObjectID;
|
|
followerId: mongo.ObjectID;
|
|
|
|
// 非正規化
|
|
_followee: {
|
|
host: string;
|
|
inbox?: string;
|
|
sharedInbox?: string;
|
|
},
|
|
_follower: {
|
|
host: string;
|
|
inbox?: string;
|
|
sharedInbox?: string;
|
|
}
|
|
};
|