RocketChat/Rocket.Chat

View on GitHub
apps/meteor/app/livechat/server/lib/isDepartmentCreationAvailable.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { LivechatDepartment } from '@rocket.chat/models';
import { makeFunction } from '@rocket.chat/patch-injection';

export const isDepartmentCreationAvailable = makeFunction(async (): Promise<boolean> => {
    // Only one department can exist at a time
    return (await LivechatDepartment.countTotal()) === 0;
});