diff --git a/server/controllers/base.ts b/server/controllers/base.ts index 66a99f4c..e444e803 100644 --- a/server/controllers/base.ts +++ b/server/controllers/base.ts @@ -1,9 +1,9 @@ import { Request, Response } from 'express'; +import { Model } from 'mongoose'; -abstract class BaseCtrl { +abstract class BaseCtrl { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - abstract model: any; + abstract model:Model // Get all getAll = async (req: Request, res: Response) => { diff --git a/server/controllers/cat.ts b/server/controllers/cat.ts index 53240382..46e405af 100644 --- a/server/controllers/cat.ts +++ b/server/controllers/cat.ts @@ -1,7 +1,7 @@ -import Cat from '../models/cat'; +import Cat, { ICat } from '../models/cat'; import BaseCtrl from './base'; -class CatCtrl extends BaseCtrl { +class CatCtrl extends BaseCtrl { model = Cat; } diff --git a/server/controllers/user.ts b/server/controllers/user.ts index 99bc0acc..287607c7 100644 --- a/server/controllers/user.ts +++ b/server/controllers/user.ts @@ -1,12 +1,12 @@ import { sign, Secret } from 'jsonwebtoken'; import { Request, Response } from 'express'; -import User from '../models/user'; +import User, { IUser } from '../models/user'; import BaseCtrl from './base'; const secret: Secret = process.env.SECRET_TOKEN as string; -class UserCtrl extends BaseCtrl { +class UserCtrl extends BaseCtrl { model = User; login = async (req: Request, res: Response) => {