setup and invite
This commit is contained in:
parent
03e0f90279
commit
7df7cf2697
23 changed files with 515 additions and 43 deletions
12
src/middleware/allowSetup.ts
Normal file
12
src/middleware/allowSetup.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue