diff options
| author | こぴなたみぽ <Syuilotan@yahoo.co.jp> | 2017-11-06 19:14:04 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-06 19:14:04 +0900 |
| commit | 9b7edcefb991f9c463b330cc7f87d99f9a357196 (patch) | |
| tree | 0f4451044edf5d265e84adfc13c4c3f013ffb007 /src/api/models | |
| parent | chore(package): update @types/body-parser to version 1.16.7 (diff) | |
| parent | Merge pull request #875 from syuilo/greenkeeper/@types/gulp-util-3.0.33 (diff) | |
| download | misskey-9b7edcefb991f9c463b330cc7f87d99f9a357196.tar.gz misskey-9b7edcefb991f9c463b330cc7f87d99f9a357196.tar.bz2 misskey-9b7edcefb991f9c463b330cc7f87d99f9a357196.zip | |
Merge branch 'master' into greenkeeper/@types/body-parser-1.16.7
Diffstat (limited to 'src/api/models')
| -rw-r--r-- | src/api/models/channel-watching.ts | 3 | ||||
| -rw-r--r-- | src/api/models/channel.ts | 14 | ||||
| -rw-r--r-- | src/api/models/drive-file.ts | 15 | ||||
| -rw-r--r-- | src/api/models/notification.ts | 5 | ||||
| -rw-r--r-- | src/api/models/post.ts | 3 |
5 files changed, 37 insertions, 3 deletions
diff --git a/src/api/models/channel-watching.ts b/src/api/models/channel-watching.ts new file mode 100644 index 0000000000..6184ae408d --- /dev/null +++ b/src/api/models/channel-watching.ts @@ -0,0 +1,3 @@ +import db from '../../db/mongodb'; + +export default db.get('channel_watching') as any; // fuck type definition diff --git a/src/api/models/channel.ts b/src/api/models/channel.ts new file mode 100644 index 0000000000..c80e84dbc8 --- /dev/null +++ b/src/api/models/channel.ts @@ -0,0 +1,14 @@ +import * as mongo from 'mongodb'; +import db from '../../db/mongodb'; + +const collection = db.get('channels'); + +export default collection as any; // fuck type definition + +export type IChannel = { + _id: mongo.ObjectID; + created_at: Date; + title: string; + user_id: mongo.ObjectID; + index: number; +}; diff --git a/src/api/models/drive-file.ts b/src/api/models/drive-file.ts index 8d158cf563..8968d065cd 100644 --- a/src/api/models/drive-file.ts +++ b/src/api/models/drive-file.ts @@ -1,11 +1,22 @@ -import db from '../../db/mongodb'; +import * as mongodb from 'mongodb'; +import monkDb, { nativeDbConn } from '../../db/mongodb'; -const collection = db.get('drive_files'); +const collection = monkDb.get('drive_files.files'); (collection as any).createIndex('hash'); // fuck type definition export default collection as any; // fuck type definition +const getGridFSBucket = async (): Promise<mongodb.GridFSBucket> => { + const db = await nativeDbConn(); + const bucket = new mongodb.GridFSBucket(db, { + bucketName: 'drive_files' + }); + return bucket; +}; + +export { getGridFSBucket }; + export function validateFileName(name: string): boolean { return ( (name.trim().length > 0) && diff --git a/src/api/models/notification.ts b/src/api/models/notification.ts index 1c1f429a0d..1065e8baaa 100644 --- a/src/api/models/notification.ts +++ b/src/api/models/notification.ts @@ -1,3 +1,8 @@ +import * as mongo from 'mongodb'; import db from '../../db/mongodb'; export default db.get('notifications') as any; // fuck type definition + +export interface INotification { + _id: mongo.ObjectID; +} diff --git a/src/api/models/post.ts b/src/api/models/post.ts index 8b9f7f5ef6..7584ce182d 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -10,9 +10,10 @@ export function isValidText(text: string): boolean { export type IPost = { _id: mongo.ObjectID; + channel_id: mongo.ObjectID; created_at: Date; media_ids: mongo.ObjectID[]; - reply_to_id: mongo.ObjectID; + reply_id: mongo.ObjectID; repost_id: mongo.ObjectID; poll: {}; // todo text: string; |