first commit
This commit is contained in:
30
src/modules/user/controller/user.controller.ts
Normal file
30
src/modules/user/controller/user.controller.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { NextFunction } from "express";
|
||||
import { ServerResponse } from "../../../core/types";
|
||||
import { Controller } from "../../../core/controller/main.controller";
|
||||
import UserService from "../services/user.service";
|
||||
|
||||
class UserControllerClass extends Controller {
|
||||
#service;
|
||||
constructor() {
|
||||
super();
|
||||
this.#service = UserService;
|
||||
}
|
||||
async getAll(req: any, res: ServerResponse, next: NextFunction) {
|
||||
try {
|
||||
const data = await this.#service.getAll();
|
||||
|
||||
return res.status(200).json({
|
||||
status: 200,
|
||||
data,
|
||||
message: "Ok",
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
next(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const UserController = new UserControllerClass();
|
||||
|
||||
export default UserController;
|
||||
Reference in New Issue
Block a user