Skip to content

Commit

Permalink
2024年7月18日 feat(AppsModel) 添加应用分类
Browse files Browse the repository at this point in the history
  • Loading branch information
ss1917 committed Jul 18, 2024
1 parent 8244a29 commit 00d9386
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion mg/handlers/apps_v4_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

import json
from abc import ABC
from libs.base_handler import BaseHandler

from websdk2.db_context import DBContextV2 as DBContext

from libs.base_handler import BaseHandler
from models.authority import RoleApps
from services.app_service import get_apps_list_for_main, get_apps_list_for_api, opt_obj, get_apps_list_for_role

Expand Down Expand Up @@ -71,12 +73,14 @@ def get(self, *args, **kwargs):

def post(self, *args, **kwargs):
data = json.loads(self.request.body.decode("utf-8"))
data.setdefault("classify", "SaaS")
res = opt_obj.handle_add(data)

self.write(res)

def put(self, *args, **kwargs):
data = json.loads(self.request.body.decode("utf-8"))
data.setdefault("classify", "SaaS")
res = opt_obj.handle_update(data)

self.write(res)
Expand Down
11 changes: 5 additions & 6 deletions models/paas_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
date : 2023年06月05日
desc : 平台管理
"""
# import json
# import base64
from sqlalchemy import Column, DateTime
from datetime import datetime
# from sqlalchemy.orm import relationship, backref
# from sqlalchemy import TypeDecorator
from sqlalchemy import Column, String, Integer, JSON, ForeignKey, UniqueConstraint, Text

from sqlalchemy import Column, String, Integer, JSON, UniqueConstraint, Text
from sqlalchemy import DateTime
from sqlalchemy.dialects.mysql import LONGTEXT, MEDIUMTEXT
from sqlalchemy.ext.declarative import declarative_base
from websdk2.utils.cc_crypto import AESCryptoV3

from models import TimeBaseModel

Base = declarative_base()
Expand All @@ -32,6 +30,7 @@ class AppsModel(TimeBaseModel, Base):
# path = Column('path', String(255), default='') # 文件加载地址
img = Column('img', String(255), default='') # 图片地址
icon = Column('icon', String(255), default='') # 图标
classify = Column('classify', String(50), default='SaaS', index=True) # 分类
description = Column('description', String(250), default='') # 描述、备注


Expand Down
5 changes: 3 additions & 2 deletions services/app_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
from sqlalchemy import or_
from websdk2.db_context import DBContextV2 as DBContext
from websdk2.sqlalchemy_pagination import paginate

# from websdk2.model_utils import CommonOptView, queryset_to_list
from libs.feature_model_utils import CommonOptView, queryset_to_list
from models.authority import RoleApps
from models.paas_model import AppsModel
# from websdk2.model_utils import CommonOptView, queryset_to_list
from libs.feature_model_utils import CommonOptView,queryset_to_list

opt_obj = CommonOptView(AppsModel)

Expand Down

0 comments on commit 00d9386

Please sign in to comment.