From 3feeaccf5955ebf17c26ccc06f32bb39624b89f6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Sep 2017 04:13:01 +0900 Subject: Add type definition --- src/api/models/post.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/api/models/post.ts') diff --git a/src/api/models/post.ts b/src/api/models/post.ts index baab63f991..8b9f7f5ef6 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -1,3 +1,5 @@ +import * as mongo from 'mongodb'; + import db from '../../db/mongodb'; export default db.get('posts') as any; // fuck type definition @@ -5,3 +7,15 @@ export default db.get('posts') as any; // fuck type definition export function isValidText(text: string): boolean { return text.length <= 1000 && text.trim() != ''; } + +export type IPost = { + _id: mongo.ObjectID; + created_at: Date; + media_ids: mongo.ObjectID[]; + reply_to_id: mongo.ObjectID; + repost_id: mongo.ObjectID; + poll: {}; // todo + text: string; + user_id: mongo.ObjectID; + app_id: mongo.ObjectID; +}; -- cgit v1.2.3-freya