summaryrefslogtreecommitdiff
path: root/src/api/models/post.ts
blob: 7584ce182d8238c4d6c15c9a3e76fa4f6d2f1726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as mongo from 'mongodb';

import db from '../../db/mongodb';

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;
	channel_id: mongo.ObjectID;
	created_at: Date;
	media_ids: mongo.ObjectID[];
	reply_id: mongo.ObjectID;
	repost_id: mongo.ObjectID;
	poll: {}; // todo
	text: string;
	user_id: mongo.ObjectID;
	app_id: mongo.ObjectID;
};