summaryrefslogtreecommitdiff
path: root/src/api/models/app.ts
blob: 68f2f448b05a323260f3fce7fdb21b880becd54a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import db from '../../db/mongodb';

const collection = db.get('apps');

(collection as any).createIndex('name_id'); // fuck type definition
(collection as any).createIndex('name_id_lower'); // fuck type definition
(collection as any).createIndex('secret'); // fuck type definition

export default collection as any; // fuck type definition

export function isValidNameId(nameId: string): boolean {
	return typeof nameId == 'string' && /^[a-zA-Z0-9\-]{3,30}$/.test(nameId);
}