diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.py index face70687a..66a3c3c952 100644 --- a/api/controllers/service_api/__init__.py +++ b/api/controllers/service_api/__init__.py @@ -8,4 +8,5 @@ api = ExternalApi(bp) from . import index from .app import app, audio, completion, conversation, file, message, workflow from .dataset import dataset, document, hit_testing, segment, upload_file -from .auth import login \ No newline at end of file +from .auth import login +from .user import profile \ No newline at end of file diff --git a/api/controllers/service_api/user/profile.py b/api/controllers/service_api/user/profile.py new file mode 100644 index 0000000000..850c6de918 --- /dev/null +++ b/api/controllers/service_api/user/profile.py @@ -0,0 +1,80 @@ +from flask import Blueprint +from flask_restful import Api, Resource # type: ignore + +from controllers.service_api import api + +class UserProfile(Resource): + def get(self): + """Get user profile. + --- + tags: + - user/profile + summary: Get profile + description: Get current user's profile information + security: + - ApiKeyAuth: [] + responses: + 200: + description: Profile retrieved successfully + schema: + type: object + properties: + username: + type: string + gender: + type: string + enum: [male, female, unknown] + major: + type: string + email: + type: string + format: email + 401: + description: Invalid or missing token + """ + pass + + def put(self): + """Update user profile. + --- + tags: + - user/profile + summary: Update profile + description: Update user profile information + security: + - ApiKeyAuth: [] + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + username: + type: string + maxLength: 10 + pattern: ^[a-zA-Z\u4e00-\u9fa5]+$ + description: Username (Chinese or English only) + gender: + type: string + enum: [male, female, unknown] + major: + type: string + maxLength: 20 + responses: + 200: + description: Profile updated successfully + schema: + type: object + properties: + success: + type: boolean + example: true + 400: + description: Invalid profile data + 401: + description: Invalid or missing token + """ + pass + +api.add_resource(UserProfile, '/user/profile') \ No newline at end of file