MaxKB/apps/application/views/application.py
shaohuzhang1 080a6031bd
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
feat: application save (#3150)
2025-05-27 11:08:55 +08:00

36 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: MaxKB
@Author虎虎
@file application.py
@date2025/5/26 16:51
@desc:
"""
from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import extend_schema
from rest_framework.request import Request
from rest_framework.views import APIView
from application.api.application_api import ApplicationCreateAPI
from application.serializers.application import ApplicationSerializer
from common import result
from common.auth import TokenAuth
class Application(APIView):
authentication_classes = [TokenAuth]
@extend_schema(
methods=['POST'],
description=_('Create an application'),
summary=_('Create an application'),
operation_id=_('Create an application'), # type: ignore
parameters=ApplicationCreateAPI.get_parameters(),
request=ApplicationCreateAPI.get_request(),
responses=ApplicationCreateAPI.get_response(),
tags=[_('Application')] # type: ignore
)
def post(self, request: Request, workspace_id: str):
return result.success(
ApplicationSerializer(data={'workspace_id': workspace_id, 'user_id': request.user.id}).insert(request.data))