chore(api/controllers): Apply Ruff Formatter. (#7645)

This commit is contained in:
-LAN-
2024-08-26 15:29:10 +08:00
committed by GitHub
parent 7ae728a9a3
commit 13be84e4d4
104 changed files with 3849 additions and 3982 deletions

View File

@@ -9,29 +9,24 @@ from services.account_service import TenantService
class EnterpriseWorkspace(Resource):
@setup_required
@inner_api_only
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('name', type=str, required=True, location='json')
parser.add_argument('owner_email', type=str, required=True, location='json')
parser.add_argument("name", type=str, required=True, location="json")
parser.add_argument("owner_email", type=str, required=True, location="json")
args = parser.parse_args()
account = Account.query.filter_by(email=args['owner_email']).first()
account = Account.query.filter_by(email=args["owner_email"]).first()
if account is None:
return {
'message': 'owner account not found.'
}, 404
return {"message": "owner account not found."}, 404
tenant = TenantService.create_tenant(args['name'])
TenantService.create_tenant_member(tenant, account, role='owner')
tenant = TenantService.create_tenant(args["name"])
TenantService.create_tenant_member(tenant, account, role="owner")
tenant_was_created.send(tenant)
return {
'message': 'enterprise workspace created.'
}
return {"message": "enterprise workspace created."}
api.add_resource(EnterpriseWorkspace, '/enterprise/workspace')
api.add_resource(EnterpriseWorkspace, "/enterprise/workspace")