From f613848d4ce4e5bf40f9c95e3c644965f671fd8d Mon Sep 17 00:00:00 2001 From: BryantHe Date: Thu, 26 Oct 2023 11:03:50 +0800 Subject: [PATCH] add: api for profiling --- app/api/v1/api.py | 9 ++++++++- app/api/v1/schema/api.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/api/v1/api.py b/app/api/v1/api.py index 95c61a3..353b84d 100644 --- a/app/api/v1/api.py +++ b/app/api/v1/api.py @@ -8,7 +8,7 @@ from flask import session from app import rpc from app.api.v1.exception.api import ImageUploadError, UserInfoError, ImageNotFound, DietCreationError -from app.api.v1.schema.api import ImageIn, ImagePreSignUrlOut, ImagePreSignUrlIn, DietImageIn +from app.api.v1.schema.api import ImageIn, ImagePreSignUrlOut, ImagePreSignUrlIn, DietImageIn, ProfilingIn from app.util.auth import login_required api = APIBlueprint('api', __name__) @@ -112,6 +112,13 @@ def get_image_presign_url(query_data): return {'image_presign_url': presign_url} +@api.get('/profiling') +@api.input(ProfilingIn, location='query') +@api.doc(summary='此接口用于性能测试', description='此接口用于性能测试') +def profiling(query_data): + result = rpc.storage.admin.identify(query_data['token']) + + @api.get('/hello') def hello(): result_one = f'我是您的专属接口提供服务器:' diff --git a/app/api/v1/schema/api.py b/app/api/v1/schema/api.py index afa3122..2c2373f 100644 --- a/app/api/v1/schema/api.py +++ b/app/api/v1/schema/api.py @@ -24,3 +24,7 @@ class ImageIdOut(Schema): image_id = String() +class ProfilingIn(Schema): + token = String() + +