12 lines
409 B
TypeScript
12 lines
409 B
TypeScript
import { Request, Response } from "express";
|
|
import UserService from "../service/userService";
|
|
import CustomRequestException from "../exceptions/customRequestException";
|
|
|
|
export default async function allowSetup(req: Request, res: Response, next: Function) {
|
|
let count = await UserService.count();
|
|
if (count != 0) {
|
|
throw new CustomRequestException(405, "service is already set up");
|
|
}
|
|
|
|
next();
|
|
}
|