안이쁜데
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { GET } from "../defs";
|
import { ngGET } from "../defs";
|
||||||
import type { structure } from "../../apiStructure/sammoRootAPI";
|
import type { structure } from "../../apiStructure/sammoRootAPI";
|
||||||
import type { ExtractError, ExtractQuery, ExtractResponse } from "../../apiStructure/defs";
|
import type { ExtractError, ExtractQuery, ExtractResponse } from "../../apiStructure/defs";
|
||||||
|
|
||||||
@@ -7,11 +7,17 @@ type RType = ExtractResponse<BaseAPI>;
|
|||||||
type EType = ExtractError<BaseAPI>;
|
type EType = ExtractError<BaseAPI>;
|
||||||
type QType = ExtractQuery<BaseAPI>;
|
type QType = ExtractQuery<BaseAPI>;
|
||||||
|
|
||||||
export class ReqNonce extends GET<RType, EType, QType>{
|
/*export class ReqNonce extends GET<RType, EType, QType>{
|
||||||
readonly argValidator = undefined;
|
readonly argValidator = undefined;
|
||||||
readonly procDecorator = [] as const;
|
readonly procDecorator = [] as const;
|
||||||
protected ReqNonce = Symbol("ReqNonce");//TODO: remove this
|
protected ReqNonce = Symbol("ReqNonce");//TODO: remove this
|
||||||
protected override async api(query: QType): Promise<RType | EType | true> {
|
protected override async api(query: QType): Promise<RType | EType | true> {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
export const ReqNonce = ngGET<RType, EType, QType>(undefined)([] as const)(
|
||||||
|
(query, ctx, req, res) => {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
|
);
|
||||||
+10
-6
@@ -208,12 +208,16 @@ function ngGenerateAPI<R extends ValidResponse, E extends InvalidResponse, Q ext
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ngGET<R extends ValidResponse, E extends InvalidResponse, Q extends RawArgType, PD extends ProcDecoratorChain>(args: {
|
export function ngGET<R extends ValidResponse, E extends InvalidResponse, Q extends RawArgType>(argValidator?: ValidatorType<Q>){
|
||||||
argValidator?: ValidatorType<Q>,
|
return <PD extends ProcDecoratorChain>(procDecoratorChain: PD) => {
|
||||||
procDecoratorChain: PD,
|
return (callback: (query: Q, ctx: ResolveChain<PD>, expressReq: Request, expressRes: Response) => Promise<R | E | true>) => {
|
||||||
callback: (query: Q, ctx: ResolveChain<PD>, expressReq: Request, expressRes: Response) => Promise<R | E | true>,
|
return ngGenerateAPI<R, E, Q, PD>('get', {
|
||||||
}): ngAPIExecuter<R, E, Q, PD>{
|
argValidator,
|
||||||
return ngGenerateAPI<R, E, Q, PD>('get', args);
|
procDecoratorChain,
|
||||||
|
callback,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ngGET<R extends ValidResponse, E extends InvalidResponse, Q extends RawArgType, PD extends ProcDecoratorChain> extends ngAPIExecuter<R, E, Q, PD>{
|
interface ngGET<R extends ValidResponse, E extends InvalidResponse, Q extends RawArgType, PD extends ProcDecoratorChain> extends ngAPIExecuter<R, E, Q, PD>{
|
||||||
|
|||||||
Reference in New Issue
Block a user