Add type definition
This commit is contained in:
parent
bc23ec0a95
commit
3feeaccf59
4 changed files with 57 additions and 4 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue