@@ -54,19 +54,35 @@ export interface IAdminForthEndpointHandlerInput {
5454 tr : ITranslateFunction ;
5555}
5656
57- export interface IAdminForthEndpointOptions {
57+ export interface IAdminForthAuthenticatedEndpointHandlerInput extends IAdminForthEndpointHandlerInput {
58+ adminUser : AdminUser ;
59+ }
60+
61+ export interface IAdminForthEndpointOptionsBase {
5862 method : string ,
59- noAuth ?: boolean ,
6063 path : string ,
6164 description ?: string ,
6265 request_schema ?: AnySchemaObject ,
6366 response_schema ?: AnySchemaObject ,
6467 responce_schema ?: AnySchemaObject ,
6568 meta ?: Record < string , unknown > ,
6669 target ?: 'json' | 'upload' ,
70+ }
71+
72+ export interface IAdminForthAuthenticatedEndpointOptions extends IAdminForthEndpointOptionsBase {
73+ noAuth ?: false ,
74+ handler : ( input : IAdminForthAuthenticatedEndpointHandlerInput ) => void | Promise < any > ,
75+ }
76+
77+ export interface IAdminForthNoAuthEndpointOptions extends IAdminForthEndpointOptionsBase {
78+ noAuth : true ,
6779 handler : ( input : IAdminForthEndpointHandlerInput ) => void | Promise < any > ,
6880}
6981
82+ export type IAdminForthEndpointOptions =
83+ | IAdminForthAuthenticatedEndpointOptions
84+ | IAdminForthNoAuthEndpointOptions ;
85+
7086export type AdminForthExpressSchemaInput = AnySchemaObject | ZodType ;
7187
7288export interface IAdminForthExpressRouteSchema {
@@ -143,7 +159,8 @@ export interface IHttpServer {
143159 *
144160 * @param options : Object with method, path and handler properties.
145161 */
146- endpoint ( options : IAdminForthEndpointOptions ) : void ;
162+ endpoint ( options : IAdminForthAuthenticatedEndpointOptions ) : void ;
163+ endpoint ( options : IAdminForthNoAuthEndpointOptions ) : void ;
147164
148165}
149166
0 commit comments