summaryrefslogtreecommitdiff
path: root/src/api/models
diff options
context:
space:
mode:
authorこぴなたみぽ <Syuilotan@yahoo.co.jp>2017-11-06 19:13:36 +0900
committerGitHub <noreply@github.com>2017-11-06 19:13:36 +0900
commitee99afd5a1d67e3d72a582062a92a234a094651a (patch)
treedfe5c593103097b3675477ed81eb4e669b8102cb /src/api/models
parentchore(package): update @types/gulp-util to version 3.0.33 (diff)
parentMerge pull request #842 from syuilo/greenkeeper/gulp-typescript-3.2.3 (diff)
downloadmisskey-ee99afd5a1d67e3d72a582062a92a234a094651a.tar.gz
misskey-ee99afd5a1d67e3d72a582062a92a234a094651a.tar.bz2
misskey-ee99afd5a1d67e3d72a582062a92a234a094651a.zip
Merge branch 'master' into greenkeeper/@types/gulp-util-3.0.33
Diffstat (limited to 'src/api/models')
-rw-r--r--src/api/models/channel-watching.ts3
-rw-r--r--src/api/models/channel.ts14
-rw-r--r--src/api/models/drive-file.ts15
-rw-r--r--src/api/models/notification.ts5
-rw-r--r--src/api/models/post.ts3
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;