summaryrefslogtreecommitdiff
path: root/src/api/models/user.ts
blob: 1742f5cafb04522d019190b23aad3b5ccec90de7 (plain)
1
2
3
4
5
6
7
8
9
10
const collection = global.db.collection('users');

collection.createIndex('username');
collection.createIndex('token');

export default collection;

export function validateUsername(username: string): boolean {
	return /^[a-zA-Z0-9\-]{3,20}$/.test(username);
}