fix: 统一响应补 hint 字段(对齐 api-contract)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bbf87b2805
commit
497dbcc903
@ -58,6 +58,7 @@ export class AllExceptionsFilter implements ExceptionFilter {
|
|||||||
code: code ?? status * 100,
|
code: code ?? status * 100,
|
||||||
message,
|
message,
|
||||||
data: null,
|
data: null,
|
||||||
|
hint: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,6 @@ function toUnixMs(value: unknown): unknown {
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class TransformInterceptor<T> implements NestInterceptor<T, unknown> {
|
export class TransformInterceptor<T> implements NestInterceptor<T, unknown> {
|
||||||
intercept(_context: ExecutionContext, next: CallHandler<T>): Observable<unknown> {
|
intercept(_context: ExecutionContext, next: CallHandler<T>): Observable<unknown> {
|
||||||
return next.handle().pipe(map((data) => ({ code: 0, message: 'ok', data: toUnixMs(data ?? null) })));
|
return next.handle().pipe(map((data) => ({ code: 0, message: 'ok', data: toUnixMs(data ?? null), hint: null })));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user