Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core,common,platform-fastify): add webdav http methods support #13278

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
63 changes: 63 additions & 0 deletions packages/common/decorators/http/request-mapping.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,66 @@ export const All = createMappingDecorator(RequestMethod.ALL);
* @publicApi
*/
export const Search = createMappingDecorator(RequestMethod.SEARCH);

/**
* Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Propfind = createMappingDecorator(RequestMethod.PROPFIND);

/**
* Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Proppatch = createMappingDecorator(RequestMethod.PROPPATCH);

/**
* Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Mkcol = createMappingDecorator(RequestMethod.MKCOL);

/**
* Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Copy = createMappingDecorator(RequestMethod.COPY);

/**
* Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Move = createMappingDecorator(RequestMethod.MOVE);

/**
* Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Lock = createMappingDecorator(RequestMethod.LOCK);

/**
* Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Unlock = createMappingDecorator(RequestMethod.UNLOCK);
7 changes: 7 additions & 0 deletions packages/common/enums/http-status.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export enum HttpStatus {
NO_CONTENT = 204,
RESET_CONTENT = 205,
PARTIAL_CONTENT = 206,
MULTI_STATUS = 207,
ALREADY_REPORTED = 208,
CONTENT_DIFFERENT = 210,
AMBIGUOUS = 300,
MOVED_PERMANENTLY = 301,
FOUND = 302,
Expand Down Expand Up @@ -41,13 +44,17 @@ export enum HttpStatus {
I_AM_A_TEAPOT = 418,
MISDIRECTED = 421,
UNPROCESSABLE_ENTITY = 422,
LOCKED = 423,
FAILED_DEPENDENCY = 424,
PRECONDITION_REQUIRED = 428,
TOO_MANY_REQUESTS = 429,
UNRECOVERABLE_ERROR = 456,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
GATEWAY_TIMEOUT = 504,
HTTP_VERSION_NOT_SUPPORTED = 505,
INSUFFICIENT_STORAGE = 507,
LOOP_DETECTED = 508,
}
7 changes: 7 additions & 0 deletions packages/common/enums/request-method.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ export enum RequestMethod {
OPTIONS,
HEAD,
SEARCH,
PROPFIND,
PROPPATCH,
MKCOL,
COPY,
MOVE,
LOCK,
UNLOCK,
}
14 changes: 14 additions & 0 deletions packages/common/interfaces/http/http-server.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ export interface HttpServer<
put(path: string, handler: RequestHandler<TRequest, TResponse>): any;
patch(handler: RequestHandler<TRequest, TResponse>): any;
patch(path: string, handler: RequestHandler<TRequest, TResponse>): any;
propfind?(handler: RequestHandler<TRequest, TResponse>): any;
propfind?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
proppatch?(handler: RequestHandler<TRequest, TResponse>): any;
proppatch?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
mkcol?(handler: RequestHandler<TRequest, TResponse>): any;
mkcol?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
copy?(handler: RequestHandler<TRequest, TResponse>): any;
copy?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
move?(handler: RequestHandler<TRequest, TResponse>): any;
move?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
lock?(handler: RequestHandler<TRequest, TResponse>): any;
lock?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
unlock?(handler: RequestHandler<TRequest, TResponse>): any;
unlock?(path: string, handler: RequestHandler<TRequest, TResponse>): any;
all(path: string, handler: RequestHandler<TRequest, TResponse>): any;
all(handler: RequestHandler<TRequest, TResponse>): any;
options(handler: RequestHandler<TRequest, TResponse>): any;
Expand Down
Loading
Loading