mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-25 09:23:07 +02:00
fix
This commit is contained in:
parent
82a17ea427
commit
b14d3cdc32
3 changed files with 24 additions and 8 deletions
|
@ -5,8 +5,8 @@ import type { InboxQueue } from '@/core/QueueModule.js';
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<'admin/queue/inboc-delayed'> {
|
||||
name = 'admin/queue/inboc-delayed' as const;
|
||||
export default class extends Endpoint<'admin/queue/inbox-delayed'> {
|
||||
name = 'admin/queue/inbox-delayed' as const;
|
||||
constructor(
|
||||
@Inject('queue:inbox') public inboxQueue: InboxQueue,
|
||||
) {
|
||||
|
|
|
@ -930,7 +930,7 @@ export const endpoints = {
|
|||
},
|
||||
}],
|
||||
},
|
||||
'admin/queue/inboc-delayed': {
|
||||
'admin/queue/inbox-delayed': {
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
|
|
|
@ -24,10 +24,31 @@ export type RolePolicies = {
|
|||
};
|
||||
|
||||
export type EndpointDefines = ReadonlyArray<{
|
||||
/**
|
||||
* 要求のJSON Schema
|
||||
* 何もないときはundefined
|
||||
* $refは使えない(ajv由来)
|
||||
*/
|
||||
req: DeepOmit<JSONSchema7, { $ref: never }> | undefined;
|
||||
|
||||
/**
|
||||
* 応答のJSON Schema
|
||||
* 何もないときはundefined
|
||||
*/
|
||||
res: JSONSchema7 | undefined;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* JSON Schemaのとき型に変換し、undefinedのときvoid | Record<string, never>を返す
|
||||
*/
|
||||
export type SchemaOrUndefined<T extends JSONSchema7 | undefined, IsResponse extends boolean = false> = T extends JSONSchema7 ? SchemaType<T, References, IsResponse> : (void | Record<string, never>);
|
||||
|
||||
/**
|
||||
* reqからresを推論する
|
||||
*/
|
||||
export type ResponseOf<D extends IEndpointMeta, P, IsResponse extends boolean = false, DD extends D['defines'][number] = D['defines'][number]> =
|
||||
P extends SchemaOrUndefined<DD['req'], IsResponse> ? SchemaOrUndefined<DD['res']> : never;
|
||||
|
||||
export interface IEndpointMeta {
|
||||
readonly stability?: 'deprecated' | 'experimental' | 'stable';
|
||||
|
||||
|
@ -127,9 +148,4 @@ export interface IEndpointMeta {
|
|||
readonly cacheSec?: number;
|
||||
}
|
||||
|
||||
export type SchemaOrUndefined<T extends JSONSchema7 | undefined, IsResponse extends boolean = false> = T extends JSONSchema7 ? SchemaType<T, References, IsResponse> : (void | Record<string, never>);
|
||||
|
||||
export type ResponseOf<D extends IEndpointMeta, P, IsResponse extends boolean = false, DD extends D['defines'][number] = D['defines'][number]> =
|
||||
P extends SchemaOrUndefined<DD['req'], IsResponse> ? SchemaOrUndefined<DD['res']> : never;
|
||||
|
||||
export type Endpoints = typeof endpoints;
|
||||
|
|
Loading…
Reference in a new issue