|  | 
|  | 1 | +from typing import Any | 
| 1 | 2 | from fastapi.routing import APIRouter | 
| 2 |  | -from nest.core.decorators.helpers import class_based_view as ClassBasedView | 
|  | 3 | +from nest.core.decorators.helpers import ( | 
|  | 4 | +    class_based_view as ClassBasedView, | 
|  | 5 | +    route_decorator, | 
|  | 6 | +) | 
| 3 | 7 | 
 | 
| 4 | 8 | 
 | 
| 5 | 9 | def Controller(tag: str = None, prefix: str = None): | 
| @@ -58,113 +62,3 @@ def get_router() -> APIRouter: | 
| 58 | 62 |         return ClassBasedView(router=router, cls=cls) | 
| 59 | 63 | 
 | 
| 60 | 64 |     return wrapper | 
| 61 |  | - | 
| 62 |  | - | 
| 63 |  | -def Get(path: str, **kwargs): | 
| 64 |  | -    """ | 
| 65 |  | -    Decorator that defines a GET route for the controller. | 
| 66 |  | -
 | 
| 67 |  | -    Args: | 
| 68 |  | -        path (str): The URL path for the route. | 
| 69 |  | -        **kwargs: Additional keyword arguments to configure the route. | 
| 70 |  | -
 | 
| 71 |  | -    Returns: | 
| 72 |  | -        function: The decorated function. | 
| 73 |  | -
 | 
| 74 |  | -    """ | 
| 75 |  | - | 
| 76 |  | -    def decorator(func): | 
| 77 |  | -        func.method = "GET" | 
| 78 |  | -        func.__path__ = path | 
| 79 |  | -        func.__kwargs__ = kwargs | 
| 80 |  | -        return func | 
| 81 |  | - | 
| 82 |  | -    return decorator | 
| 83 |  | - | 
| 84 |  | - | 
| 85 |  | -def Post(path: str, **kwargs): | 
| 86 |  | -    """ | 
| 87 |  | -    Decorator that defines a POST route for the controller. | 
| 88 |  | -
 | 
| 89 |  | -    Args: | 
| 90 |  | -        path (str): The URL path for the route. | 
| 91 |  | -        **kwargs: Additional keyword arguments to configure the route. | 
| 92 |  | -
 | 
| 93 |  | -    Returns: | 
| 94 |  | -        function: The decorated function. | 
| 95 |  | -
 | 
| 96 |  | -    """ | 
| 97 |  | - | 
| 98 |  | -    def decorator(func): | 
| 99 |  | -        func.method = "POST" | 
| 100 |  | -        func.__path__ = path | 
| 101 |  | -        func.__kwargs__ = kwargs | 
| 102 |  | -        return func | 
| 103 |  | - | 
| 104 |  | -    return decorator | 
| 105 |  | - | 
| 106 |  | - | 
| 107 |  | -def Delete(path: str, **kwargs): | 
| 108 |  | -    """ | 
| 109 |  | -    Decorator that defines a DELETE route for the controller. | 
| 110 |  | -
 | 
| 111 |  | -    Args: | 
| 112 |  | -        path (str): The URL path for the route. | 
| 113 |  | -        **kwargs: Additional keyword arguments to configure the route. | 
| 114 |  | -
 | 
| 115 |  | -    Returns: | 
| 116 |  | -        function: The decorated function. | 
| 117 |  | -
 | 
| 118 |  | -    """ | 
| 119 |  | - | 
| 120 |  | -    def decorator(func): | 
| 121 |  | -        func.method = "DELETE" | 
| 122 |  | -        func.__path__ = path | 
| 123 |  | -        func.__kwargs__ = kwargs | 
| 124 |  | -        return func | 
| 125 |  | - | 
| 126 |  | -    return decorator | 
| 127 |  | - | 
| 128 |  | - | 
| 129 |  | -def Put(path: str, **kwargs): | 
| 130 |  | -    """ | 
| 131 |  | -    Decorator that defines a PUT route for the controller. | 
| 132 |  | -
 | 
| 133 |  | -    Args: | 
| 134 |  | -        path (str): The URL path for the route. | 
| 135 |  | -        **kwargs: Additional keyword arguments to configure the route. | 
| 136 |  | -
 | 
| 137 |  | -    Returns: | 
| 138 |  | -        function: The decorated function. | 
| 139 |  | -
 | 
| 140 |  | -    """ | 
| 141 |  | - | 
| 142 |  | -    def decorator(func): | 
| 143 |  | -        func.method = "PUT" | 
| 144 |  | -        func.__path__ = path | 
| 145 |  | -        func.__kwargs__ = kwargs | 
| 146 |  | -        return func | 
| 147 |  | - | 
| 148 |  | -    return decorator | 
| 149 |  | - | 
| 150 |  | - | 
| 151 |  | -def Patch(path: str, **kwargs): | 
| 152 |  | -    """ | 
| 153 |  | -    Decorator that defines a PATCH route for the controller. | 
| 154 |  | -
 | 
| 155 |  | -    Args: | 
| 156 |  | -        path (str): The URL path for the route. | 
| 157 |  | -        **kwargs: Additional keyword arguments to configure the route. | 
| 158 |  | -
 | 
| 159 |  | -    Returns: | 
| 160 |  | -        function: The decorated function. | 
| 161 |  | -
 | 
| 162 |  | -    """ | 
| 163 |  | - | 
| 164 |  | -    def decorator(func): | 
| 165 |  | -        func.method = "PATCH" | 
| 166 |  | -        func.__path__ = path | 
| 167 |  | -        func.__kwargs__ = kwargs | 
| 168 |  | -        return func | 
| 169 |  | - | 
| 170 |  | -    return decorator | 
0 commit comments