crud test controller and class validator mocker generate classes

This commit is contained in:
IDONTSUDO 2023-12-19 21:10:58 +03:00
parent 6c85616c99
commit 9617d313a1
24 changed files with 242 additions and 108 deletions

View file

@ -3,7 +3,7 @@ import { Result } from "../helpers/result";
import { Router, Request, Response } from "express";
import { IRouteModel, Routes } from "../interfaces/router";
export type Method = "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head";
export type HttpMethodType = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "PATCH" | "HEAD";
export type ResponseBase = Promise<Result<any, any>>;
@ -29,7 +29,7 @@ export abstract class CallbackStrategyWithFileUpload {
}
interface ISubSetFeatureRouter<T> {
method: Method;
method: HttpMethodType;
subUrl: string;
fn:
| CallbackStrategyWithValidationModel<T>
@ -78,7 +78,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
call(): Routes {
if (this.subRoutes.isNotEmpty()) {
this.subRoutes.map((el) => {
this.router[el.method](this.mainURL + "/" + el.subUrl, async (req, res) => {
this.router[el.method.toLowerCase()](this.mainURL + "/" + el.subUrl, async (req, res) => {
if (el.fn instanceof CallbackStrategyWithValidationModel) {
// TODO(IDONTSUDO):
throw Error("needs to be implimed");